Starting a new version of a module can take some time (from several seconds to few minutes), depending on its complexity, which will make the module unavailable during this operation, as well as the modules depending on it. This can be even more problematic when it involves a template set module: the consequence will be the unavailability of the sites using this template set during the start operation. The following procedure will explain you how to perform a module deployment in a cluster with limited downtime.
The general idea is to redirect the traffic of your site(s) on some cluster nodes, while deploying the modules on the other cluster nodes. And then redirect the traffic on the nodes with the new modules while performing the deployment on the remaining cluster nodes.
For this, the nodes, which will get the deployment of modules in a first turn (including the processing node), are isolated into a dedicated cluster group. By default, all cluster nodes are part of a reserved ‘default’ group.
Alternative procedure is creating cluster groups per node and performing the deployment of modules node by node. Both approaches are described in next sections.
In the following we assume that the cluster consists of four nodes: 192.168.0.10:7860, 192.168.0.20:7860, 192.168.0.30:7860, 192.168.0.40:7860, where 192.168.0.10 is the processing node. Note, please, here we are using the IPs and port numbers of the nodes, which are defined in the jahia.node.properties by cluster.hazelcast.bindPort.
The deployment of modules will first go to the processing node (192.168.0.10:7860) and one of the browsing nodes (192.168.0.20:7860).
Note, please, that during those operations any other module management actions should be avoided.
curl -s --user root --request POST --data "name=deployment&nodes=192.168.0.10:7860,192.168.0.20:7860" http://localhost:8080/modules/api/cluster/groups
curl -s --user root http://localhost:8080/modules/api/cluster/groups
curl -s --user root --form bundle=@modulea-2.0.jar --form start=true --form target=deployment http://localhost:8080/modules/api/bundles
curl -s --user root --form bundle=@modulea-2.0.jar --form start=true http://localhost:3030/modules/api/bundles
curl -s --user root --request DELETE http://localhost:8080/modules/api/cluster/groups/deployment
In the following we assume that the cluster consists of four nodes: 192.168.0.10:7860, 192.168.0.20:7860, 192.168.0.30:7860, 192.168.0.40:7860, where 192.168.0.10 is the processing node. Note, please, here we are using the IPs and port numbers of the nodes, which are defined in the jahia.node.properties by cluster.hazelcast.bindPort.
Note, please, that during those operations any other module management actions should be avoided.
curl -s --user root http://localhost:8080/modules/api/cluster/groups
curl -s --user root --form bundle=@modulea-2.0.jar --form start=true --form target=group-192-168-0-10-7860 http://localhost:8080/modules/api/bundles
curl -s --user root --form bundle=@modulea-2.0.jar --form start=true --form target=group-192-168-0-20-7860 http://localhost:2020/modules/api/bundles
curl -s --user root --form bundle=@modulea-2.0.jar --form start=true --form target=group-192-168-0-30-7860 http://localhost:3030/modules/api/bundles
curl -s --user root --form bundle=@modulea-2.0.jar --form start=true --form target=group-192-168-0-40-7860 http://localhost:4040/modules/api/bundle
curl -s --user root --form bundle=@modulea-2.0.jar --form start=true http://localhost:8080/modules/api/bundles
curl -s --user root --request DELETE http://localhost:8080/modules/api/cluster/groups/_all
curl -s --user root http://localhost:8080/modules/api/cluster/groups