本文整理汇总了Java中org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder类的典型用法代码示例。如果您正苦于以下问题:Java TcpDiscoveryVmIpFinder类的具体用法?Java TcpDiscoveryVmIpFinder怎么用?Java TcpDiscoveryVmIpFinder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TcpDiscoveryVmIpFinder类属于org.apache.ignite.spi.discovery.tcp.ipfinder.vm包,在下文中一共展示了TcpDiscoveryVmIpFinder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; //导入依赖的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();
}
示例2: createIgnite
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; //导入依赖的package包/类
@Bean
@Scope("singleton")
@Qualifier("operationIgniteClient")
@ConditionalOnMissingBean(KafkaOperationRepository.class)
public Ignite createIgnite(ApplicationContext applicationContext) throws IgniteCheckedException {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setClientMode(true);
cfg.setPeerClassLoadingEnabled(false);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(Arrays.asList(clientAddress.split(",")));
discoSpi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(discoSpi);
cfg.setMetricsLogFrequency(0);
return IgniteSpring.start(cfg,applicationContext);
}
示例3: setUp
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; //导入依赖的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: baseConfiguration
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; //导入依赖的package包/类
/**
* Get base node configuration.
*
* @return Configuration.
* @throws Exception If failed.
*/
@SuppressWarnings("unchecked")
private IgniteConfiguration baseConfiguration() throws Exception {
final IgniteConfiguration cfg = super.getConfiguration();
cfg.setIgniteInstanceName(ClientConnectorConfigurationValidationSelfTest.class.getName() + "-" +
NODE_IDX_GEN.incrementAndGet());
cfg.setLocalHost("127.0.0.1");
cfg.setMarshaller(new BinaryMarshaller());
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
cfg.setDiscoverySpi(spi);
CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME)
.setIndexedTypes(ClientConnectorKey.class, ClientConnectorValue.class);
cfg.setCacheConfiguration(ccfg);
return cfg;
}
示例5: getConfiguration
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; //导入依赖的package包/类
/**
* Creates grid configuration.
*
* @param igniteInstanceName Ignite instance name.
* @param logPath Logger configuration path.
* @return Grid configuration.
* @throws Exception If error occurred.
*/
private static IgniteConfiguration getConfiguration(String igniteInstanceName, String logPath)
throws Exception {
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(new TcpDiscoveryVmIpFinder(false) {{
setAddresses(Collections.singleton("127.0.0.1:47500..47509"));
}});
File xml = GridTestUtils.resolveIgnitePath(LOG_PATH_VERBOSE_TEST);
Log4J2Logger logger = new Log4J2Logger(xml);
return new IgniteConfiguration()
.setIgniteInstanceName(igniteInstanceName)
.setGridLogger(logger)
.setConnectorConfiguration(null)
.setDiscoverySpi(disco);
}
示例6: testLocalPortRange
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; //导入依赖的package包/类
/**
* @throws Exception If failed.
*/
public void testLocalPortRange() throws Exception {
try {
IgniteConfiguration cfg = getConfiguration();
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
spi.setLocalPortRange(0);
cfg.setDiscoverySpi(spi);
startGrid(cfg.getIgniteInstanceName(), cfg);
}
finally {
stopAllGrids();
}
}
示例7: beforeTest
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; //导入依赖的package包/类
/** {@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;
}
}
示例8: getConfiguration
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration() throws Exception {
// Discovery config.
TcpDiscoverySpi disco = new TcpDiscoverySpi()
.setIpFinder(new TcpDiscoveryVmIpFinder(true))
.setJoinTimeout(5000);
// Cache config.
CacheConfiguration ccfg = new CacheConfiguration("cache*")
.setCacheMode(CacheMode.LOCAL)
.setAtomicityMode(CacheAtomicityMode.ATOMIC);
ConnectorConfiguration clnCfg = new ConnectorConfiguration()
.setHost("127.0.0.1");
return super.getConfiguration()
.setLocalHost("127.0.0.1")
.setConnectorConfiguration(clnCfg)
.setDiscoverySpi(disco)
.setCacheConfiguration(ccfg);
}
示例9: getConfiguration
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; //导入依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));
cfg.setDiscoverySpi(disco);
CacheConfiguration ccfg = defaultCacheConfiguration();
ccfg.setName("test-cache");
ccfg.setCacheMode(LOCAL);
ccfg.setCacheStoreFactory(singletonFactory(new TestStore()));
ccfg.setReadThrough(true);
ccfg.setWriteThrough(true);
ccfg.setLoadPreviousValue(true);
cfg.setCacheConfiguration(ccfg);
return cfg;
}
示例10: getConfiguration
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
// Filling configuration for client nodes
if (client) {
TcpDiscoveryVmIpFinder clientFinder = new TcpDiscoveryVmIpFinder();
Collection<String> addrs = new ArrayList<>(ipFinder.getRegisteredAddresses().size());
for (InetSocketAddress sockAddr : ipFinder.getRegisteredAddresses())
addrs.add(sockAddr.getHostString() + ":" + sockAddr.getPort());
clientFinder.setAddresses(addrs);
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(clientFinder));
cfg.setClientMode(true);
}
cfg.setLocalHost("127.0.0.1");
return cfg;
}
示例11: startUp
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; //导入依赖的package包/类
/**
* 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);
}
示例12: apply
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; //导入依赖的package包/类
@Override
public Ignite apply(ExtendedActorSystem system) {
final IgniteProperties properties = igniteConfigProvider.apply(system);
final IgniteConfiguration igniteConfiguration = new IgniteConfiguration();
igniteConfiguration.setClientMode(properties.isClientNode());
// durable file memory persistence
if (properties.isEnableFilePersistence()) {
DataStorageConfiguration persistentStoreConfiguration = new DataStorageConfiguration();
persistentStoreConfiguration.setStoragePath(properties.getIgnitePersistenceFilePath() + "/data/store");
persistentStoreConfiguration.setWalArchivePath(properties.getIgnitePersistenceFilePath() + "./data/walArchive");
igniteConfiguration.setDataStorageConfiguration(persistentStoreConfiguration);
}
// connector configuration
final ConnectorConfiguration connectorConfiguration = new ConnectorConfiguration();
connectorConfiguration.setPort(properties.getIgniteConnectorPort());
// common ignite configuration
igniteConfiguration.setMetricsLogFrequency(properties.getMetricsLogFrequency());
igniteConfiguration.setQueryThreadPoolSize(properties.getQueryThreadPoolSize());
igniteConfiguration.setDataStreamerThreadPoolSize(properties.getDataStreamerThreadPoolSize());
igniteConfiguration.setManagementThreadPoolSize(properties.getManagementThreadPoolSize());
igniteConfiguration.setPublicThreadPoolSize(properties.getPublicThreadPoolSize());
igniteConfiguration.setSystemThreadPoolSize(properties.getSystemThreadPoolSize());
igniteConfiguration.setRebalanceThreadPoolSize(properties.getRebalanceThreadPoolSize());
igniteConfiguration.setAsyncCallbackPoolSize(properties.getAsyncCallbackPoolSize());
igniteConfiguration.setPeerClassLoadingEnabled(properties.isPeerClassLoadingEnabled());
final BinaryConfiguration binaryConfiguration = new BinaryConfiguration();
binaryConfiguration.setCompactFooter(false);
igniteConfiguration.setBinaryConfiguration(binaryConfiguration);
// cluster tcp configuration
final TcpDiscoverySpi tcpDiscoverySpi = new TcpDiscoverySpi();
final TcpDiscoveryVmIpFinder tcpDiscoveryVmIpFinder = new TcpDiscoveryVmIpFinder();
// need to be changed when it come to real cluster configuration
tcpDiscoveryVmIpFinder.setAddresses(Arrays.asList(properties.getTcpDiscoveryAddresses() + properties.getIgniteServerPortRange()));
tcpDiscoverySpi.setIpFinder(tcpDiscoveryVmIpFinder);
igniteConfiguration.setDiscoverySpi(new TcpDiscoverySpi());
final Ignite ignite = Ignition.start(igniteConfiguration);
Runtime.getRuntime().addShutdownHook(new Thread(ignite::close));
return ignite;
}
示例13: getIgniteConfiguration
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; //导入依赖的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;
}
示例14: setNumberProcesses
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; //导入依赖的package包/类
/**
* Configures discovery options based by number of used grid instances.
*
* @param configuration base configuration.
* @param numberOfProcesses which will be used to run test suite.
*/
public static void setNumberProcesses(IgniteConfiguration configuration, int numberOfProcesses) {
TcpDiscoveryVmIpFinder finder = new TcpDiscoveryVmIpFinder();
List<InetSocketAddress> addresses = new ArrayList<>();
for (int i = 0; i < numberOfProcesses; i++) {
addresses.add(InetSocketAddress.createUnresolved("127.0.0.1", 47500 + i));
}
finder.registerAddresses(addresses);
TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
discoverySpi.setIpFinder(finder);
configuration.setDiscoverySpi(discoverySpi);
}
示例15: setNumberProcesses
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; //导入依赖的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);
}