0

I tried to replace our memcached servers with Infinispan Server to get replication/distribution features for our services.

Using the clustered-memcached.xml example configuration I can easily run Infinispan Servers on multiple hosts, but the problem is that the auto discovery/multicast feature will find all Infinispan Server instances on the whole network, meaning it will join all our stages (test, qa, production) together to a single cluster ... which is obviously not what anybody wants.

Is there an example on how I can define cluster members by IP/port without any UDP multicast discovery magic? The documentation has zero content about isolating clusters ... and in general lacks of useful xml examples.

Pali
  • 1,337
  • 1
  • 14
  • 40
  • Hello, see https://stackoverflow.com/questions/45719003/infinispan-cluster-of-a-predefined-set-of-ip-addresses – Diego Apr 19 '19 at 11:52
  • @Diego yes I already tried that providing only the IPs of the desired cluster members but still all instances find each other even though I haven't configured their IP addresses – Pali Apr 23 '19 at 07:34
  • I removed my answer from that post because it was related to embedded mode. I decided to post the answer here. Tks Radim Vansa – Diego Apr 23 '19 at 10:50

1 Answers1

1

What you need to do is configure the initial_hosts adding what are the IP addresses. In this example, we are using 192.168.1.2[7600],192.168.1.3[7600]

The following is a partial stack configuration

    <stack name="tcp">
        <transport type="TCP" socket-binding="jgroups-tcp"/>
        <protocol type="TCPPING">
            <property name="initial_hosts">192.168.1.2[7600],192.168.1.3[7600]</property>
            <property name="num_initial_members">2</property>
            <property name="port_range">0</property>
            <property name="timeout">2000</property>
        </protocol>
        .......
    </stack>

Once you have configured the initial_hosts, you need to change what will be the stacks when the server starts.

1) You can replace ${jboss.default.jgroups.stack:udp} with tcp

OR

2) Start the server with ./standalone.sh -c clustered.xml -Djboss.default.jgroups.stack=tcp

<subsystem xmlns="urn:infinispan:server:jgroups:9.4">
  <channels default="cluster">
    <channel name="cluster"/>
  </channels>
  <stacks default="${jboss.default.jgroups.stack:udp}">
    ...
  </stacks>
</subsystem>
Diego
  • 413
  • 3
  • 14
  • if I run a third instance on 192.168.1.99 without configuring anything related to the 2 other instances, the 3rd instance automagically joins the cluster after 2-5 minutes (not on start but shortly after) (I am observing this behaviour in 3 vagrant boxes and I haven't found a way to build independent and isolated clusters ... all instances sooner or later find each other and join together) – Pali Apr 23 '19 at 11:04
  • also there is no property named "cluster" for transport element (error in log) – Pali Apr 23 '19 at 11:29
  • I removed the wrong configuration. About Vagrant boxes and Cluster you should create another question on StackOverflow because they are not related. You should try to configure Jgroups with "PING with a different mcast address for each cluster" OR "DNS_PING + headless service" – Diego Apr 26 '19 at 12:37
  • Cluster1: 228.10.10.1 Cluster2: 228.10.10.2 As I said, a new question will be better because another user would like to setup Vagrant – Diego Apr 26 '19 at 12:41