use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class GridCacheNearReaderPreloadSelfTest method startUp.
/**
* Startup routine.
*
* @throws Exception If failed.
*/
private void startUp() throws Exception {
TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
Ignite node1 = G.start(dataNode(ipFinder, "node1"));
Ignite node2 = G.start(dataNode(ipFinder, "node2"));
Ignite node3 = G.start(dataNode(ipFinder, "node3"));
info("Node 1: " + node1.cluster().localNode().id());
info("Node 2: " + node2.cluster().localNode().id());
info("Node 3: " + node3.cluster().localNode().id());
cache1 = node1.cache(CACHE_NAME);
cache2 = node2.cache(CACHE_NAME);
cache3 = node3.cache(CACHE_NAME);
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class IgfsBlockMessageSystemPoolStarvationSelfTest method beforeTest.
/**
* {@inheritDoc}
*/
@SuppressWarnings({ "unchecked", "ConstantConditions" })
@Override
protected void beforeTest() throws Exception {
super.beforeTest();
// Start nodes.
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
victim = Ignition.start(config(NODE_1_NAME, ipFinder));
attacker = Ignition.start(config(NODE_2_NAME, ipFinder));
// Check if we selected victim correctly.
if (F.eq(dataCache(victim).affinity().mapKeyToNode(DATA_KEY).id(), attacker.cluster().localNode().id())) {
Ignite tmp = victim;
victim = attacker;
attacker = tmp;
}
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class IgfsCachePerBlockLruEvictionPolicySelfTest method startSecondary.
/**
* Start a grid with the secondary file system.
*
* @throws Exception If failed.
*/
private void startSecondary() throws Exception {
FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
igfsCfg.setName(IGFS_SECONDARY);
igfsCfg.setBlockSize(512);
igfsCfg.setDefaultMode(PRIMARY);
igfsCfg.setIpcEndpointConfiguration(SECONDARY_REST_CFG);
CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
dataCacheCfg.setCacheMode(PARTITIONED);
dataCacheCfg.setNearConfiguration(null);
dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
dataCacheCfg.setBackups(0);
dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
CacheConfiguration metaCacheCfg = defaultCacheConfiguration();
metaCacheCfg.setCacheMode(REPLICATED);
metaCacheCfg.setNearConfiguration(null);
metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
igfsCfg.setMetaCacheConfiguration(metaCacheCfg);
igfsCfg.setDataCacheConfiguration(dataCacheCfg);
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setIgniteInstanceName("grid-secondary");
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
cfg.setDiscoverySpi(discoSpi);
cfg.setFileSystemConfiguration(igfsCfg);
cfg.setLocalHost("127.0.0.1");
cfg.setConnectorConfiguration(null);
Ignite g = G.start(cfg);
secondaryFs = (IgfsImpl) g.fileSystem(IGFS_SECONDARY);
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class IgfsCachePerBlockLruEvictionPolicySelfTest method startPrimary.
/**
* Start a grid with the primary file system.
*
* @throws Exception If failed.
*/
private void startPrimary() throws Exception {
FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
igfsCfg.setName(IGFS_PRIMARY);
igfsCfg.setBlockSize(512);
igfsCfg.setDefaultMode(DUAL_SYNC);
igfsCfg.setPrefetchBlocks(1);
igfsCfg.setSequentialReadsBeforePrefetch(Integer.MAX_VALUE);
igfsCfg.setSecondaryFileSystem(secondaryFs.asSecondary());
Map<String, IgfsMode> pathModes = new HashMap<>();
pathModes.put(FILE.toString(), PRIMARY);
igfsCfg.setPathModes(pathModes);
CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
dataCacheCfg.setCacheMode(PARTITIONED);
dataCacheCfg.setNearConfiguration(null);
dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
evictPlc = new IgfsPerBlockLruEvictionPolicy();
dataCacheCfg.setEvictionPolicy(evictPlc);
dataCacheCfg.setOnheapCacheEnabled(true);
dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
dataCacheCfg.setBackups(0);
CacheConfiguration metaCacheCfg = defaultCacheConfiguration();
metaCacheCfg.setCacheMode(REPLICATED);
metaCacheCfg.setNearConfiguration(null);
metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
igfsCfg.setMetaCacheConfiguration(metaCacheCfg);
igfsCfg.setDataCacheConfiguration(dataCacheCfg);
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setIgniteInstanceName("grid-primary");
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
cfg.setDiscoverySpi(discoSpi);
cfg.setFileSystemConfiguration(igfsCfg);
cfg.setLocalHost("127.0.0.1");
cfg.setConnectorConfiguration(null);
Ignite g = G.start(cfg);
igfsPrimary = (IgfsImpl) g.fileSystem(IGFS_PRIMARY);
dataCache = igfsPrimary.context().kernalContext().cache().internalCache(igfsPrimary.context().configuration().getDataCacheConfiguration().getName());
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class IgfsModesSelfTest method startUp.
/**
* Perform initial startup.
*
* @throws Exception If failed.
*/
@SuppressWarnings("NullableProblems")
private void startUp() throws Exception {
startUpSecondary();
FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
igfsCfg.setName("igfs");
igfsCfg.setBlockSize(512 * 1024);
if (setNullMode)
igfsCfg.setDefaultMode(null);
else if (mode != null)
igfsCfg.setDefaultMode(mode);
igfsCfg.setPathModes(pathModes);
if (setSecondaryFs)
igfsCfg.setSecondaryFileSystem(igfsSecondary.asSecondary());
CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
dataCacheCfg.setCacheMode(PARTITIONED);
dataCacheCfg.setNearConfiguration(null);
dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
dataCacheCfg.setBackups(0);
dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
CacheConfiguration metaCacheCfg = defaultCacheConfiguration();
metaCacheCfg.setCacheMode(REPLICATED);
metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
igfsCfg.setMetaCacheConfiguration(metaCacheCfg);
igfsCfg.setDataCacheConfiguration(dataCacheCfg);
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setIgniteInstanceName("igfs-grid");
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
cfg.setDiscoverySpi(discoSpi);
cfg.setFileSystemConfiguration(igfsCfg);
cfg.setLocalHost("127.0.0.1");
cfg.setConnectorConfiguration(null);
grid = (IgniteEx) G.start(cfg);
igfs = (IgfsImpl) grid.fileSystem("igfs");
}
Aggregations