Mirror Primary SME Server to Second SME Server over Internet with rsync
Jump to navigation
Jump to search
Mirror Primary SME Server to Second SME Server over Internet with rsync
If you have two Office who use SME Servers and you want to have a Mirror try it with "rsync"
steps:
1. Login into both SME Servers on https://serverip/server-manager as "admin"
2. Set on Remote Access "Allow" administrative Login with SSH
3. Create ssh-key-files without password and copy them to both SMEs folder "/root/.ssh/" with a usbstick or scp
4. copy my sync.sh to Primary SME Servers /root
######################################################### SME Server Sync.sh Script by www.linuxonlinehelp.de 2013 Change Port 22 to your secret hidden SSH port opened on your Firewall !!! ######################################################### echo ..starting sync limit 1000kbs... # show Time+Date of Start date echo ##########ibays########### rsync --bwlimit=1000 -ave "ssh -p 22" /home/ primarydomain.com:/home echo ##########opt############ rsync --bwlimit=1000 -ave "ssh -p 22" /opt/ primarydomain.com:/opt echo ### MYSQL ### mysqldump --all-databases > /root/mysql-dump.sql # Show End Time+Date date echo ### transfer Databases and restore them remotely ## scp -P 22 /root/mysql-dump.sql primarydomain.com:/root echo ### Remote Restore MYSQL ### ssh primarydomain.com -p 22 'mysqldump --all-databases > /root/mysql-old-dump.sql' ssh primarydomain.com -p 22 'mysql < /root/mysql-dump.sql' echo ### Remote Reconfigure and Reboot Second SME Server ### ssh primarydomain.com -p 22 'signal-event post-upgrade' ssh primarydomain.com -p 22 'signal-event reboot' exit 0
5. Login on Primary SME Server SSH Console with Putty from Windows or Xterm from Linux and run $sh /root/sync.sh
6. Now test the Second SME Server !! and check mysql root login without password!! (SME Default setting for internal Handling)
7. >>> CLOSE YOUR OPENED SSH PORTS ON THE FIREWALLS <<<