use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class HadoopFIleSystemFactorySelfTest method start.
/**
* Start Ignite node with IGFS instance.
*
* @param name Node and IGFS name.
* @param endpointPort Endpoint port.
* @param dfltMode Default path mode.
* @param secondaryFs Secondary file system.
* @return Igfs instance.
*/
private static IgfsEx start(String name, int endpointPort, IgfsMode dfltMode, @Nullable IgfsSecondaryFileSystem secondaryFs) {
IgfsIpcEndpointConfiguration endpointCfg = new IgfsIpcEndpointConfiguration();
endpointCfg.setType(IgfsIpcEndpointType.TCP);
endpointCfg.setHost("127.0.0.1");
endpointCfg.setPort(endpointPort);
FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
igfsCfg.setName(name);
igfsCfg.setDefaultMode(dfltMode);
igfsCfg.setIpcEndpointConfiguration(endpointCfg);
igfsCfg.setSecondaryFileSystem(secondaryFs);
CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
dataCacheCfg.setCacheMode(PARTITIONED);
dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(2));
dataCacheCfg.setBackups(0);
dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
CacheConfiguration metaCacheCfg = defaultCacheConfiguration();
metaCacheCfg.setCacheMode(REPLICATED);
metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
igfsCfg.setDataCacheConfiguration(dataCacheCfg);
igfsCfg.setMetaCacheConfiguration(metaCacheCfg);
if (secondaryFs != null) {
Map<String, IgfsMode> modes = new HashMap<>();
modes.put("/ignite/sync/", IgfsMode.DUAL_SYNC);
modes.put("/ignite/async/", IgfsMode.DUAL_ASYNC);
modes.put("/ignite/proxy/", IgfsMode.PROXY);
igfsCfg.setPathModes(modes);
}
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setIgniteInstanceName(name);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
cfg.setDiscoverySpi(discoSpi);
cfg.setFileSystemConfiguration(igfsCfg);
cfg.setLocalHost("127.0.0.1");
cfg.setConnectorConfiguration(null);
return (IgfsEx) G.start(cfg).fileSystem(name);
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class PlatformConfigurationUtils method readDiscoveryConfiguration.
/**
* Reads discovery configuration from a stream and updates provided IgniteConfiguration.
*
* @param cfg IgniteConfiguration to update.
* @param in Reader.
*/
private static void readDiscoveryConfiguration(BinaryRawReader in, IgniteConfiguration cfg) {
boolean hasCfg = in.readBoolean();
if (!hasCfg)
return;
TcpDiscoverySpi disco = new TcpDiscoverySpi();
boolean hasIpFinder = in.readBoolean();
if (hasIpFinder) {
byte ipFinderType = in.readByte();
int addrCnt = in.readInt();
ArrayList<String> addrs = null;
if (addrCnt > 0) {
addrs = new ArrayList<>(addrCnt);
for (int i = 0; i < addrCnt; i++) addrs.add(in.readString());
}
TcpDiscoveryVmIpFinder finder = null;
if (ipFinderType == 1)
finder = new TcpDiscoveryVmIpFinder();
else if (ipFinderType == 2) {
TcpDiscoveryMulticastIpFinder finder0 = new TcpDiscoveryMulticastIpFinder();
finder0.setLocalAddress(in.readString());
finder0.setMulticastGroup(in.readString());
finder0.setMulticastPort(in.readInt());
finder0.setAddressRequestAttempts(in.readInt());
finder0.setResponseWaitTime(in.readInt());
boolean hasTtl = in.readBoolean();
if (hasTtl)
finder0.setTimeToLive(in.readInt());
finder = finder0;
} else
assert false;
finder.setAddresses(addrs);
disco.setIpFinder(finder);
}
disco.setSocketTimeout(in.readLong());
disco.setAckTimeout(in.readLong());
disco.setMaxAckTimeout(in.readLong());
disco.setNetworkTimeout(in.readLong());
disco.setJoinTimeout(in.readLong());
disco.setForceServerMode(in.readBoolean());
disco.setClientReconnectDisabled(in.readBoolean());
disco.setLocalAddress(in.readString());
disco.setReconnectCount(in.readInt());
disco.setLocalPort(in.readInt());
disco.setLocalPortRange(in.readInt());
disco.setStatisticsPrintFrequency(in.readLong());
disco.setIpFinderCleanFrequency(in.readLong());
disco.setThreadPriority(in.readInt());
disco.setTopHistorySize(in.readInt());
cfg.setDiscoverySpi(disco);
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class GridCacheWriteBehindStoreLoadTest method getConfiguration.
/**
* {@inheritDoc}
*/
@SuppressWarnings({ "unchecked" })
@Override
protected final IgniteConfiguration getConfiguration() throws Exception {
IgniteConfiguration c = super.getConfiguration();
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));
c.setDiscoverySpi(disco);
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(cacheMode());
cc.setWriteSynchronizationMode(FULL_SYNC);
cc.setCacheStoreFactory(singletonFactory(store));
cc.setReadThrough(true);
cc.setWriteThrough(true);
cc.setLoadPreviousValue(true);
cc.setWriteBehindEnabled(true);
cc.setWriteBehindFlushFrequency(WRITE_FROM_BEHIND_FLUSH_FREQUENCY);
c.setCacheConfiguration(cc);
return c;
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class GridSessionCancelSiblingsFromTaskSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
c.setDiscoverySpi(discoSpi);
c.setPublicThreadPoolSize(SPLIT_COUNT * EXEC_COUNT);
return c;
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class GridSessionWaitAttributeSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
c.setDiscoverySpi(discoSpi);
c.setPublicThreadPoolSize(JOB_NUM * 2);
return c;
}
Aggregations