use of org.apache.ignite.configuration.DataRegionConfiguration in project ignite by apache.
the class SqlUserCommandSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
if (getTestIgniteInstanceIndex(igniteInstanceName) == CLI_NODE)
cfg.setClientMode(true);
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(spi);
cfg.setAuthenticationEnabled(true);
cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true)));
return cfg;
}
use of org.apache.ignite.configuration.DataRegionConfiguration in project ignite by apache.
the class IgniteCacheDistributedPartitionQueryAbstractSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(20 * 1024 * 1024));
cfg.setDataStorageConfiguration(memCfg);
TcpDiscoverySpi spi = (TcpDiscoverySpi) cfg.getDiscoverySpi();
spi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(spi);
/**
* Clients cache
*/
CacheConfiguration<ClientKey, Client> clientCfg = new CacheConfiguration<>();
clientCfg.setName("cl");
clientCfg.setWriteSynchronizationMode(FULL_SYNC);
clientCfg.setAtomicityMode(TRANSACTIONAL);
clientCfg.setRebalanceMode(SYNC);
clientCfg.setBackups(2);
clientCfg.setAffinity(AFFINITY);
clientCfg.setIndexedTypes(ClientKey.class, Client.class);
/**
* Deposits cache
*/
CacheConfiguration<DepositKey, Deposit> depoCfg = new CacheConfiguration<>();
depoCfg.setName("de");
depoCfg.setWriteSynchronizationMode(FULL_SYNC);
depoCfg.setAtomicityMode(TRANSACTIONAL);
depoCfg.setRebalanceMode(SYNC);
depoCfg.setBackups(2);
depoCfg.setAffinity(AFFINITY);
depoCfg.setIndexedTypes(DepositKey.class, Deposit.class);
/**
* Regions cache. Uses default affinity.
*/
CacheConfiguration<Integer, Region> regionCfg = new CacheConfiguration<>();
regionCfg.setName("re");
regionCfg.setWriteSynchronizationMode(FULL_SYNC);
regionCfg.setAtomicityMode(TRANSACTIONAL);
regionCfg.setRebalanceMode(SYNC);
regionCfg.setCacheMode(CacheMode.REPLICATED);
regionCfg.setIndexedTypes(Integer.class, Region.class);
cfg.setCacheConfiguration(clientCfg, depoCfg, regionCfg);
if ("client".equals(gridName))
cfg.setClientMode(true);
else {
Integer reg = regionForGrid(gridName);
cfg.setUserAttributes(F.asMap(REGION_ATTR_NAME, reg));
log().info("Assigned region " + reg + " to grid " + gridName);
}
return cfg;
}
use of org.apache.ignite.configuration.DataRegionConfiguration in project ignite by apache.
the class IgniteCacheQueryNodeRestartSelfTest2 method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(50 * 1024 * 1024));
c.setDataStorageConfiguration(memCfg);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
c.setDiscoverySpi(disco);
int i = 0;
CacheConfiguration<?, ?>[] ccs = new CacheConfiguration[4];
for (String name : F.asList("pe", "pu")) {
CacheConfiguration<?, ?> cc = defaultCacheConfiguration();
cc.setName(name);
cc.setCacheMode(PARTITIONED);
cc.setBackups(2);
cc.setWriteSynchronizationMode(FULL_SYNC);
cc.setAtomicityMode(TRANSACTIONAL);
cc.setRebalanceMode(SYNC);
cc.setAffinity(new RendezvousAffinityFunction(false, 60));
if (name.equals("pe")) {
cc.setIndexedTypes(Integer.class, Person.class);
} else if (name.equals("pu")) {
cc.setIndexedTypes(AffinityKey.class, Purchase.class);
}
ccs[i++] = cc;
}
for (String name : F.asList("co", "pr")) {
CacheConfiguration<?, ?> cc = defaultCacheConfiguration();
cc.setName(name);
cc.setCacheMode(REPLICATED);
cc.setWriteSynchronizationMode(FULL_SYNC);
cc.setAtomicityMode(TRANSACTIONAL);
cc.setRebalanceMode(SYNC);
cc.setAffinity(new RendezvousAffinityFunction(false, 50));
if (name.equals("co")) {
cc.setIndexedTypes(Integer.class, Company.class);
} else if (name.equals("pr")) {
cc.setIndexedTypes(Integer.class, Product.class);
}
ccs[i++] = cc;
}
c.setCacheConfiguration(ccs);
return c;
}
use of org.apache.ignite.configuration.DataRegionConfiguration in project ignite by apache.
the class H2DynamicTableSelfTest method commonConfiguration.
/**
* Create common node configuration.
*
* @param idx Index.
* @return Configuration.
* @throws Exception If failed.
*/
private IgniteConfiguration commonConfiguration(int idx) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(getTestIgniteInstanceName(idx));
DataRegionConfiguration dataRegionCfg = new DataRegionConfiguration().setName(DATA_REGION_NAME);
cfg.setMarshaller(new BinaryMarshaller());
cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDataRegionConfigurations(dataRegionCfg));
return optimize(cfg);
}
use of org.apache.ignite.configuration.DataRegionConfiguration in project ignite by apache.
the class IgniteDbSingleNodeWithIndexingWalRestoreTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
BinaryConfiguration binCfg = new BinaryConfiguration();
binCfg.setCompactFooter(true);
cfg.setBinaryConfiguration(binCfg);
CacheConfiguration indexedCacheCfg = new CacheConfiguration();
indexedCacheCfg.setName("indexedCache");
List<QueryEntity> qryEntities = new ArrayList<>();
{
QueryEntity qryEntity = new QueryEntity();
qryEntity.setKeyType(Integer.class.getName());
qryEntity.setValueType(BINARY_TYPE_NAME);
LinkedHashMap<String, String> fields = new LinkedHashMap<>();
fields.put(BINARY_TYPE_FIELD_NAME, String.class.getName());
qryEntity.setFields(fields);
qryEntity.setIndexes(F.asList(new QueryIndex(BINARY_TYPE_FIELD_NAME)));
qryEntities.add(qryEntity);
}
{
QueryEntity qryEntity = new QueryEntity();
qryEntity.setKeyType(Integer.class.getName());
qryEntity.setValueType(RegularPerson.class.getName());
LinkedHashMap<String, String> fields = new LinkedHashMap<>();
fields.put("regName", String.class.getName());
qryEntity.setFields(fields);
qryEntity.setIndexes(F.asList(new QueryIndex("regName")));
qryEntities.add(qryEntity);
}
indexedCacheCfg.setQueryEntities(qryEntities);
cfg.setCacheConfiguration(indexedCacheCfg);
DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true)).setWalMode(WALMode.LOG_ONLY);
cfg.setDataStorageConfiguration(memCfg);
cfg.setConsistentId(gridName);
return cfg;
}
Aggregations