Wiki source code of Verify a Cluster

Last modified by Eleni Cojocariu on 2026/10/20 06:45

Show last authors
1 Prove that the nodes of a [[cluster>>doc:documentation.xs.admin.clustering.architecture.WebHome]] found each other and really replicate, once [[event distribution is enabled>>doc:documentation.xs.admin.clustering.enable-event-distribution.WebHome]].
2
3 1. Put this snippet on a page of the wiki, for instance a scratch page in the Sandbox. It names the node that answered the request, says whether distribution is on, and lists the channels with their members.(((
4 {{code language="velocity"}}
5 {{velocity}}
6 * Node: $services.observation.remote.id
7 * Event distribution enabled: $services.observation.remote.enabled
8 * Network adaptor: $services.observation.remote.adapterId
9 #foreach ($channel in $services.observation.remote.channels)
10 * Channel $channel.id, leader $channel.leader.id, members:#foreach ($member in $channel.members) $member.id#end
11 #end
12 {{/velocity}}
13 {{/code}}
14
15 An author without Programming right gets a reduced view of the channels, limited to the identifier, the members and the leader, which is all this check needs.
16 )))
17 1. Open that page and read the answer. A node that has joined nothing answers like this, and a UUID in place of a name means ##observation.remote.id## was left unset on it.(((
18 {{code language="none"}}
19 Node: e733d40c-fa31-4746-9291-6921175666a7
20 Event distribution enabled: false
21 Network adaptor: jgroups
22 {{/code}}
23 )))
24 1. Find out which node answered a given request, when the load balancer decides for you: the session cookie carries the route name of the node that served it, after the dot.(((
25 {{code language="none"}}
26 JSESSIONID=node01x5l7ovxo53gj1iwmaiw9lwilp25.node0
27 {{/code}}
28
29 [[Add a Load Balancer>>doc:documentation.xs.admin.clustering.load-balancer.WebHome]] is where that name is set.
30 )))
31 1. Reach a chosen node instead, by going around the balancer: a host name or a port per node is the simplest way to open the same document on each in turn.(((
32 {{code language="none"}}
33 http://node1.example.org:8080/xwiki/bin/view/Sandbox/
34 http://node2.example.org:8080/xwiki/bin/view/Sandbox/
35 {{/code}}
36 )))
37 1. Check that the balancer really spreads visitors, by opening the wiki in a second browser profile, which gives a second session, and reading the cookie or the snippet again. Do not expect the second session to land elsewhere by construction: the usual balancing method counts requests, and says nothing about where any given session ends up.
38 1. Turn the logs up when something does not add up: raise the ##org.xwiki.observation.remote## logger to ##debug## on both nodes, from the "Logging" section of the wiki administration or in ##logback.xml##, and watch one node send what the other receives.(((
39 {{code language="xml"}}
40 <logger name="org.xwiki.observation.remote" level="debug"/>
41 {{/code}}
42
43 The "Debugging" section of the [[Remote Observation Module>>doc:extensions:Extension.Observation Module Remote]] page lists what those messages look like.
44 )))
45 1. Confirm what all of this is for: open the same page on two nodes, modify it on one, and reload it on the other. The change is there, without restarting anything, and the snippet on each node now lists the other as a member of the channel.(((
46 {{code language="none"}}
47 Node: node2
48 Event distribution enabled: true
49 Network adaptor: jgroups
50 Channel udp, leader node1, members: node1 node2
51 {{/code}}
52 )))

Get Connected