Skip to content

Instantly share code, notes, and snippets.

@ltearno
Created June 15, 2018 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ltearno/3f15eb8f9e48f0b8bf3a3b63987e0893 to your computer and use it in GitHub Desktop.
Save ltearno/3f15eb8f9e48f0b8bf3a3b63987e0893 to your computer and use it in GitHub Desktop.
<subsystem xmlns="urn:jboss:domain:jgroups:5.0">
<!-- this is the cluster's name, nodes use it to discriminate between potentially several clusters -->
<channels default="jboss-cluster-ee">
<channel name="jboss-cluster-ee" stack="tcp"/>
</channels>
<!-- this is teh specification of the use JGroups protocol stack -->
<stacks>
<!-- we use tcp and not udp -->
<stack name="tcp">
<transport type="TCP" socket-binding="jgroups-tcp">
<!-- note that we need the jgroups discovery to publish the host IP and not use its name (because it would be the pod name and not the instance name !) -->
<property name="external_addr">${env.HOST_IP}</property>
<property name="use_ip_addrs">true</property>
</transport>
<!-- that's where we specify to use JDBC_PING as the discovery mechanism -->
<protocol type="org.jgroups.protocols.JDBC_PING">
<!-- This is the datasource we configured previously -->
<property name="datasource_jndi_name">java:jboss/datasources/ClusteringDS</property>
<!-- And here are the configured SQL statements working on Postgres, you can translate them for the database you want ! -->
<property name="initialize_sql">
CREATE TABLE IF NOT EXISTS JGROUPSPING (
own_addr varchar(200) NOT NULL,
bind_addr varchar(200) NOT NULL,
created timestamp NOT NULL,
cluster_name varchar(200) NOT NULL,
ping_data BYTEA,
constraint PK_JGROUPSPING PRIMARY KEY (own_addr, cluster_name)
)
</property>
<property name="insert_single_sql">
INSERT INTO JGROUPSPING (own_addr, bind_addr, created, cluster_name, ping_data) values (?,'${env.HOST_IP}',NOW(), ?, ?)
</property>
<property name="delete_single_sql">
DELETE FROM JGROUPSPING WHERE own_addr=? AND cluster_name=?
</property>
<property name="select_all_pingdata_sql">
SELECT ping_data FROM JGROUPSPING WHERE cluster_name=?
</property>
</protocol>
<protocol type="MERGE3"/>
<protocol type="FD_SOCK"/>
<protocol type="FD_ALL"/>
<protocol type="VERIFY_SUSPECT"/>
<protocol type="pbcast.NAKACK2"/>
<protocol type="UNICAST3"/>
<protocol type="pbcast.STABLE"/>
<protocol type="pbcast.GMS">
<property name="print_physical_addrs">true</property>
<property name="print_local_addr">true</property>
</protocol>
<protocol type="MFC"/>
<protocol type="FRAG2"/>
</stack>
</stacks>
</subsystem>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment