Deployment Synchronizer or Dep-Sync is use to synchronize artifacts within nodes in a cluster. Here we are going to see how we can use registry based deployment synchronizer to sync artifacts within two WSO2 ESB nodes. There are other synchronization methods available in WSO2 servers such as Subversion (svn) based deployment synchronizer and git based deployment synchronizer, but they need third party software and bit hard to configure compared to registry based deployment synchronizer.
Before doing the actual registry based deployment synchronizer configurations we first need to mount ESB's /_system/config collection to a single database. To get a clear idea on registry mounting read this.
[NOTE] You can't use Embedded H2 database for this since H2 allows one connection at a time in its Embedded mode. So I am using MySQL here to do the registry mounting.
To be more clear for you, here I am pasting the configurations I used for my setup.
Node 1: Master
$CARBON_HOME/repository/conf/datasources/masterdatasource.xml
Local datasource configuration.
Mounted datasource configuration.WSO2_CARBON_DB The datasource used for registry and user manager jdbc/WSO2CarbonDB jdbc:mysql://x.x.x.x:3306/master?autoReconnect=true root root123 com.mysql.jdbc.Driver 50 60000 true SELECT 1 30000
$CARBON_HOME/repository/conf/registry.xmlWSO2_CARBON_MOUNTED_DB The shared datasource used for registry jdbc/WSO2CarbonSharedDB jdbc:mysql://x.x.x.x:3306/shared?autoReconnect=true root root123 com.mysql.jdbc.Driver 50 60000 true SELECT 1 30000
SharedRegistry wso2registry false true / root@jdbc:mysql://x.x.x.x:3306/shared SharedRegistry /_system/config SharedRegistry /_system/governance
Node 2: Worker
$CARBON_HOME/repository/conf/datasources/masterdatasource.xml
Local datasource configuration.
WSO2_CARBON_DB The datasource used for registry and user manager jdbc/WSO2CarbonDB jdbc:mysql://x.x.x.x:3306/worker?autoReconnect=true root root123 com.mysql.jdbc.Driver 50 60000 true SELECT 1 30000
Mounted datasource configuration.
WSO2_CARBON_MOUNTED_DB The shared datasource used for registry jdbc/WSO2CarbonSharedDB jdbc:mysql://x.x.x.x:3306/shared?autoReconnect=true root root123 com.mysql.jdbc.Driver 50 60000 true SELECT 1 30000
$CARBON_HOME/repository/conf/registry.xml
SharedRegistry wso2registry true true / root@jdbc:mysql://x.x.x.x:3306/shared SharedRegistry /_system/config SharedRegistry /_system/governance
[NOTE] If the registry mount configured correctly you can see following type of server start up log.
Now registry mounting is done. So let's do the registry based deployment synchronizer configurations.
In deployment synchronize setup not all nodes can configure but one or two which we called them as Master nodes, while others change their configurations according to the Master nodes which we called them as Worker nodes.
In registry based dep-sync mechanism it uses mounted registry and registry checkin-checkout functionality to synchronize artifacts. Following figure shows you how the registry based deployment synchronizer works.
[NOTE] Red arrows direct how the data flow to worker node.
[NOTE] Any number of worker nodes can be connected via JDBC mount.
Now lets see how to configure Master and Worker nodes.
In both nodes we need to enable to tribes clustering which is use to communicate within nodes. To do that you need to set the enable attribute of the clustering to true in $CARBON_HOME/repository/axis2 /axis2.xml as follows.
[NOTE] Any number of worker nodes can be connected via JDBC mount.
Now lets see how to configure Master and Worker nodes.
In both nodes we need to enable to tribes clustering which is use to communicate within nodes. To do that you need to set the enable attribute of the clustering to true in $CARBON_HOME/repository/axis2 /axis2.xml as follows.
You can alter the other cluster configuration values to fine tune the cluster. E.g. Membership Scheme- multicast or well known address, domain, Maximum retries (More details on these can be found in the axis2.xml)
Configure Manager Node
Enable the following configuration with the correct values as follows.
Enable the following configuration with the correct values as follows.
true true false
Here Enable is set to true to indicate that the registry based deployment synchronizer is enabled. AutoCommit is set to true to indicate that this node can commit the changes to registry. AutoCheckout is set to false to indicate that this node is not needed to checkout since this is the only node which do the changes to the configurations.
[NOTE] : AutoCheckout should be set to true if there are more than one Manager nodes.
Configure Worker Node
Enable the following configuration with the correct values as follows.
true false true
Here Enable is set to true to indicate that the registry based deployment synchronizer is enabled. AutoCommit is set to false to indicate that this node cannot commit the changes to registry. AutoCheckout is set to true to indicate that this node needed to checkout since this node needed to sync up with the Manager node.
That's it with the configuration... Quite simple.
Now lets see how this works.
First start Manager node.
If the cluster well configured in this node, a log similar to following will be appeared.
Then start Worker node.
If the cluster well configured in this node, a log similar to following will be appeared.
As you can see in the log the Manager node should appear as a Member of the cluster.
Now the servers are up and ready. Lets add a endpoint to the Manager node.
[NOTE]: You should always add/update/delete artifacts using the Manager node.
Every 10 seconds (This value is default and can be configured) of time worker check whether there are changes in the deployed artifacts. If there are changes then they will commit to the registry and send a cluster message asking worker nodes to synchronize. Following is a log message which logged when the synchronization message sent.
When the worker receive that message it will update the artifacts from the registry. When updating Worker node logs following log messages.
New artifact addedregistry.xml
Artifact updated
Artifact deleted
Here I only tried with endpoints. But you can try with other artifacts such as sequence, templates, message stores etc...
So here is the end result in the worker node......
[NOTE] This is only recommend for small deployments only.
What's ????? ... we have changed from GREG deployment to svn deployment on Carbon 4.X , because WSO2 say "This method to sync deployments has been deprecated" and now you say "Ohhh!!! you can use dep-sync over registry.... That's a joke!!!
ReplyDeleteYes, this was deprecated before since it has some limitations. Since some of the users cannot use svn in their production systems we thought of having this as well. So this is a new improved version of dep-sync and only ESB 4.7.0 onward versions we recommend it to use.
ReplyDeletehi
ReplyDeleteI am using WSO2 ESB 4.0.3 with WSO2GREB 4.1.1 for registry based deployment synchronizer(where axis2 clustering is not necessary) and notice that undeploying .car file seem to have an issue. Deploying is master, does get the .car file deployed in slave, but when then the .car file is removed, it is not getting removed from slave, with a synchronisation period of 60 secs. It gets removed only after another .car file is deployed, which means only if there is a change in registry . Is my analysis correct? Do I need to have 'Use Eventing' enabled to overcome this issue?
Please reply!
Update: Realized that this issue is only with a .car file that is left all alone in the carbonapps(sinlge .car file in carbonapps directory).Removing this .car file from master, does not get reflected in slave, until and unless there is another .car file added(wso2carbon logs says so)
DeleteCould you please confirm if this is the existing behavior.?
Hi Siresha,
ReplyDeleteThose limitations are there for car files in the previous versions. But for the oncoming version I may say ESB 4.7.0, those are fixed. Also we thought of performance aspect and now it take much less time.
Thank you so much for that reply!
DeleteIs it possible to setup registry-based deployment synchronization in WSO2 ESB version 4.6? Or would I have to wait for 4.7? I have tried to set this up in 4.6 but I receive an error indicating that the "Current collection is not under registry control" after following all required steps. Is there a way to re-enable this functionality in 4.6? Thanks..
ReplyDeleteHi Anthony,
ReplyDeleteYou have to wait till the 4.7.0 to be released.
Hi Eranda
ReplyDeleteI have a setup of "deployment synchronization on Governance based registry clustering(Greg, Master, Slave)" on WSO2ESB 4.0.3, on my UAT machines. All was running fine , until recently where I had faced below errors. I could not debug and hence started with a new server setup on my slave server, which was resolved luckily but in vain as this new server set up started to throw the same error , hence failing "deployment synchronier" , and in turn not synching anything from master .
Starting a synchronizer on file system at: /ngs/app/tqst/tqs/depsync_wso2esb-4.0.3/repository/deployment/server/ {org.wso2.carbon.deployment.synchronizer.DeploymentSynchronizer}
TID: [0] [WSO2 ESB] [2013-09-11 07:22:43,182] WARN {org.wso2.carbon.deployment.synchronizer.DeploymentSynchronizationManager} - A deployment synchronizer is already engaged for the file system at: /ngs/app/tqst/tqs/depsync_wso2esb-4.0.3/repository/deployment/server/ {org.wso2.carbon.deployment.synchronizer.DeploymentSynchronizationManager}
TID: [0] [WSO2 ESB] [2013-09-11 07:22:43,182] INFO {org.wso2.carbon.deployment.synchronizer.DeploymentSynchronizer} - Terminating the synchronizer on file system at: /ngs/app/tqst/tqs/depsync_wso2esb-4.0.3/repository/deployment/server/ {org.wso2.carbon.deployment.synchronizer.DeploymentSynchronizer}
I have explained clearly in the below query. Could you please help me to resolve this issue, as this is very crucial my UAT set up. On failure of this model/setup, I will be foreced to use independed servers and hence deploy manually everything in all the servers.
Earlier because of the success of clustering 2 servers, I was asked to cluster 2 more now, but all of a sudden I started to face this error, could you please provide me a alternate as how to start the "dep sync", which seems to get terminated automatically...
http://stackoverflow.com/questions/18736702/wso2-esb-deployment-synchronizer-facing-error-on-starting-the-synchronizer-on-t
Is it possible to sync war files across the cluster using Registy-based syncing in ESB 4.7.0?
ReplyDelete