WildFly Clustering without Multicast: Difference between revisions
No edit summary |
|||
Line 139: | Line 139: | ||
=Why Doesn't the Cluster Form?= | =Why Doesn't the Cluster Form?= | ||
<font color=red> | |||
'''TODO''': Did not work - I only started clustering if I deployed a distributable servlet. Investigate why. | |||
If the servers are not specifically configured to eagerly start the caches, JGroups channels are not initialized at boot, so the cluster does not form, unless an application specifically requires clustering. | If the servers are not specifically configured to eagerly start the caches, JGroups channels are not initialized at boot, so the cluster does not form, unless an application specifically requires clustering. | ||
Line 146: | Line 150: | ||
<pre> | <pre> | ||
/profile=ha/subsystem=infinispan/cache-container=web:write-attribute(name=start,value=eager) | /profile=ha/subsystem=infinispan/cache-container=web:write-attribute(name=start,value=eager) | ||
</pre> | </pre> | ||
</font> | |||
=Other Subsystems that May Require Switching to TCP= | =Other Subsystems that May Require Switching to TCP= |
Revision as of 09:02, 24 February 2016
External
- How do I switch clustering to TCP instead of multicast UDP in EAP 6? https://access.redhat.com/solutions/140103
- Configuring Cluster to run with TCP in Domain Mode of EAP6 using CLI https://access.redhat.com/solutions/146323
Internal
Procedure
Switch to a "tcp" Default Stack
Configuration File
Locate the "jgroups" subsystem in standalone.xml or domain.xml relevant profile, and set default-stack value to "tcp":
... <subsystem xmlns="urn:jboss:domain:jgroups:1.1" default-stack="tcp"> ...
CLI
/profile=ha/subsystem=jgroups:write-attribute(name=default-stack,value=tcp)
Note that the operation requires reload, but you should reload the server configuration only after the entire procedure is complete (see reload)
Replace the MPING protocol with TCPPING
Configuration File
Locate the "tcp" stack inside the "jgroups" subsystem and replace the MPING protocol with TCPPING:
... <stack name="tcp"> <transport type="TCP" socket-binding="jgroups-tcp"/> <protocol type="TCPPING"> <property name="initial_hosts">1.2.3.4[7600],1.2.3.5[7600]</property> <property name="num_initial_members">2</property> <property name="port_range">0</property> <property name="timeout">2000</property> </protocol> <!--<protocol type="MPING" socket-binding="jgroups-mping"/>--> <protocol type="MERGE2"/> ... </stack> ...
If the domain model is used and the same profile is shared by several server groups, the "initial_hosts" property should be set on the server_group, as follows:
... <stack name="tcp"> <transport type="TCP" socket-binding="jgroups-tcp"/> <protocol type="TCPPING"> <property name="initial_hosts">${jboss.cluster.tcp.initial_hosts}</property> ... </protocol> ... </stack> ...
and the server group-specific values for the system property are set in the <server-group> element as follows:
... <server-groups> <server-group name="something" profile="ha"> <socket-binding-group ref="ha-sockets"/> <system-properties> <property name="jboss.cluster.tcp.initial_hosts" value="1.2.3.4[7600],1.2.3.5[7600]" /> </system-properties> </server-group> ... <server-groups>
CLI
Note that we can't simply remove MPING and add TCPING, the CLI API is not expressive enough to allow us to specify the protocol's position in the list. We need to replace MPING with TCPPING as follows:
/profile=ha/subsystem=jgroups/stack=tcp/protocol=MPING/:write-attribute(name=type,value=TCPPING)
then remove the "socket-binding" node:
/profile=ha/subsystem=jgroups/stack=tcp/protocol=MPING/:write-attribute(name=socket-binding)
/profile=ha/subsystem=jgroups/stack=tcp/protocol=MPING/property=initial_hosts:add(value="1.2.3.4[7600],1.2.3.5[7600]") /profile=ha/subsystem=jgroups/stack=tcp/protocol=MPING/property=num_initial_members:add(value="2") /profile=ha/subsystem=jgroups/stack=tcp/protocol=MPING/property=port_range:add(value="0") /profile=ha/subsystem=jgroups/stack=tcp/protocol=MPING/property=timeout:add(value="2000")
- In domain mode, if the same profile is shared by several server groups, the "initial_hosts" property should be set on the server_group and not in the profile, as follows:
/profile=ha/subsystem=jgroups/stack=tcp/protocol=MPING/property=initial_hosts:add(value="${jboss.cluster.tcp.initial_hosts}")
In this case, the server group-specific values for the system property are set in the <server-group> element as described in manipulating per-server-group properties (note that the value must be set before :reload otherwise the reload will fail:
/server-group=web/system-property=jboss.cluster.tcp.initial_hosts:add(value="1.2.3.4[7600],1.2.3.5[7600]")
Reload
The controllers must be reloaded, first the domain controller and then the host controllers. It is important to reload the domain controller first, otherwise replacing MPING with TCPPING does not take:
reload --host=dc1 reload --host=h1 --restart-servers=true reload --host=h2 --restart-servers=true
For more details see reload.
Additional Verifications
- Verify that the cluster members do actually bind to the IP addresses specified in initial_hosts.
- See port_range recommendations.
- See num_initial_members recommendations.
Why Doesn't the Cluster Form?
TODO: Did not work - I only started clustering if I deployed a distributable servlet. Investigate why.
If the servers are not specifically configured to eagerly start the caches, JGroups channels are not initialized at boot, so the cluster does not form, unless an application specifically requires clustering.
In order to eagerly start the cache:
/profile=ha/subsystem=infinispan/cache-container=web:write-attribute(name=start,value=eager)