Search in sources :

Example 91 with IgniteConfiguration

use of org.apache.ignite.configuration.IgniteConfiguration in project ignite by apache.

the class IgniteSqlSegmentedIndexSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);
    CacheKeyConfiguration keyCfg = new CacheKeyConfiguration("MyCache", "affKey");
    cfg.setCacheKeyConfiguration(keyCfg);
    cfg.setPeerClassLoadingEnabled(false);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(ipFinder);
    cfg.setDiscoverySpi(disco);
    return cfg;
}
Also used : CacheKeyConfiguration(org.apache.ignite.cache.CacheKeyConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 92 with IgniteConfiguration

use of org.apache.ignite.configuration.IgniteConfiguration in project ignite by apache.

the class CacheQueryJsr310Java8DateTimeApiBaseTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi discoverySpi = (TcpDiscoverySpi) cfg.getDiscoverySpi();
    discoverySpi.setIpFinder(IP_FINDER);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 93 with IgniteConfiguration

use of org.apache.ignite.configuration.IgniteConfiguration in project ignite by apache.

the class AgentClusterDemo method tryStart.

/**
 * Start ignite node with cacheEmployee and populate it with data.
 */
public static CountDownLatch tryStart() {
    if (initGuard.compareAndSet(false, true)) {
        log.info("DEMO: Starting embedded nodes for demo...");
        System.setProperty(IGNITE_NO_ASCII, "true");
        System.setProperty(IGNITE_QUIET, "false");
        System.setProperty(IGNITE_UPDATE_NOTIFIER, "false");
        System.setProperty(IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE, "20");
        System.setProperty(IGNITE_PERFORMANCE_SUGGESTIONS_DISABLED, "true");
        final AtomicInteger basePort = new AtomicInteger(60700);
        final AtomicInteger cnt = new AtomicInteger(-1);
        final ScheduledExecutorService execSrv = newScheduledThreadPool(1, "demo-nodes-start");
        execSrv.scheduleAtFixedRate(new Runnable() {

            @Override
            public void run() {
                int idx = cnt.incrementAndGet();
                int port = basePort.get();
                boolean first = idx == 0;
                try {
                    IgniteConfiguration cfg = igniteConfiguration(port, idx, false);
                    if (first) {
                        U.delete(Paths.get(cfg.getWorkDirectory()));
                        U.resolveWorkDirectory(cfg.getWorkDirectory(), cfg.getDataStorageConfiguration().getStoragePath(), true);
                    }
                    Ignite ignite = Ignition.start(cfg);
                    if (first) {
                        ClusterNode node = ignite.cluster().localNode();
                        Collection<String> jettyAddrs = node.attribute(ATTR_REST_JETTY_ADDRS);
                        if (jettyAddrs == null) {
                            Ignition.stopAll(true);
                            throw new IgniteException("DEMO: Failed to start Jetty REST server on embedded node");
                        }
                        String jettyHost = jettyAddrs.iterator().next();
                        Integer jettyPort = node.attribute(ATTR_REST_JETTY_PORT);
                        if (F.isEmpty(jettyHost) || jettyPort == null)
                            throw new IgniteException("DEMO: Failed to start Jetty REST handler on embedded node");
                        log.info("DEMO: Started embedded node for demo purpose [TCP binary port={}, Jetty REST port={}]", port, jettyPort);
                        demoUrl = String.format("http://%s:%d", jettyHost, jettyPort);
                        initLatch.countDown();
                    }
                } catch (Throwable e) {
                    if (first) {
                        basePort.getAndAdd(50);
                        log.warn("DEMO: Failed to start embedded node.", e);
                    } else
                        log.error("DEMO: Failed to start embedded node.", e);
                } finally {
                    if (idx == NODE_CNT) {
                        Ignite ignite = Ignition.ignite(SRV_NODE_NAME + 0);
                        if (ignite != null) {
                            ignite.cluster().active(true);
                            deployServices(ignite.services(ignite.cluster().forServers()));
                        }
                        log.info("DEMO: All embedded nodes for demo successfully started");
                        execSrv.shutdown();
                    }
                }
            }
        }, 1, 5, TimeUnit.SECONDS);
    }
    return initLatch;
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) IgniteException(org.apache.ignite.IgniteException) Collection(java.util.Collection) Ignite(org.apache.ignite.Ignite)

Example 94 with IgniteConfiguration

use of org.apache.ignite.configuration.IgniteConfiguration in project ignite by apache.

the class GridIndexingSpiAbstractSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);
    cfg.setMarshaller(new BinaryMarshaller());
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller)

Example 95 with IgniteConfiguration

use of org.apache.ignite.configuration.IgniteConfiguration in project ignite by apache.

the class IgfsSizeSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
    igfsCfg.setName(IGFS_NAME);
    igfsCfg.setBlockSize(BLOCK_SIZE);
    igfsCfg.setFragmentizerEnabled(false);
    igfsCfg.setManagementPort(++mgmtPort);
    CacheConfiguration dataCfg = defaultCacheConfiguration();
    dataCfg.setCacheMode(cacheMode);
    if (cacheMode == PARTITIONED) {
        if (nearEnabled)
            dataCfg.setNearConfiguration(new NearCacheConfiguration());
        dataCfg.setBackups(0);
    }
    dataCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    dataCfg.setRebalanceMode(SYNC);
    dataCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
    dataCfg.setAtomicityMode(TRANSACTIONAL);
    CacheConfiguration metaCfg = defaultCacheConfiguration();
    metaCfg.setCacheMode(REPLICATED);
    metaCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    metaCfg.setRebalanceMode(SYNC);
    metaCfg.setAtomicityMode(TRANSACTIONAL);
    igfsCfg.setMetaCacheConfiguration(metaCfg);
    igfsCfg.setDataCacheConfiguration(dataCfg);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(discoSpi);
    cfg.setFileSystemConfiguration(igfsCfg);
    if (memIgfsdDataPlcSetter != null)
        memIgfsdDataPlcSetter.apply(cfg);
    return cfg;
}
Also used : IgfsGroupDataBlocksKeyMapper(org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) FileSystemConfiguration(org.apache.ignite.configuration.FileSystemConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)2118 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)686 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)404 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)385 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)363 Ignite (org.apache.ignite.Ignite)194 Test (org.junit.Test)182 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)161 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)127 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)123 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)105 TestRecordingCommunicationSpi (org.apache.ignite.internal.TestRecordingCommunicationSpi)98 IgniteEx (org.apache.ignite.internal.IgniteEx)95 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)89 IgniteException (org.apache.ignite.IgniteException)78 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)75 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)72 ConnectorConfiguration (org.apache.ignite.configuration.ConnectorConfiguration)68 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)65 ArrayList (java.util.ArrayList)55