Wiki source code of Enable Event Distribution
Last modified by Eleni Cojocariu on 2026/10/19 22:25
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | Turn remote observation on, on every node of a [[cluster>>doc:documentation.xs.admin.clustering.architecture.WebHome]], so that each node also applies what the others did. | ||
| 2 | |||
| 3 | 1. In ##xwiki.properties##, enable remote observation. It is off by default, so this is the one line every node needs.((( | ||
| 4 | {{code language="properties"}} | ||
| 5 | observation.remote.enabled = true | ||
| 6 | {{/code}} | ||
| 7 | ))) | ||
| 8 | 1. Name the node in the same file. Without it XWiki generates a UUID and stores it in the ##observation/id.txt## file of that node's permanent directory, and every later diagnostic reads as that UUID instead of a name.((( | ||
| 9 | {{code language="properties"}} | ||
| 10 | observation.remote.id = node1 | ||
| 11 | {{/code}} | ||
| 12 | ))) | ||
| 13 | 1. Choose a channel and list it in ##observation.remote.channels##. The value is the base name of a JGroups configuration file, and XWiki ships none of its own: start with ##udp##, which comes from inside the JGroups library and finds the other nodes by multicast. The property is empty by default, so until it names a channel an enabled node still distributes nothing.((( | ||
| 14 | {{code language="properties"}} | ||
| 15 | observation.remote.channels = udp | ||
| 16 | {{/code}} | ||
| 17 | ))) | ||
| 18 | 1. If multicast is blocked on your network, use ##tcp## instead, and list the members yourself. This is the step that is easy to miss: ##jgroups.tcpping.initial_hosts## defaults to ##localhost[7800]##, so a node that does not get the list only ever finds itself, and the cluster stays silent without any error.((( | ||
| 19 | {{code language="properties"}} | ||
| 20 | observation.remote.channels = tcp | ||
| 21 | {{/code}} | ||
| 22 | |||
| 23 | Pass the member list to the JVM of every node: | ||
| 24 | |||
| 25 | {{code language="none"}} | ||
| 26 | -Djgroups.tcpping.initial_hosts=node1.example.org[7800],node2.example.org[7800] | ||
| 27 | {{/code}} | ||
| 28 | ))) | ||
| 29 | 1. Write your own channel file only if the stacks JGroups bundles do not fit. Drop an XML file into the node's ##WEB-INF/observation/remote/jgroups/## directory, name it after the channel, and list that name in ##observation.remote.channels##. The ##jgroups## network adaptor that reads it is the default of ##observation.remote.networkadapter##, and [[Cluster Architecture>>doc:documentation.xs.admin.clustering.architecture.WebHome]] says when another one would apply.((( | ||
| 30 | {{code language="none"}} | ||
| 31 | WEB-INF/observation/remote/jgroups/mycluster.xml | ||
| 32 | {{/code}} | ||
| 33 | |||
| 34 | The [[JGroups manual>>http://www.jgroups.org/ug.html]] documents what goes inside such a file. | ||
| 35 | ))) | ||
| 36 | 1. Tell JGroups which network to use when the host has more than one interface, or runs IPv6. JGroups picks an interface by matching the ones it finds, which on a multi-homed server is not always the one the other nodes can reach; and on IPv6 the multicast address and the preferred IP stack have to be of the same family, so forcing IPv4 is the simplest way to be sure.((( | ||
| 37 | {{code language="none"}} | ||
| 38 | -Djgroups.bind_addr=10.0.0.11 | ||
| 39 | -Djava.net.preferIPv4Stack=true | ||
| 40 | {{/code}} | ||
| 41 | ))) | ||
| 42 | 1. Restart every node, and look for its channel in the log.((( | ||
| 43 | {{code language="none"}} | ||
| 44 | INFO jgroups.JGroupsNetworkAdapter - Channel [udp] started | ||
| 45 | {{/code}} | ||
| 46 | |||
| 47 | Each node now applies the events the others emit. [[Verify a Cluster>>doc:documentation.xs.admin.clustering.verify.WebHome]] proves the nodes really see each other, and [[Shared Resources>>doc:documentation.xs.admin.clustering.shared-resources.WebHome]] lists what they still have to share. | ||
| 48 | ))) |