Wildfly 8.2.1 Distributed cache on multiple nodes in different machines
pilipino22 Nov 29, 2016 2:13 AMHow can I make a distributed cache to work when the nodes are on a different machines?
I'm trying make the cluster-test from "wildfly cookbook" to work.
I have setup wildfly 8.2.1 on 2 Virtual Machines using standalone-ha.xml configuration.
Below are my configuration changes from the default
Node1
standalone.conf
JAVA_OPTS="$JAVA_OPTS -Djboss.server.default.config=standalone-ha.xml"
JAVA_OPTS="$JAVA_OPTS -Djboss.node.name=node1 -Djboss.default.multicast.address=230.0.0.10"
standalone-ha.xml
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:node1_IP}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:node1_IP}"/>
</interface>
<interface name="unsecure">
<inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
</interfaces>
Node2
standalone.conf
JAVA_OPTS="$JAVA_OPTS -Djboss.server.default.config=standalone-ha.xml"
JAVA_OPTS="$JAVA_OPTS -Djboss.node.name=node2 -Djboss.default.multicast.address=230.0.0.10"
standalone-ha.xml
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:node2_IP}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:node2_IP}"/>
</interface>
<interface name="unsecure">
<inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
</interfaces>
Below are the content of the cluster-test application from wildfly cookbook
web.xml
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>cluster-test</display-name>
<distributable/>
</web-app>
index.jsp
<html>
<body>
<h2>WildFly::Cookbook::Cluster Test</h2>
<%
Object sessAttr = session.getAttribute("visitors");
int visitors = sessAttr == null ? 0 : Integer.valueOf(sessAttr+"");
System.out.println("********************************+");
System.out.println("Visitor(s): " + visitors);
System.out.println("********************************+");
%>
<h2>Visitor(s): <%=visitors%></h2>
<%
Using the same configuration on a single machine with just port offsetting on the 2nd node everything works well.
Is there anything needed to configure for the distributed cache to work on 2 different machines?