Page History
...
Note |
---|
However, using a shared file system is the first preference that WSO2 recommends to synchronize the artifacts among the nodes, . That is because you can publish synapse artifacts to any of the nodes, avoiding the vulnerability of a single point of failure that is present when using remote synchronization (Rsync). |
...
Using Remote Synchronization (Rsync)
Use the following deployment synchronization recommendations based on the rate of change of artifacts that happen in your cluster:
...
Another common approach for synchronizing artifacts across all cluster nodes is to use rsyncuse the Rsync tool, which is a file copying tool. If you are unable to maintain a shared file system, you can synchronize content using Rsync. Therefore, you can first deploy artifacts in one node of the cluster and then use rsync to use Rsync to copy those artifacts to other nodes as described below.
...
.
...
Create a file called
nodes-list.txt
that lists all the nodes in the deployment. The following is a sample of the file for two nodes.Tip Different nodes are separated by new lines.
Code Block language text title nodes-list.txt [email protected]:~/setup/192.168.1.1/ei_node/repository/deployment/server [email protected]:~/setup/192.168.1.2/ei_node/repository/deployment/server
Create a file to synchronize the
<PRODUCT_HOME>/repository/deployment/server/
directory between the nodes.Note You must create your own SSH key and define it as the
pem_file
. Alternatively, you can use an existing SSH key. Specify theei_server_dir
depending on the location in your local machine. Change thelogs.txt
file path and the lock location based on where they are locatedin your machine.Tip Configure rsync in the
<EI_HOME>/repository/tenant/
directory to share the tenant artifacts across the cluster.Code Block language applescript title rsync-for-ei-depsync.sh #!/bin/sh ei_server_dir=~/wso2ei-6.2.0/repository/deployment/server/ pem_file=~/.ssh/carbon-440-test.pem #delete the lock on exit trap 'rm -rf /var/lock/depsync-lock' EXIT mkdir /tmp/carbon-rsync-logs/ #keep a lock to stop parallel runs if mkdir /var/lock/depsync-lock; then echo "Locking succeeded" >&2 else echo "Lock failed - exit" >&2 exit 1 fi #get the nodes-list.txt pushd `dirname $0` > /dev/null SCRIPTPATH=`pwd` popd > /dev/null echo $SCRIPTPATH for x in `cat ${SCRIPTPATH}/nodes-list.txt` do echo ================================================== >> /tmp/carbon-rsync-logs/logs.txt; echo Syncing $x; rsync --delete -arve "ssh -i $pem_file -o StrictHostKeyChecking=no" $ei_server_dir $x >> /tmp/carbon-rsync-logs/logs.txt echo ================================================== >> /tmp/carbon-rsync-logs/logs.txt; done
Execute the following command in your CLI to create a Cron job that executes the above file every minute for deployment synchronization.
Code Block language actionscript3 * * * * * /home/ubuntu/setup/rsync-for-depsync/rsync-for-ei-depsync.sh
...