/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration c = super.getConfiguration(gridName); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setIpFinder(ipFinder); c.setDiscoverySpi(disco); // Cache. CacheConfiguration cc = defaultCacheConfiguration(); cc.setCacheMode(CacheMode.PARTITIONED); cc.setAtomicityMode(CacheAtomicityMode.ATOMIC); cc.setNearConfiguration(null); cc.setWriteSynchronizationMode(FULL_SYNC); cc.setRebalanceMode(SYNC); cc.setSwapEnabled(false); cc.setSqlFunctionClasses(GridQueryParsingTest.class); cc.setIndexedTypes( String.class, Address.class, String.class, Person.class); c.setCacheConfiguration(cc); return c; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setIpFinder(IP_FINDER); cfg.getTransactionConfiguration().setTxSerializableEnabled(true); cfg.setDiscoverySpi(disco); BasicWarmupClosure warmupClosure = new BasicWarmupClosure(); warmupClosure.setGridCount(2); warmupClosure.setIterationCount(10); warmupClosure.setKeyRange(10); cfg.setWarmupClosure(warmupClosure); CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>(); cacheCfg.setCacheMode(CacheMode.PARTITIONED); cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC); cacheCfg.setBackups(1); cacheCfg.setName("test"); cfg.setCacheConfiguration(cacheCfg); return cfg; }
/** * Start grid with IGFS. * * @param gridName Grid name. * @param igfsName IGFS name * @param mode IGFS mode. * @param secondaryFs Secondary file system (optional). * @param restCfg Rest configuration string (optional). * @return Started grid instance. * @throws Exception If failed. */ protected Ignite startGridWithIgfs( String gridName, String igfsName, IgfsMode mode, @Nullable IgfsSecondaryFileSystem secondaryFs, @Nullable IgfsIpcEndpointConfiguration restCfg) throws Exception { FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setDataCacheName("dataCache"); igfsCfg.setMetaCacheName("metaCache"); igfsCfg.setName(igfsName); igfsCfg.setBlockSize(IGFS_BLOCK_SIZE); igfsCfg.setDefaultMode(mode); igfsCfg.setIpcEndpointConfiguration(restCfg); igfsCfg.setSecondaryFileSystem(secondaryFs); igfsCfg.setPrefetchBlocks(PREFETCH_BLOCKS); igfsCfg.setSequentialReadsBeforePrefetch(SEQ_READS_BEFORE_PREFETCH); CacheConfiguration dataCacheCfg = defaultCacheConfiguration(); dataCacheCfg.setName("dataCache"); dataCacheCfg.setCacheMode(PARTITIONED); dataCacheCfg.setNearConfiguration(null); dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(2)); dataCacheCfg.setBackups(0); dataCacheCfg.setAtomicityMode(TRANSACTIONAL); dataCacheCfg.setOffHeapMaxMemory(0); CacheConfiguration metaCacheCfg = defaultCacheConfiguration(); metaCacheCfg.setName("metaCache"); metaCacheCfg.setCacheMode(REPLICATED); metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); metaCacheCfg.setAtomicityMode(TRANSACTIONAL); IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setGridName(gridName); TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true)); cfg.setDiscoverySpi(discoSpi); cfg.setCacheConfiguration(dataCacheCfg, metaCacheCfg); cfg.setFileSystemConfiguration(igfsCfg); cfg.setLocalHost("127.0.0.1"); cfg.setConnectorConfiguration(null); return G.start(cfg); }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setIpFinder(ipFinder); cfg.setDiscoverySpi(disco); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { Collection<String> hostNames = Arrays.asList("h_1", "h_2", "h_3"); IgniteConfiguration cfg = super.getConfiguration(gridName); TcpDiscoverySpi disco = (TcpDiscoverySpi) cfg.getDiscoverySpi(); cfg.setDiscoverySpi(new CustomHostsTcpDiscoverySpi(hostNames).setIpFinder(disco.getIpFinder())); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setMarshaller(new OptimizedMarshaller(false)); cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(ipFinder).setForceServerMode(true)); cfg.setCacheConfiguration(); if (gridName.equals(getTestGridName(0))) cfg.setClientMode(true); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); discoSpi.setIpFinder(IP_FINDER); cfg.setDiscoverySpi(discoSpi); cfg.setCacheConfiguration(cacheConfiguration()); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration() throws Exception { IgniteConfiguration cfg = super.getConfiguration(); cfg.setPeerClassLoadingEnabled(false); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setIpFinder(ipFinder); cfg.setDiscoverySpi(disco); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); BinaryConfiguration binCfg = new BinaryConfiguration(); binCfg.setTypeConfigurations( Arrays.asList( new BinaryTypeConfiguration() { { setTypeName(Key.class.getName()); setIdentityResolver(BinaryArrayIdentityResolver.instance()); } }, new BinaryTypeConfiguration() { { setTypeName(Key2.class.getName()); setIdentityResolver(BinaryArrayIdentityResolver.instance()); } }, new BinaryTypeConfiguration() { { setTypeName(Key3.class.getName()); setIdentityResolver(new BinaryFieldIdentityResolver().setFieldNames("key")); } }, new BinaryTypeConfiguration() { { setTypeName(Key4.class.getName()); setIdentityResolver(new Key4Id()); } })); cfg.setBinaryConfiguration(binCfg); cfg.setPeerClassLoadingEnabled(false); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setIpFinder(ipFinder); cfg.setDiscoverySpi(disco); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); TcpDiscoverySpi spi = new TcpDiscoverySpi(); spi.setIpFinder(IP_FINDER); cfg.setDiscoverySpi(spi); cfg.setCacheConfiguration(); cfg.setMetricsUpdateFrequency(0); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { assert gridName != null; IgniteConfiguration cfg = super.getConfiguration(gridName); TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); discoSpi.setIpFinder(IP_FINDER); cfg.setDiscoverySpi(discoSpi); if (gridName.contains("cache")) { String cacheName = "test-checkpoints"; CacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setName(cacheName); cacheCfg.setWriteSynchronizationMode(FULL_SYNC); CacheCheckpointSpi spi = new CacheCheckpointSpi(); spi.setCacheName(cacheName); cfg.setCacheConfiguration(cacheCfg); cfg.setCheckpointSpi(spi); } else if (gridName.contains("jdbc")) { JdbcCheckpointSpi spi = new JdbcCheckpointSpi(); jdbcDataSource ds = new jdbcDataSource(); ds.setDatabase("jdbc:hsqldb:mem:gg_test_" + getClass().getSimpleName()); ds.setUser("sa"); ds.setPassword(""); spi.setDataSource(ds); spi.setCheckpointTableName("test_checkpoints"); spi.setKeyFieldName("key"); spi.setValueFieldName("value"); spi.setValueFieldType("longvarbinary"); spi.setExpireDateFieldName("expire_date"); cfg.setCheckpointSpi(spi); } return cfg; }
/** {@inheritDoc} */ @SuppressWarnings({"IfMayBeConditional"}) @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); if (client()) cfg.setClientMode(true); cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(ipFinder)); cfg.setCacheConfiguration(); cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED); cfg.setIncludeProperties(); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setIpFinder(ipFinder); cfg.setDiscoverySpi(disco); CacheConfiguration ccfg1 = cacheConfiguration().setName(CACHE1); CacheConfiguration ccfg2 = cacheConfiguration().setName(CACHE2); cfg.setCacheConfiguration(ccfg1, ccfg2); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setDeploymentMode(CONTINUOUS); if (GRID_NAME.equals(gridName)) cfg.setCacheConfiguration(); else cfg.setCacheConfiguration(cacheConfiguration()); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setIpFinder(IP_FINDER); cfg.setDiscoverySpi(disco); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setMaxMissedHeartbeats(Integer.MAX_VALUE); disco.setIpFinder(ipFinder); if (isDebug()) disco.setAckTimeout(Integer.MAX_VALUE); cfg.setDiscoverySpi(disco); cfg.setCacheConfiguration(cacheConfiguration(gridName)); return cfg; }
/** * Configure node. * * @param gridIdx Grid name index. * @param client If {@code true} then start client node. * @return IgniteConfiguration */ private static IgniteConfiguration igniteConfiguration(int gridIdx, boolean client) { IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setGridName((client ? "demo-server-" : "demo-client-") + gridIdx); cfg.setLocalHost("127.0.0.1"); cfg.setIncludeEventTypes(EVTS_DISCOVERY); TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(); ipFinder.setAddresses(Collections.singletonList("127.0.0.1:60900.." + (60900 + NODE_CNT - 1))); // Configure discovery SPI. TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); discoSpi.setLocalPort(60900); discoSpi.setIpFinder(ipFinder); cfg.setDiscoverySpi(discoSpi); TcpCommunicationSpi commSpi = new TcpCommunicationSpi(); commSpi.setSharedMemoryPort(-1); commSpi.setLocalPort(60800); cfg.setCommunicationSpi(commSpi); cfg.setGridLogger(new Log4JLogger(log)); cfg.setMetricsLogFrequency(0); cfg.getConnectorConfiguration().setPort(60700); if (client) cfg.setClientMode(true); else cfg.setCacheConfiguration( cacheCountry(), cacheDepartment(), cacheEmployee(), cacheParking(), cacheCar()); return cfg; }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration c = super.getConfiguration(gridName); TransactionConfiguration txCfg = c.getTransactionConfiguration(); txCfg.setDefaultTxConcurrency(txConcurrency); txCfg.setDefaultTxIsolation(txIsolation); txCfg.setTxSerializableEnabled(true); CacheConfiguration cc = defaultCacheConfiguration(); cc.setCacheMode(cacheMode()); cc.setAtomicityMode(TRANSACTIONAL); cc.setSwapEnabled(false); cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); cc.setEvictionPolicy(plc); cc.setEvictSynchronizedKeyBufferSize(1); cc.setEvictSynchronized(true); if (testStore != null) { cc.setCacheStoreFactory(singletonFactory(testStore)); cc.setReadThrough(true); cc.setWriteThrough(true); cc.setLoadPreviousValue(true); } else cc.setCacheStoreFactory(null); c.setCacheConfiguration(cc); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setIpFinder(ipFinder); c.setDiscoverySpi(disco); return c; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration c = super.getConfiguration(gridName); TcpDiscoverySpi spi = new TcpDiscoverySpi(); spi.setIpFinder(ipFinder); c.setDiscoverySpi(spi); CacheConfiguration cc = defaultCacheConfiguration(); cc.setName("test"); cc.setCacheMode(PARTITIONED); cc.setWriteSynchronizationMode(FULL_SYNC); cc.setAtomicityMode(TRANSACTIONAL); cc.setNearConfiguration(null); c.setCacheConfiguration(cc); return c; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration c = super.getConfiguration(gridName); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setIpFinder(ipFinder); c.setDiscoverySpi(disco); CacheConfiguration<?, ?> cc = defaultCacheConfiguration(); cc.setCacheMode(PARTITIONED); cc.setBackups(1); cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); cc.setAtomicityMode(TRANSACTIONAL); cc.setIndexedTypes(Integer.class, Integer.class); c.setCacheConfiguration(cc); return c; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); CacheConfiguration<?, ?> cache = defaultCacheConfiguration(); cache.setCacheMode(PARTITIONED); cache.setBackups(1); cache.setWriteSynchronizationMode(FULL_SYNC); cache.setIndexedTypes(Integer.class, TestObject.class); cfg.setCacheConfiguration(cache); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setIpFinder(IP_FINDER); cfg.setDiscoverySpi(disco); cfg.setConnectorConfiguration(new ConnectorConfiguration()); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); TcpDiscoverySpi spi = new TcpDiscoverySpi(); spi.setIpFinder(IP_FINDER); cfg.setDiscoverySpi(spi); cfg.setIncludeProperties(); cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED); cfg.setConnectorConfiguration(null); cfg.setPeerClassLoadingEnabled(true); if (useCache) { CacheConfiguration cc = defaultCacheConfiguration(); cc.setCacheMode(PARTITIONED); cc.setNearConfiguration(null); cc.setWriteSynchronizationMode(FULL_SYNC); cc.setStartSize(ENTRY_CNT / GRID_CNT); cc.setSwapEnabled(false); cc.setBackups(1); cfg.setCacheSanityCheckEnabled(false); cfg.setCacheConfiguration(cc); } else cfg.setCacheConfiguration(); return cfg; }