Pali
Pali

Reputation: 1347

Infinispan Server Cluster - define member IP addresses

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.

Upvotes: 0

Views: 540

Answers (1)

Diego
Diego

Reputation: 444

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>

Upvotes: 1

Related Questions