Tuesday, September 27, 2011

Script for HA NIM synchronization from master to alternate_master

Here is the sample script for NIM synchronization.



#################################################################################
# This script is used for NIM DB and files synchronization in HA NIM environment
# Author: Radek Ciosk
# Version: 1.0  Date: 27.9.2011
#################################################################################
# Target NIM Server to which synchronize
alternate_master=`lsnim -t alternate_master | awk '{ print $1}'`

# Check if this node is master
if [[ `lsnim -l master | grep is_alternate | awk '{print $3}'` = "yes" ]];then
  echo "`hostname` is master NIM server...continuing with synchronization."
else
  echo "`hostname` is alternate_master NIM server...nothing to synchronize...exiting."
  exit 999
fi

echo "Starting full synchroznization including NIM objects and files in nim FS"
echo `date`
nim -Fo sync -a replicate=yes $alternate_master
RC=$?
echo "Finished full synchroznization with RC=${RC}"
echo `date`
exit $RC

No comments:

Post a Comment