Java Code Examples for org.apache.ignite.configuration.IgniteConfiguration#setActiveOnStart()
The following examples show how to use
org.apache.ignite.configuration.IgniteConfiguration#setActiveOnStart() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IgniteChangeGlobalStateAbstractTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @param cnt Count. * @throws Exception If failed. */ private void startBackUpClientNodes(int cnt) throws Exception { for (int i = 0; i < cnt; i++) { String node = "node" + i; String name = node + backUpSuffix + clientSuffix; IgniteConfiguration cfg = getConfiguration(name); cfg.setConsistentId(node); cfg.setActiveOnStart(false); ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(backUpIpFinder); Ignite ig = startClientGrid(name, cfg); nodes.put(name, ig); } }
Example 2
Source File: IgnitePdsRebalancingOnNotStableTopologyTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setActiveOnStart(false); CacheConfiguration ccfg = defaultCacheConfiguration(); ccfg.setPartitionLossPolicy(PartitionLossPolicy.READ_ONLY_SAFE); ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); ccfg.setCacheMode(CacheMode.PARTITIONED); ccfg.setAffinity(new RendezvousAffinityFunction(false, 32)); ccfg.setBackups(2); cfg.setCacheConfiguration(ccfg); DataStorageConfiguration memCfg = new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration().setMaxSize(200L * 1024 * 1024).setPersistenceEnabled(true)) .setWalMode(WALMode.LOG_ONLY) .setCheckpointFrequency(CHECKPOINT_FREQUENCY); cfg.setDataStorageConfiguration(memCfg); return cfg; }
Example 3
Source File: Cache64kPartitionsTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration ccfg = new CacheConfiguration("default"); ccfg.setAffinity(new RendezvousAffinityFunction(false, CacheConfiguration.MAX_PARTITIONS_COUNT)); cfg.setCacheConfiguration(ccfg); cfg.setActiveOnStart(false); if (persistenceEnabled) { DataStorageConfiguration memCfg = new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setPersistenceEnabled(true) .setMaxSize(DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE) ) .setWalMode(WALMode.LOG_ONLY); cfg.setDataStorageConfiguration(memCfg); } return cfg; }
Example 4
Source File: ClientCreateCacheGroupOnJoinNodeMapsTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { final IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setActiveOnStart(false); boolean client = "client".equals(igniteInstanceName); cfg.setClientMode(client); if (client) { cfg.setCacheConfiguration(defaultCacheConfiguration().setNearConfiguration(null). setAffinity(new RendezvousAffinityFunction(false, 32))); } return cfg; }
Example 5
Source File: CacheResultIsNotNullOnPartitionLossTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setActiveOnStart(false); cfg.setIncludeEventTypes(EventType.EVT_CACHE_REBALANCE_PART_DATA_LOST); cfg.setCacheConfiguration( new CacheConfiguration<>(DEFAULT_CACHE_NAME) .setCacheMode(CacheMode.PARTITIONED) .setBackups(0) .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC) .setAffinity(new RendezvousAffinityFunction(false, 50)) .setPartitionLossPolicy(PartitionLossPolicy.READ_WRITE_SAFE) ); return cfg; }
Example 6
Source File: TxPartitionCounterStateAbstractTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setActiveOnStart(false); cfg.setAutoActivationEnabled(false); cfg.setConsistentId("node" + igniteInstanceName); cfg.setFailureHandler(new StopNodeFailureHandler()); cfg.setRebalanceThreadPoolSize(4); // Necessary to reproduce some issues. ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER); // TODO set this only for historical rebalance tests. cfg.setCommunicationSpi(new IgniteWalRebalanceTest.WalRebalanceCheckingCommunicationSpi()); cfg.setDataStorageConfiguration(new DataStorageConfiguration(). setWalHistorySize(1000). setWalSegmentSize(8 * MB).setWalMode(LOG_ONLY).setPageSize(1024). setCheckpointFrequency(MILLISECONDS.convert(365, DAYS)). setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(persistenceEnabled()). setInitialSize(100 * MB).setMaxSize(100 * MB))); if (!igniteInstanceName.startsWith(CLIENT_GRID_NAME)) cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME)); return cfg; }
Example 7
Source File: CacheValidatorMetricsTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setActiveOnStart(false); CacheConfiguration cCfg1 = new CacheConfiguration() .setName(CACHE_NAME_1) .setCacheMode(CacheMode.PARTITIONED) .setBackups(0) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) .setPartitionLossPolicy(PartitionLossPolicy.READ_ONLY_SAFE); CacheConfiguration cCfg2 = new CacheConfiguration() .setName(CACHE_NAME_2) .setCacheMode(CacheMode.REPLICATED) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) .setTopologyValidator(new TopologyValidator() { @Override public boolean validate(Collection<ClusterNode> nodes) { return nodes.size() == 2; } }); cfg.setCacheConfiguration(cCfg1, cCfg2); return cfg; }
Example 8
Source File: CachePartitionLostAfterSupplierHasLeftTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setCommunicationSpi(new TestRecordingCommunicationSpi()); cfg.setActiveOnStart(false); cfg.setConsistentId(igniteInstanceName); cfg.setDataStorageConfiguration( new DataStorageConfiguration() .setWalMode(WALMode.LOG_ONLY) .setWalSegmentSize(4 * 1024 * 1024) .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setPersistenceEnabled(persistence) .setMaxSize(100L * 1024 * 1024)) ); cfg.setCacheConfiguration(new CacheConfiguration(DEFAULT_CACHE_NAME). setAtomicityMode(TRANSACTIONAL). setCacheMode(PARTITIONED). setBackups(1). setPartitionLossPolicy(lossPlc). setAffinity(new RendezvousAffinityFunction(false, PARTS_CNT))); return cfg; }
Example 9
Source File: GridCachePartitionNotLoadedEventSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setActiveOnStart(false); if (igniteInstanceName.matches(".*\\d")) { String idStr = UUID.randomUUID().toString(); char[] chars = idStr.toCharArray(); chars[chars.length - 3] = '0'; chars[chars.length - 2] = '0'; chars[chars.length - 1] = igniteInstanceName.charAt(igniteInstanceName.length() - 1); cfg.setNodeId(UUID.fromString(new String(chars))); } cfg.setCommunicationSpi(new TestTcpCommunicationSpi()); CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); cacheCfg.setCacheMode(PARTITIONED); cacheCfg.setBackups(backupCnt); cacheCfg.setWriteSynchronizationMode(FULL_SYNC); cacheCfg.setAffinity(new RendezvousAffinityFunction(false, 32)); cfg.setCacheConfiguration(cacheCfg); cfg.setIncludeEventTypes(EventType.EVTS_ALL); return cfg; }
Example 10
Source File: IgniteTopologyValidatorGridSplitCacheTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); int idx = getTestIgniteInstanceIndex(gridName); Map<String, Object> userAttrs = new HashMap<>(4); int segment = idx % 2; userAttrs.put(DC_NODE_ATTR, segment); TcpDiscoverySpi disco = (TcpDiscoverySpi)cfg.getDiscoverySpi(); disco.setLocalPort(getDiscoPort(idx)); disco.setIpFinder(new TcpDiscoveryVmIpFinder().setAddresses(segmented() ? (segment == 0 ? SEG_FINDER_0 : SEG_FINDER_1) : SEG_FINDER_ALL)); if (idx != CONFIGLESS_GRID_IDX) { if (idx == RESOLVER_GRID_IDX) { userAttrs.put(ACTIVATOR_NODE_ATTR, "true"); } else cfg.setActiveOnStart(false); } cfg.setUserAttributes(userAttrs); cfg.setMemoryConfiguration(new MemoryConfiguration(). setDefaultMemoryPolicySize((50L << 20) + (100L << 20) * CACHES_CNT / GRID_CNT)); return cfg; }
Example 11
Source File: FileStoreHeapUtilizationJolBenchmark.java From ignite with Apache License 2.0 | 5 votes |
/** */ private IgniteConfiguration getConfiguration(String igniteInstanceName) { IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setIgniteInstanceName(igniteInstanceName); cfg.setDiscoverySpi( new TcpDiscoverySpi() .setIpFinder( new TcpDiscoveryVmIpFinder() .setAddresses(Collections.singleton("127.0.0.1:47500..47502")) ) ); CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME); ccfg.setAffinity(new RendezvousAffinityFunction(false, CacheConfiguration.MAX_PARTITIONS_COUNT)); cfg.setCacheConfiguration(ccfg); cfg.setActiveOnStart(false); DataStorageConfiguration memCfg = new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setPersistenceEnabled(true) .setMaxSize(DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE) ) .setWalMode(WALMode.LOG_ONLY); cfg.setDataStorageConfiguration(memCfg); return cfg; }
Example 12
Source File: TxRecoveryWithConcurrentRollbackTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String name) throws Exception { final IgniteConfiguration cfg = super.getConfiguration(name); cfg.setConsistentId(name); if (persistence) { cfg.setDataStorageConfiguration( new DataStorageConfiguration(). setWalSegmentSize(4 * 1024 * 1024). setWalHistorySize(1000). setCheckpointFrequency(Integer.MAX_VALUE). setDefaultDataRegionConfiguration( new DataRegionConfiguration().setPersistenceEnabled(true).setMaxSize(50 * 1024 * 1024))); } cfg.setActiveOnStart(false); cfg.setClientMode("client".equals(name)); cfg.setCommunicationSpi(new TestRecordingCommunicationSpi()); cfg.setCacheConfiguration(new CacheConfiguration(DEFAULT_CACHE_NAME). setCacheMode(PARTITIONED). setBackups(backups). setAtomicityMode(TRANSACTIONAL). setWriteSynchronizationMode(syncMode)); return cfg; }
Example 13
Source File: IgniteSequenceInternalCleanupTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setMetricsUpdateFrequency(10); cfg.setActiveOnStart(false); AtomicConfiguration atomicCfg = atomicConfiguration(); assertNotNull(atomicCfg); cfg.setAtomicConfiguration(atomicCfg); List<CacheConfiguration> cacheCfg = new ArrayList<>(); for (int i = 0; i < CACHES_CNT; i++) { cacheCfg.add(new CacheConfiguration("test" + i). setStatisticsEnabled(true). setCacheMode(PARTITIONED). setAtomicityMode(TRANSACTIONAL). setAffinity(new RendezvousAffinityFunction(false, 16))); } cfg.setCacheConfiguration(cacheCfg.toArray(new CacheConfiguration[cacheCfg.size()])); return cfg; }
Example 14
Source File: CacheNoAffinityExchangeTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setCommunicationSpi(new TestRecordingCommunicationSpi()); cfg.setDiscoverySpi(new TestDiscoverySpi().setIpFinder(IP_FINDER)); cfg.setActiveOnStart(false); cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration( new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024))); if (cfg.isClientMode()) { // It is necessary to ensure that client always connects to grid(0). ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(CLIENT_IP_FINDER); if (startClientCaches) { CacheConfiguration<Integer, Integer> txCfg = new CacheConfiguration<Integer, Integer>() .setName(PARTITIONED_TX_CLIENT_CACHE_NAME) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC) .setAffinity(new RendezvousAffinityFunction(false, 32)) .setBackups(2); cfg.setCacheConfiguration(txCfg); } } return cfg; }
Example 15
Source File: ClusterStateOnStartPropertyTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName) .setClusterStateOnStart(state) .setCacheConfiguration(new CacheConfiguration().setName(DEFAULT_CACHE_NAME)) .setConsistentId(igniteInstanceName) .setDataStorageConfiguration( new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration().setPersistenceEnabled(persistence) ) ); if (autoActivation != null) cfg.setAutoActivationEnabled(autoActivation); if (activeOnStart != null) cfg.setActiveOnStart(activeOnStart); // Warn messages must be printed only if both options (old and new) are presented. if (autoActivation != null || activeOnStart != null) { ListeningTestLogger testLog = new ListeningTestLogger(false, log); LogListener lsnr = LogListener.matches( persistence ? "Property `autoActivation` will be ignored due to the property `clusterStateOnStart` is presented." : "Property `activeOnStart` will be ignored due to the property `clusterStateOnStart` is presented." ).build(); testLog.registerListener(lsnr); logListeners.put(igniteInstanceName, lsnr); cfg.setGridLogger(testLog); } return cfg; }
Example 16
Source File: IgnitePdsWholeClusterRestartTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); DataStorageConfiguration memCfg = new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration().setMaxSize(100L * 1024 * 1024).setPersistenceEnabled(true)) .setWalMode(WALMode.LOG_ONLY); cfg.setDataStorageConfiguration(memCfg); CacheConfiguration ccfg1 = defaultCacheConfiguration(); ccfg1.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); ccfg1.setRebalanceMode(CacheRebalanceMode.SYNC); ccfg1.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); ccfg1.setAffinity(new RendezvousAffinityFunction(false, 32)); ccfg1.setBackups(2); cfg.setActiveOnStart(false); // To avoid hostname lookup on start. cfg.setCheckpointSpi(new NoopCheckpointSpi()); cfg.setCacheConfiguration(ccfg1); cfg.setConsistentId(gridName); return cfg; }
Example 17
Source File: CommonSecurityCheckTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @param instanceName Instance name. */ @Override protected IgniteConfiguration getConfiguration(String instanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(instanceName); cfg.setActiveOnStart(false); boolean isClient = instanceName.endsWith("2"); String name = isClient ? "client_" + instanceName : "srv_" + instanceName; cfg.setPluginProviders(getPluginProvider(name)); SslContextFactory sslFactory = (SslContextFactory) GridTestUtils.sslFactory(); cfg.setSslContextFactory(sslFactory); cfg.setConnectorConfiguration(new ConnectorConfiguration() .setSslEnabled(true) .setSslClientAuth(true) .setSslClientAuth(true) .setSslFactory(sslFactory)); cfg.setClientConnectorConfiguration(new ClientConnectorConfiguration() .setSslEnabled(true) .setSslClientAuth(true) .setUseIgniteSslContextFactory(false) .setSslContextFactory(sslFactory)); if (instanceName.endsWith("0")) cfg.setGridLogger(listeningLog); if (isClient) cfg.setClientMode(true); if (!fail) { Map<String, String> attrs = new UserAttributesFactory().create(); cfg.setUserAttributes(attrs); } return cfg; }
Example 18
Source File: CachePartitionLossWithRestartsTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setActiveOnStart(false); cfg.setConsistentId(igniteInstanceName); if (getTestIgniteInstanceIndex(igniteInstanceName) == clientIdx) cfg.setClientMode(true); cfg.setIncludeEventTypes(EventType.EVTS_ALL); DataStorageConfiguration dsCfg = new DataStorageConfiguration(); dsCfg.setWalSegmentSize(4 * 1024 * 1024); dsCfg.setWalMode(WALMode.LOG_ONLY); final int size = 50 * 1024 * 1024; DataRegionConfiguration dfltRegCfg = new DataRegionConfiguration(); dfltRegCfg.setName(DEFAULT_CACHE_NAME).setInitialSize(size).setMaxSize(size).setPersistenceEnabled(dfltRegionPersistence); dsCfg.setDefaultDataRegionConfiguration(dfltRegCfg); cfg.setDataStorageConfiguration(dsCfg); // Do not start cache on non-affinity node. CacheConfiguration ccfg = defaultCacheConfiguration().setNearConfiguration(null). setNodeFilter(new AttributeNodeFilter(START_CACHE_ATTR, Boolean.TRUE)). setBackups(0). setAffinity(new RendezvousAffinityFunction(false, PARTS_CNT)); if (mvccEnabled) ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); if (startClientCache) cfg.setCacheConfiguration(ccfg); if (getTestIgniteInstanceIndex(igniteInstanceName) != nonAffIdx) { cfg.setUserAttributes(F.asMap(START_CACHE_ATTR, Boolean.TRUE)); if (!startClientCache) cfg.setCacheConfiguration(ccfg); } return cfg; }
Example 19
Source File: ClusterStateNoRebalanceAbstractTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setActiveOnStart(false); cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME)); cfg.setClientMode(gridName.startsWith("client")); cfg.setCommunicationSpi(new TestCommunicationSpi()); return cfg; }
Example 20
Source File: CacheRentingStateRepairTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setAffinity(new RendezvousAffinityFunction(false, PARTS).setPartitions(64)); ccfg.setOnheapCacheEnabled(false); ccfg.setBackups(1); ccfg.setRebalanceBatchSize(100); cfg.setCommunicationSpi(new TestRecordingCommunicationSpi()); cfg.setCacheConfiguration(ccfg); cfg.setActiveOnStart(false); cfg.setConsistentId(igniteInstanceName); long sz = 100 * 1024 * 1024; DataStorageConfiguration memCfg = new DataStorageConfiguration().setPageSize(1024) .setDefaultDataRegionConfiguration( new DataRegionConfiguration().setPersistenceEnabled(true).setInitialSize(sz).setMaxSize(sz)) .setWalSegmentSize(8 * 1024 * 1024) .setWalMode(WALMode.LOG_ONLY).setCheckpointFrequency(24L * 60 * 60 * 1000); cfg.setDataStorageConfiguration(memCfg); return cfg; }