Java Code Examples for org.apache.ignite.configuration.IgniteConfiguration#setCheckpointSpi()
The following examples show how to use
org.apache.ignite.configuration.IgniteConfiguration#setCheckpointSpi() .
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: GridSessionCheckpointSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @throws Exception If failed. */ @Test public void testJdbcCheckpoint() throws Exception { IgniteConfiguration cfg = getConfiguration(); jdbcDataSource ds = new jdbcDataSource(); ds.setDatabase("jdbc:hsqldb:mem:gg_test"); ds.setUser("sa"); ds.setPassword(""); JdbcCheckpointSpi spi = new JdbcCheckpointSpi(); spi.setDataSource(ds); spi.setCheckpointTableName("checkpoints"); spi.setKeyFieldName("key"); spi.setValueFieldName("value"); spi.setValueFieldType("longvarbinary"); spi.setExpireDateFieldName("create_date"); GridSessionCheckpointSelfTest.spi = spi; cfg.setCheckpointSpi(spi); checkCheckpoints(cfg); }
Example 2
Source File: ConfigVariationsFactory.java From ignite with Apache License 2.0 | 6 votes |
/** * @param cfg Config. * @param srcCfg Source config. */ private static void copyDefaultsFromSource(IgniteConfiguration cfg, IgniteConfiguration srcCfg) { cfg.setIgniteInstanceName(srcCfg.getIgniteInstanceName()); cfg.setGridLogger(srcCfg.getGridLogger()); cfg.setNodeId(srcCfg.getNodeId()); cfg.setIgniteHome(srcCfg.getIgniteHome()); cfg.setMBeanServer(srcCfg.getMBeanServer()); cfg.setMetricsLogFrequency(srcCfg.getMetricsLogFrequency()); cfg.setConnectorConfiguration(srcCfg.getConnectorConfiguration()); cfg.setCommunicationSpi(srcCfg.getCommunicationSpi()); cfg.setNetworkTimeout(srcCfg.getNetworkTimeout()); cfg.setDiscoverySpi(srcCfg.getDiscoverySpi()); cfg.setCheckpointSpi(srcCfg.getCheckpointSpi()); cfg.setIncludeEventTypes(srcCfg.getIncludeEventTypes()); // Specials. ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1); ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true); cfg.getTransactionConfiguration().setTxSerializableEnabled(true); }
Example 3
Source File: GridMbeansMiscTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); if (collisionSpi != null) cfg.setCollisionSpi(collisionSpi); if (loadBalancingSpi != null) cfg.setLoadBalancingSpi(loadBalancingSpi); if (deploymentSpi != null) cfg.setDeploymentSpi(deploymentSpi); if (checkpointSpi != null) cfg.setCheckpointSpi(checkpointSpi); return cfg; }
Example 4
Source File: GridSessionCheckpointSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @throws Exception If failed. */ @Test public void testSharedFsCheckpoint() throws Exception { IgniteConfiguration cfg = getConfiguration(); cfg.setCheckpointSpi(spi = new SharedFsCheckpointSpi()); checkCheckpoints(cfg); }
Example 5
Source File: GridCheckpointTaskSelfTest.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.setCacheConfiguration(cacheConfiguration()); cfg.setCheckpointSpi(checkpointSpi()); return cfg; }
Example 6
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 7
Source File: GridMultipleSpisSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); GridTestFailoverSpi fail1 = new GridTestFailoverSpi("fail2"); GridTestFailoverSpi fail2 = new GridTestFailoverSpi("fail2"); fail1.setName("fail1"); fail2.setName("fail2"); GridTestLoadBalancingSpi load1 = new GridTestLoadBalancingSpi("load2"); GridTestLoadBalancingSpi load2 = new GridTestLoadBalancingSpi("load2"); load1.setName("load1"); load2.setName("load2"); GridTestCheckpointSpi cp1 = new GridTestCheckpointSpi("cp2"); GridTestCheckpointSpi cp2 = new GridTestCheckpointSpi("cp2"); cp1.setName("cp1"); cp2.setName("cp2"); cfg.setFailoverSpi(fail1, fail2); cfg.setLoadBalancingSpi(load1, load2); cfg.setCheckpointSpi(cp1, cp2); return cfg; }
Example 8
Source File: GridJobCheckpointCleanupSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration c = super.getConfiguration(igniteInstanceName); c.setCheckpointSpi(checkpointSpi); return c; }
Example 9
Source File: S3CheckpointManagerSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { assertTrue("Unexpected Ignite instance name: " + igniteInstanceName, igniteInstanceName.contains("s3")); IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); S3CheckpointSpi spi = new S3CheckpointSpi(); AWSCredentials cred = new BasicAWSCredentials(IgniteS3TestSuite.getAccessKey(), IgniteS3TestSuite.getSecretKey()); spi.setAwsCredentials(cred); spi.setBucketNameSuffix(S3CheckpointSpiSelfTest.getBucketNameSuffix()); cfg.setCheckpointSpi(spi); return cfg; }
Example 10
Source File: S3SessionCheckpointSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** * @throws Exception If failed. */ @Ignore("https://issues.apache.org/jira/browse/IGNITE-2420") @Test public void testS3Checkpoint() throws Exception { IgniteConfiguration cfg = getConfiguration(); S3CheckpointSpi spi = new S3CheckpointSpi(); AWSCredentials cred = new BasicAWSCredentials(IgniteS3TestSuite.getAccessKey(), IgniteS3TestSuite.getSecretKey()); spi.setAwsCredentials(cred); spi.setBucketNameSuffix(S3CheckpointSpiSelfTest.getBucketNameSuffix()); cfg.setCheckpointSpi(spi); GridSessionCheckpointSelfTest.spi = spi; checkCheckpoints(cfg); }
Example 11
Source File: IgnitionEx.java From ignite with Apache License 2.0 | 4 votes |
/** * Initialize default SPI implementations. * * @param cfg Ignite configuration. */ private void initializeDefaultSpi(IgniteConfiguration cfg) { if (cfg.getDiscoverySpi() == null) cfg.setDiscoverySpi(new TcpDiscoverySpi()); if (cfg.getDiscoverySpi() instanceof TcpDiscoverySpi) { TcpDiscoverySpi tcpDisco = (TcpDiscoverySpi)cfg.getDiscoverySpi(); if (tcpDisco.getIpFinder() == null) tcpDisco.setIpFinder(new TcpDiscoveryMulticastIpFinder()); } if (cfg.getCommunicationSpi() == null) cfg.setCommunicationSpi(new TcpCommunicationSpi()); if (cfg.getDeploymentSpi() == null) cfg.setDeploymentSpi(new LocalDeploymentSpi()); if (cfg.getEventStorageSpi() == null) cfg.setEventStorageSpi(new NoopEventStorageSpi()); if (cfg.getCheckpointSpi() == null) cfg.setCheckpointSpi(new NoopCheckpointSpi()); if (cfg.getCollisionSpi() == null) cfg.setCollisionSpi(new NoopCollisionSpi()); if (cfg.getFailoverSpi() == null) cfg.setFailoverSpi(new AlwaysFailoverSpi()); if (cfg.getLoadBalancingSpi() == null) cfg.setLoadBalancingSpi(new RoundRobinLoadBalancingSpi()); else { Collection<LoadBalancingSpi> spis = new ArrayList<>(); boolean dfltLoadBalancingSpi = false; for (LoadBalancingSpi spi : cfg.getLoadBalancingSpi()) { spis.add(spi); if (!dfltLoadBalancingSpi && spi instanceof RoundRobinLoadBalancingSpi) dfltLoadBalancingSpi = true; } // Add default load balancing SPI for internal tasks. if (!dfltLoadBalancingSpi) spis.add(new RoundRobinLoadBalancingSpi()); cfg.setLoadBalancingSpi(spis.toArray(new LoadBalancingSpi[spis.size()])); } if (cfg.getIndexingSpi() == null) cfg.setIndexingSpi(new NoopIndexingSpi()); if (cfg.getEncryptionSpi() == null) cfg.setEncryptionSpi(new NoopEncryptionSpi()); if (F.isEmpty(cfg.getMetricExporterSpi())) cfg.setMetricExporterSpi(new NoopMetricExporterSpi()); if (F.isEmpty(cfg.getSystemViewExporterSpi())) { if (IgniteComponentType.INDEXING.inClassPath()) { try { cfg.setSystemViewExporterSpi(new JmxSystemViewExporterSpi(), U.newInstance(SYSTEM_VIEW_SQL_SPI)); } catch (IgniteCheckedException e) { throw new IgniteException(e); } } else cfg.setSystemViewExporterSpi(new JmxSystemViewExporterSpi()); } }
Example 12
Source File: CacheCheckpointSpiSecondCacheSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration cacheCfg1 = defaultCacheConfiguration(); cacheCfg1.setName(DEFAULT_CACHE_NAME); cacheCfg1.setCacheMode(REPLICATED); cacheCfg1.setWriteSynchronizationMode(FULL_SYNC); CacheConfiguration cacheCfg2 = defaultCacheConfiguration(); cacheCfg2.setName(CP_CACHE); cacheCfg2.setCacheMode(REPLICATED); cacheCfg2.setWriteSynchronizationMode(FULL_SYNC); cfg.setCacheConfiguration(cacheCfg1, cacheCfg2); CacheCheckpointSpi cp = new CacheCheckpointSpi(); cp.setCacheName(CP_CACHE); cfg.setCheckpointSpi(cp); return cfg; }
Example 13
Source File: ComputeLeaveAwareNodeStartup.java From gridgain-advanced-examples with Apache License 2.0 | 4 votes |
/** * Executes example. * * @param args Command line arguments, none required. */ public static void main(String[] args) { IgniteConfiguration cfg = new IgniteConfiguration(); HashMap<String, Object> attrs = new HashMap<>(); attrs.put("checkpoint_key", "slave_node"); cfg.setUserAttributes(attrs); TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(); ipFinder.setAddresses(Arrays.asList("127.0.0.1:47500..47509")); cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(ipFinder)); // Configuring checkpoints spi. CacheCheckpointSpi checkpointSpi = new CacheCheckpointSpi(); checkpointSpi.setCacheName("checkpoints"); // Overriding default checkpoints SPI cfg.setCheckpointSpi(checkpointSpi); Ignition.start(cfg); }
Example 14
Source File: GridSessionCheckpointSelfTest.java From ignite with Apache License 2.0 | 3 votes |
/** * @throws Exception If failed. */ @Test public void testCacheCheckpoint() throws Exception { IgniteConfiguration cfg = getConfiguration(); String cacheName = "test-checkpoints"; CacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setName(cacheName); CacheCheckpointSpi spi = new CacheCheckpointSpi(); spi.setCacheName(cacheName); cfg.setCacheConfiguration(cacheCfg); cfg.setCheckpointSpi(spi); if (cfg.getMarshaller() instanceof BinaryMarshaller) { BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), cfg, new NullLogger()); Marshaller marsh = cfg.getMarshaller(); marsh.setContext(new MarshallerContextTestImpl(null)); IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, cfg); } GridSessionCheckpointSelfTest.spi = spi; checkCheckpoints(cfg); }
Example 15
Source File: ComputeFailoverNodeStartup.java From ignite with Apache License 2.0 | 3 votes |
/** * Create Ignite configuration with configured checkpoints. * * @return Ignite configuration. * @throws IgniteException If configuration creation failed. */ public static IgniteConfiguration configuration() throws IgniteException { IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setLocalHost("127.0.0.1"); cfg.setPeerClassLoadingEnabled(true); // Configure checkpoint SPI. SharedFsCheckpointSpi checkpointSpi = new SharedFsCheckpointSpi(); checkpointSpi.setDirectoryPaths(Collections.singletonList("work/checkpoint/sharedfs")); cfg.setCheckpointSpi(checkpointSpi); // Configure discovery SPI. TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(); ipFinder.setAddresses(Arrays.asList("127.0.0.1:47500..47509")); discoSpi.setIpFinder(ipFinder); cfg.setDiscoverySpi(discoSpi); return cfg; }