Sysadmin > UtilitIes > SyncTool

Synctool

http://www.heiho.net/synctool/

WORK IN PROGRESS

Simple steps

  1. Setup working ssh-keys, so that you need no password or you can save the password in a ssh-agent
    1. ssh-copy-id -i ~/.ssh/id_rsa.pub root@10NOSPAM.11.204.75
    2. ssh-agent -c
    3. ssh-add
  2. ssh and rsync
  3. Solaris
    1. use the --rsync-path=/usr/pkg/bin/rsync option in rsync
    2. symlink ping to /sbin/ping

Example synctool.conf for use with Solaris

#
#       synctool.conf
#

masterdir /var/lib/synctool

#overlaydir $masterdir/overlay

# Note that multiple overlay dirs are supported, so you can do things like
#overlaydir $masterdir/overlay-common
#overlaydir $masterdir/overlay-subcluster1
#overlaydir $masterdir/overlay-all
#
# Same goes for deletedir and tasksdir, but not for scriptdir ...
#
# these are defaults:
#deletedir $masterdir/delete
#tasksdir $masterdir/tasks
#scriptdir $masterdir/scripts

# use mode 0777 on Linux
#symlink_mode 0777
# use mode 0755 on most other Unix platforms
symlink_mode 0755

# all files in the repository must have a group extension
#require_extension yes

# make backup copies named *.saved
#backup_copies yes

# ignore all files beginning with a dot (like .profile, .bashrc, ...)
#ignore_dotfiles no

# ignore all directories beginning with a dot (like .git, .svn, ...)
ignore_dotdirs yes

# ignore specific files/directories
ignore .svn
ignore .gitignore

# log to file
logfile /var/log/synctool.log

# configure external commands that synctool uses
diff_cmd /usr/bin/diff -u
ping_cmd /sbin/ping -q -c 1 -t 1
#ping_cmd /usr/bin/fping -t 500
ssh_cmd /usr/bin/ssh -p 17 -o ConnectTimeout=10 -q
scp_cmd /usr/bin/scp -P 17 -o ConnectTimeout=10 -p
rsync_cmd /usr/pkg/bin/rsync -ar --rsync-path=/usr/pkg/bin/rsync --exclude='*.pyc' --delete -e 'ssh -p17 -o ConnectTimeout=10 -q'
synctool_cmd $masterdir/sbin/synctool.py -c $masterdir/synctool.conf
pkg_cmd $masterdir/sbin/synctool_pkg.py -c $masterdir/synctool.conf

#
# configure a package manager for synctool-pkg / dsh-pkg to use
# If you don't configure one, synctool-pkg will try to detect one
# (this is usually OK)
#
# If you do not want to detect it, choose one of the supported
# package managers:
#
#package_manager apt-get
#package_manager yum
#package_manager zypper
#package_manager pacman
#package_manager brew
#package_manager bsdpkg

# max amount of parallel processes that synctool uses on the master node
#num_proc 16

# display full paths or just '$masterdir/overlay/...'
#full_path no

# show terse output with shortened paths?
#terse yes

# colorize output? Note that colors only work for 'terse' output!
#colorize yes

# colorize the full line of output (yes) or just one word (no) ?
#colorize_full_line no

# use bright/bold attribute?
#colorize_bright yes

# specify colors
# valid values are: black, darkgray, red, green, yellow, blue,
# magenta, cyan, white, bold, default
# 'default' means that no color is used
#color_info   default
#color_warn   magenta
#color_error  red
#color_fail   red
#color_sync   default
#color_link   cyan
#color_mkdir  blue
#color_rm     yellow
#color_chown  cyan
#color_chmod  cyan
#color_exec   green
#color_upload magenta
#color_new    default
#color_type   magenta
#color_dryrun default
#color_fixing default

# specify groups and nodes

# compound groups may be specified like this
group solaris primary secondary
#group test wn
#group g1 batch test wn

#
# list all nodes and their groups
# the nodename is a logical name known only to synctool
# "ipaddress:" specifies the IP address where synctool connects to
# Instead of "ipaddress:", also the older "interface:" keyword
# may be used to specify the IP address of a node
#
# The optional 'hostname:' keyword may be used to tell synctool
# the hostname of the node. This is in particular needed for specific
# cases of multi-homed setups in which synctool can not find out what
# node it is running on.
#
node node0 master

node solog1 solaris primary ipaddress:10.15.64.225
node solog2 solaris secondary ipaddress:10.15.64.226
node galog1 solaris primary ipaddress:10.11.204.75
node galog2 solaris secondary ipaddress:10.11.204.76
node bolog1 solaris primary ipaddress:10.10.8.143
node bolog2 solaris secondary ipaddress:10.10.8.145

#node node2 login    ipaddress:node2-mgmt  hostname:myhost2.mydomain.com
#node node3 wn       ipaddress:node3-mgmt
#node node4 wn       ipaddress:node4-mgmt
#node node5 wn       ipaddress:node5-mgmt
#node node6 wn       ipaddress:node6-mgmt
#node node7 wn       ipaddress:node7-mgmt
#node node8 test     ipaddress:node8-mgmt  hostid:/etc/hostname.bnx0
#node node9 batch    ipaddress:node9-mgmt  hostid:/etc/hostname.bnx0

# ignore one or more nodes
ignore_node node0 node9

# ignore a number of groups
ignore_group test test2

#
# run command when file or directory is updated
# This is an alternative method to using .post scripts
# Note that the command on the right hand side must be a full path, or
# else the command will be looked for under scriptdir ($masterdir/scripts)
#
# The exact commands to reload system daemons are operating system dependant
# so adapt these to fit your situation
#
#on_update      /etc/aliases                                    /usr/bin/newaliases
#on_update      /etc/ssh/sshd_config                    /etc/init.d/ssh reload
#on_update      /etc/syslog-ng/syslog-ng.conf   /etc/init.d/syslog-ng reload
#on_update      /etc/ntp.conf                                   /sbin/service ntp reload

#on_update      /etc/logrotate.d                                /bin/rm -f /etc/logrotate.d/*.saved
#on_update      /etc/cron.d                                             /bin/rm -f /etc/cron.d/*.saved
#on_update      /etc/cron.daily                                 /bin/rm -f /etc/cron.daily/*.saved
#on_update      /etc/init.d                                             /bin/rm -f /etc/init.d/*.saved

# always run this command
#always_run /bin/date

# include a local synctool config file on the target node
#include /etc/synctool_local.conf

# EOB