简体   繁体   中英

Restrict Infinispan Cache to add multiple Nodes in a Cluster

I am using Infinispan cache in Jboss for my java project. I have two nodes of Jboss running on different machines. I have successfully configure my infinispan cache which replicate their data between two nodes. Below is my infinispan cache configuration:

GlobalConfigurationBuilder global = new GlobalConfigurationBuilder();
JChannel jchannel = new JChannel();
JGroupsTransport transport = new JGroupsTransport(jchannel);
global.transport().transport(transport);
manager = new DefaultCacheManager(global.build());
ConfigurationBuilder c = new ConfigurationBuilder();
c.clustering().cacheMode(CacheMode.DIST_SYNC).hash().numOwners(numOwners).numSegments(numSegments).capacityFactor(capacityFactor).build();
c.invocationBatching().enable();
c.transaction().transactionMode(TransactionMode.TRANSACTIONAL).lockingMode(LockingMode.PESSIMISTIC);
manager.defineConfiguration(DIST, c.build());

but the problem is whenever i used above configuration its automatically detect all nodes and add it to the cluster which is i don't want. How can i restrict this; not to add all nodes in a cluster.

TIA.

offtopic : Infinispan creates the JChannel for you if you don't want to create and manage it yourself. Use GlobalConfigurationBuilder.defaultClusteredBuilder() . You can find the Infinispan's configuration here: https://infinispan.org/docs/stable/titles/configuring/configuring.html#cluster_transport

To solve your issue, you need to change the JGroups configuration. If you are using UDP + PING combination (most likely), to create separated clusters just change the UDP mcast_addr and/or mcast_port attributes.

Check the JGroups' documentation for more info: http://www.jgroups.org/manual4/index.html#DiscoveryProtocols

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM