Singleton Deployment in Cluster does not work when master is back again

142 views
Skip to first unread message

Derya Sayar

unread,
Sep 29, 2021, 11:31:20 AM9/29/21
to WildFly
 I have a cluster existing 2 boss instances (Jboss EAP 7.3). I defined cluster in standalone mode.  One of server is master , and other is slave. If master is alive, all clients should connect to master node. If master is down,  clients should switch to slave.  I configured activeMQ in master/slave mode. So it is only up in  master node.  I realized that I should only deploy my jar in master node. Otherwise I have many dependencies error in slave node. Because ACTIVEMQ is not up. I have implemented singleton deployment by adding singleton-deployment.xml under META_INF. 

then I run following command in both Jboss instance.Prod1 is master node.

/subsystem=singleton/singleton-policy=clustering-policy:add(cache-container=server)
/subsystem=singleton/singleton-policy=clustering-policy/election-policy=simple:list-add(name=name-preferences, value=PROD_NODE1)
/subsystem=singleton:write-attribute(name=default, value=clustering-policy)

As I expect, deployment was only deployed in master. Then I  stopped master node,  slave is  selected  from election policy.  My deployment is deployed in slave node.
Then I started master node again, I  expected Jboss to stop deployment in slave. and start deployment in master node.    But it did not happen. 

Why singleton  subsystem does not provide this functionality? Am I missing something?

Thanks in advance

Paul Ferraro

unread,
Sep 30, 2021, 12:32:48 PM9/30/21
to WildFly
I suspect the reason this not behaving the way you expect is because the value you are using for your name-preferences is not correct.
Without any preferences, the singleton policy will prefer the oldest member of the cluster.  This is likely what you are calling your "master node".
After restarting Prod1, Prod1 is not the youngest member of the cluster, thus if no preferences are applied, the primary singleton provider will not change following its restart.

The value used for name preferences should match the node name of the server, e.g. -Djboss.node.name=...
If undefined, this defaults to the host name of the server.  What value are you using for this property?
Reply all
Reply to author
Forward
0 new messages