本文整理汇总了Java中org.apache.ignite.configuration.IgniteConfiguration.setGridName方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteConfiguration.setGridName方法的具体用法?Java IgniteConfiguration.setGridName怎么用?Java IgniteConfiguration.setGridName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.IgniteConfiguration
的用法示例。
在下文中一共展示了IgniteConfiguration.setGridName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testManualHBaseInsertion
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
@Test
public void testManualHBaseInsertion() throws ServiceException, IOException {
IgniteConfiguration cfg = prepareConfig(false);
IgniteConfiguration cfg2 = new IgniteConfiguration(cfg);
cfg.setGridName("first");
cfg2.setGridName("second");
String cacheName = "myCache";
try (Ignite ignite = Ignition.getOrStart(cfg); Ignite ignite2 = Ignition.getOrStart(cfg2)) {
IgniteCache<String, String> cache = ignite.getOrCreateCache(cacheName);
cache.remove("Hello");
assertNull(cache.get("Hello"));
try (Connection conn = getHBaseConnection()) {
TableName tableName = TableName.valueOf(TABLE_NAME);
Table table = conn.getTable(tableName);
Serializer<Object> serializer = ObjectSerializer.INSTANCE;
Put put = new Put(serializer.serialize("Hello"));
put.addColumn(cacheName.getBytes(), QUALIFIER, serializer.serialize("World"));
table.put(put);
}
assertEquals("World", cache.get("Hello"));
}
}
示例2: getDefaultIgniteConfig
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
private IgniteConfiguration getDefaultIgniteConfig(IgniteResource gridResource) {
IgniteConfiguration igniteConfiguration = new IgniteConfiguration();
igniteConfiguration.setGridName(getGridName(gridResource));
igniteConfiguration.setClientMode(getClientMode(gridResource));
igniteConfiguration.setPeerClassLoadingEnabled(getPeerClassLoadingEnabled(gridResource));
TcpDiscoverySpi tcpDiscoverySpi = new TcpDiscoverySpi();
TcpDiscoveryMulticastIpFinder ipFinder = new TcpDiscoveryMulticastIpFinder();
ipFinder.setAddresses(Collections.singletonList(getIpDiscoveryRange(gridResource)));
tcpDiscoverySpi.setIpFinder(ipFinder);
tcpDiscoverySpi.setLocalAddress(getLocalAddress(gridResource));
igniteConfiguration.setDiscoverySpi(tcpDiscoverySpi);
TcpCommunicationSpi communicationSpi = new TcpCommunicationSpi();
communicationSpi.setLocalAddress(props.getLocalAddress());
igniteConfiguration.setCommunicationSpi(communicationSpi);
return igniteConfiguration;
}
示例3: setUp
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
@Before
public void setUp() {
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(Collections.singletonList(HOST));
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(ipFinder);
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setDiscoverySpi(discoSpi);
cfg.setGridName("test");
ignite = Ignition.start(cfg);
Properties props = new Properties();
props.setProperty(IgniteSqlInterpreter.IGNITE_JDBC_URL, "jdbc:ignite:cfg://[email protected]");
props.setProperty(IgniteInterpreter.IGNITE_CLIENT_MODE, "false");
props.setProperty(IgniteInterpreter.IGNITE_PEER_CLASS_LOADING_ENABLED, "false");
intp = new IgniteInterpreter(props);
intp.open();
}
示例4: setUp
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
@Before
public void setUp() {
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(Collections.singletonList(HOST));
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(ipFinder);
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setDiscoverySpi(discoSpi);
cfg.setGridName("test");
ignite = Ignition.start(cfg);
Properties props = new Properties();
props.setProperty(IgniteSqlInterpreter.IGNITE_JDBC_URL, "jdbc:ignite:cfg://[email protected]");
props.setProperty(IgniteInterpreter.IGNITE_CLIENT_MODE, "false");
props.setProperty(IgniteInterpreter.IGNITE_PEER_CLASS_LOADING_ENABLED, "false");
props.setProperty(IgniteInterpreter.IGNITE_ADDRESSES, HOST);
intp = new IgniteInterpreter(props);
intp.open();
}
示例5: getIgniteConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
public static IgniteConfiguration getIgniteConfiguration(String gridName, boolean clientMode) {
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(Collections.singletonList("127.0.0.1:47500..47509"));
TcpDiscoverySpi tcpDiscoverySpi = new TcpDiscoverySpi();
tcpDiscoverySpi.setIpFinder(ipFinder);
IgniteConfiguration configuration = new IgniteConfiguration();
configuration.setDiscoverySpi(tcpDiscoverySpi);
configuration.setGridName(gridName);
configuration.setClientMode(clientMode);
return configuration;
}
示例6: startCluster
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public Ignite startCluster(int nodes, IgniteConfiguration igniteConfiguration) {
IgniteConfiguration configuration = new IgniteConfiguration(igniteConfiguration);
configuration.setGridName("root");
setNumberProcesses(configuration, nodes);
root = Ignition.start(configuration);
throw new UnsupportedOperationException();
// for (int i = 1; i < nodes; i++) {
// igniteProcesses.add(startServerProcess(nodes));
// }
// waitTillClusterStart(nodes);
// return root;
}
示例7: startGrid
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected Ignite startGrid(IgniteConfiguration igniteConfiguration, int gridNumber) {
IgniteConfiguration configuration = new IgniteConfiguration(igniteConfiguration);
configuration.setGridName("node-" + gridNumber);
setNumberProcesses(configuration, 1);
return Ignition.start(configuration);
}
示例8: setNumberProcesses
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Configures discovery options based by number of used grid instances.
*
* @param configuration base configuration.
* @param gridNumber number of started grid.
* @param clusterSize expected size of started cluster.
*/
public static void setNumberProcesses(IgniteConfiguration configuration, int gridNumber, int clusterSize) {
TcpDiscoveryVmIpFinder finder = new TcpDiscoveryVmIpFinder();
List<InetSocketAddress> addresses = new ArrayList<>(clusterSize);
for (int i = 0; i < clusterSize; i++) {
addresses.add(InetSocketAddress.createUnresolved(LOCALHOST, BASE_PORT + i));
}
finder.registerAddresses(addresses);
TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
discoverySpi.setIpFinder(finder);
configuration.setDiscoverySpi(discoverySpi);
configuration.setGridName(GRID_NAME + gridNumber);
}
示例9: testDelete
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
@Test
public void testDelete() {
IgniteConfiguration cfg = prepareConfig();
IgniteConfiguration cfg2 = new IgniteConfiguration(cfg);
cfg.setGridName("first");
cfg2.setGridName("second");
try (Ignite ignite = Ignition.getOrStart(cfg); Ignite ignite2 = Ignition.getOrStart(cfg2)) {
IgniteCache<String, String> cache = ignite.getOrCreateCache("myCache");
cache.put("Hello", "World");
cache.put("Hello", "World");
assertEquals("World", cache.get("Hello"));
cache.remove("Hello");
assertNull(cache.get("Hello"));
}
}
示例10: testTableAndColumnFamilyCreation
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
@Test
public void testTableAndColumnFamilyCreation() throws IOException, ServiceException {
try (Connection conn = getHBaseConnection()) {
Admin admin = conn.getAdmin();
TableName tableName = TableName.valueOf(TABLE_NAME);
deleteTable(admin, tableName);
assertFalse(admin.tableExists(tableName));
IgniteConfiguration cfg = prepareConfig();
IgniteConfiguration cfg2 = new IgniteConfiguration(cfg);
cfg.setGridName("first");
cfg2.setGridName("second");
try (Ignite ignite = Ignition.getOrStart(cfg); Ignite ignite2 = Ignition
.getOrStart(cfg2)) {
String cacheName = "myCache";
String otherCacheName = "myOtherCache";
IgniteCache<String, String> cache = ignite.getOrCreateCache(cacheName);
IgniteCache<String, String> otherCache = ignite.getOrCreateCache(otherCacheName);
assertFalse(admin.tableExists(tableName));
cache.put("Hello", "World");
assertTrue(admin.tableExists(tableName));
assertTrue(admin.getTableDescriptor(tableName).hasFamily(cacheName.getBytes()));
assertFalse(
admin.getTableDescriptor(tableName).hasFamily(otherCacheName.getBytes()));
otherCache.put("Hello", "World");
assertTrue(admin.tableExists(tableName));
assertTrue(
admin.getTableDescriptor(tableName).hasFamily(otherCacheName.getBytes()));
}
}
}
示例11: testTableNameNotNull
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
@Test(expected = CacheException.class)
public void testTableNameNotNull() {
HBaseCacheStoreSessionListener cssl = new HBaseCacheStoreSessionListener(null);
applyHBaseConfiguration(cssl);
IgniteConfiguration cfg = prepareConfig(cssl);
IgniteConfiguration cfg2 = new IgniteConfiguration(cfg);
cfg.setGridName("first");
cfg2.setGridName("second");
try (Ignite ignite = Ignition.getOrStart(cfg); Ignite ignite2 = Ignition.getOrStart(cfg2)) {
IgniteCache<String, String> cache = ignite.getOrCreateCache("myCache");
cache.put("Hello", "World");
}
}
示例12: startDownloadIgnite
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
public static Ignite startDownloadIgnite (Map<String,String> group_attrs,String cachename,String gridName) {
CacheConfiguration cacheCfg = new CacheConfiguration (cachename);
cacheCfg.setCacheMode (CacheMode.PARTITIONED);
IgniteConfiguration cfg = new IgniteConfiguration ();
cfg.setCacheConfiguration (cacheCfg);
cfg.setUserAttributes (group_attrs);
cfg.setPeerClassLoadingEnabled (true);
cfg.setGridName(gridName);
Ignite ignite = Ignition.start (cfg);
// Collection<UUID> node_ids = new ArrayList<> ();
//
// ClusterGroup cg = ignite.cluster ().forRemotes ();
// Collection<ClusterNode> clusterNodes = cg.nodes ();
// for (ClusterNode e : clusterNodes) {
// node_ids.add (e.id ());
// }
// String url = "https://ws1.sinaimg.cn/large/006tNc79ly1fn4o49dqcaj30sg0sgmzo.jpg
// ";
return ignite;
}
示例13: getDefaultConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Default Ignite configuration without the {#TcpDiscoveryRedisIpFinder}.
*
* @param gridName Grid name.
* @return Ignite configuration
* @throws Exception If failed.
*/
protected IgniteConfiguration getDefaultConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setGridName(gridName);
cfg.setLocalHost("127.0.0.1");
cfg.setGridLogger(new Slf4jLogger());
cfg.setNetworkTimeout(10000);
return cfg;
}
示例14: setUp
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
@Before
public void setUp() {
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(Collections.singletonList(HOST));
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(ipFinder);
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setDiscoverySpi(discoSpi);
cfg.setPeerClassLoadingEnabled(true);
cfg.setMarshaller(new OptimizedMarshaller());
cfg.setGridName("test");
ignite = Ignition.start(cfg);
Properties props = new Properties();
props.setProperty(IgniteSqlInterpreter.IGNITE_JDBC_URL, "jdbc:ignite:cfg://[email protected]");
intp = new IgniteSqlInterpreter(props);
CacheConfiguration<Integer, Person> cacheConf = new CacheConfiguration<>();
cacheConf.setIndexedTypes(Integer.class, Person.class);
cacheConf.setName("person");
IgniteCache<Integer, Person> cache = ignite.createCache(cacheConf);
cache.put(1, new Person("sun", 100));
cache.put(2, new Person("moon", 50));
assertEquals("moon", cache.get(2).getName());
intp.open();
}
示例15: buildComponent
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
protected IgniteComponent buildComponent() {
IgniteConfiguration config = new IgniteConfiguration();
config.setGridName(UUID.randomUUID().toString());
config.setIncludeEventTypes(EventType.EVT_JOB_FINISHED, EventType.EVT_JOB_RESULTED);
config.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(LOCAL_IP_FINDER));
return IgniteComponent.fromConfiguration(config);
}