use of org.apache.ignite.configuration.IgniteConfiguration in project ignite by apache.
the class IgniteSqlSegmentedIndexSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
CacheKeyConfiguration keyCfg = new CacheKeyConfiguration("MyCache", "affKey");
cfg.setCacheKeyConfiguration(keyCfg);
cfg.setPeerClassLoadingEnabled(false);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
return cfg;
}
use of org.apache.ignite.configuration.IgniteConfiguration in project ignite by apache.
the class CacheQueryJsr310Java8DateTimeApiBaseTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi discoverySpi = (TcpDiscoverySpi) cfg.getDiscoverySpi();
discoverySpi.setIpFinder(IP_FINDER);
return cfg;
}
use of org.apache.ignite.configuration.IgniteConfiguration in project ignite by apache.
the class AgentClusterDemo method tryStart.
/**
* Start ignite node with cacheEmployee and populate it with data.
*/
public static CountDownLatch tryStart() {
if (initGuard.compareAndSet(false, true)) {
log.info("DEMO: Starting embedded nodes for demo...");
System.setProperty(IGNITE_NO_ASCII, "true");
System.setProperty(IGNITE_QUIET, "false");
System.setProperty(IGNITE_UPDATE_NOTIFIER, "false");
System.setProperty(IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE, "20");
System.setProperty(IGNITE_PERFORMANCE_SUGGESTIONS_DISABLED, "true");
final AtomicInteger basePort = new AtomicInteger(60700);
final AtomicInteger cnt = new AtomicInteger(-1);
final ScheduledExecutorService execSrv = newScheduledThreadPool(1, "demo-nodes-start");
execSrv.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
int idx = cnt.incrementAndGet();
int port = basePort.get();
boolean first = idx == 0;
try {
IgniteConfiguration cfg = igniteConfiguration(port, idx, false);
if (first) {
U.delete(Paths.get(cfg.getWorkDirectory()));
U.resolveWorkDirectory(cfg.getWorkDirectory(), cfg.getDataStorageConfiguration().getStoragePath(), true);
}
Ignite ignite = Ignition.start(cfg);
if (first) {
ClusterNode node = ignite.cluster().localNode();
Collection<String> jettyAddrs = node.attribute(ATTR_REST_JETTY_ADDRS);
if (jettyAddrs == null) {
Ignition.stopAll(true);
throw new IgniteException("DEMO: Failed to start Jetty REST server on embedded node");
}
String jettyHost = jettyAddrs.iterator().next();
Integer jettyPort = node.attribute(ATTR_REST_JETTY_PORT);
if (F.isEmpty(jettyHost) || jettyPort == null)
throw new IgniteException("DEMO: Failed to start Jetty REST handler on embedded node");
log.info("DEMO: Started embedded node for demo purpose [TCP binary port={}, Jetty REST port={}]", port, jettyPort);
demoUrl = String.format("http://%s:%d", jettyHost, jettyPort);
initLatch.countDown();
}
} catch (Throwable e) {
if (first) {
basePort.getAndAdd(50);
log.warn("DEMO: Failed to start embedded node.", e);
} else
log.error("DEMO: Failed to start embedded node.", e);
} finally {
if (idx == NODE_CNT) {
Ignite ignite = Ignition.ignite(SRV_NODE_NAME + 0);
if (ignite != null) {
ignite.cluster().active(true);
deployServices(ignite.services(ignite.cluster().forServers()));
}
log.info("DEMO: All embedded nodes for demo successfully started");
execSrv.shutdown();
}
}
}
}, 1, 5, TimeUnit.SECONDS);
}
return initLatch;
}
use of org.apache.ignite.configuration.IgniteConfiguration in project ignite by apache.
the class GridIndexingSpiAbstractSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
cfg.setMarshaller(new BinaryMarshaller());
return cfg;
}
use of org.apache.ignite.configuration.IgniteConfiguration in project ignite by apache.
the class IgfsSizeSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
igfsCfg.setName(IGFS_NAME);
igfsCfg.setBlockSize(BLOCK_SIZE);
igfsCfg.setFragmentizerEnabled(false);
igfsCfg.setManagementPort(++mgmtPort);
CacheConfiguration dataCfg = defaultCacheConfiguration();
dataCfg.setCacheMode(cacheMode);
if (cacheMode == PARTITIONED) {
if (nearEnabled)
dataCfg.setNearConfiguration(new NearCacheConfiguration());
dataCfg.setBackups(0);
}
dataCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
dataCfg.setRebalanceMode(SYNC);
dataCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
dataCfg.setAtomicityMode(TRANSACTIONAL);
CacheConfiguration metaCfg = defaultCacheConfiguration();
metaCfg.setCacheMode(REPLICATED);
metaCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
metaCfg.setRebalanceMode(SYNC);
metaCfg.setAtomicityMode(TRANSACTIONAL);
igfsCfg.setMetaCacheConfiguration(metaCfg);
igfsCfg.setDataCacheConfiguration(dataCfg);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(discoSpi);
cfg.setFileSystemConfiguration(igfsCfg);
if (memIgfsdDataPlcSetter != null)
memIgfsdDataPlcSetter.apply(cfg);
return cfg;
}
Aggregations