Skip to main content

Replicate server for disaster recovery?

Comments

4 comments

  • cPanelLauren
    Hello, There is a wealth of information and requests for this in the forums, some examples of that might be found in the following threads:
    0
  • Jcats
    Here is a script I wrote for a customer, happy to share, it works good but would encourage you to look it over to ensure it will work for you. You would run this script on the Backup server which is considered the 'local' server in the script, remote server is the live server. [CODE=bash]#!/bin/bash # BigScoots - cpanel fail over sync liveserver=192.168.1.196 sshport=2222 # Remove any accounts from the failover server that no longer reside on the live server. rm -f /tmp/remoteusers.txt /tmp/localusers.txt ssh -p "$sshport" "$liveserver" "whmapi1 listaccts" |grep user: |awk '{print $2}' >> /tmp/remoteusers.txt whmapi1 listaccts |grep user: |awk '{print $2}' >> /tmp/localusers.txt for i in $(grep -Fxv -f /tmp/remoteusers.txt /tmp/localusers.txt) do /scripts/removeacct --force "$i" done rm -f /tmp/remoteusers.txt /tmp/localusers.txt ssh -p "$sshport" "$liveserver" "whmapi1 listaccts" |grep user: |awk '{print $2}' >> /tmp/remoteusers.txt whmapi1 listaccts |grep user: |awk '{print $2}' >> /tmp/localusers.txt xferid=$(whmapi1 create_remote_root_transfer_session remote_server_type=cpanel host="$liveserver" port="$sshport" user=root sshkey_name=id_rsa transfer_threads=10 restore_threads=10 unrestricted_restore=1 copy_reseller_privs=0 compressed=0 unencrypted=0 low_priority=0 |grep transfer_session_id: | awk '{print $2}') for cpuser in $(grep -Fxv -f /tmp/localusers.txt /tmp/remoteusers.txt) do whmapi1 enqueue_transfer_item transfer_session_id="$xferid" module=AccountRemoteRoot user="$cpuser" localuser="$cpuser" force=1 overwrite_sameowner_dbs=1 overwrite_sameowner_dbusers=1 skiphomedir=1 skipbwdata=1 done for cpuser in $(ssh -p "$sshport" "$liveserver" "whmapi1 listaccts" |grep user: |awk '{print $2}') ; do whmapi1 enqueue_transfer_item transfer_session_id="$xferid" module=AccountRemoteRoot user="$cpuser" localuser="$cpuser" force=1 overwrite_sameowner_dbs=1 overwrite_sameowner_dbusers=1 skiphomedir=1 skipbwdata=1 skipaccount=1 done whmapi1 start_transfer_session transfer_session_id="$xferid" rsync -a --exclude 'virtfs' --exclude 'error_log' --exclude 'cpanelsolr' --delete -e "ssh -p "$sshport"" "$liveserver":/home/ /home/
    0
  • Gojko
    Hello, thanks for reply. BUT this is sync for ACCOUNTS only i need for server configuration (cPanel configuration, PHP extensions, EasyApache, DNS)? all what i read in that forums is that no solution for config file only static files rsync and featured request that is old couple years with no progression for accounts i have script that backup and upload to remote server, but that is >backup< and if the whole server goes down, to get back 100 accounts from backup that could be a problem and also there is a problem with cPanel configuration, when i install on new server and bring back all 100 accounts some of them still will be offline because use some PHP extension or something else from configuration, that is why i need SERVER clone not just backup accounts any solution for this kind of scenario?
    0
  • cliffordphillips
    Good information to keep in mind to solved the problem.
    0

Please sign in to leave a comment.