Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794
{"id":2468,"date":"2019-12-05T00:51:42","date_gmt":"2019-12-05T00:51:42","guid":{"rendered":"https:\/\/support.aklwebhost.com\/?post_type=manual_kb&p=2468"},"modified":"2019-12-06T23:44:38","modified_gmt":"2019-12-06T23:44:38","slug":"setup-file-mirroring-using-rsync-in-debian-ubuntu","status":"publish","type":"manual_kb","link":"https:\/\/support.aklwebhost.com\/knowledgebase\/setup-file-mirroring-using-rsync-in-debian-ubuntu\/","title":{"rendered":"Setup File Mirroring Using Rsync in Debian\/Ubuntu"},"content":{"rendered":"

Introduction<\/strong><\/h3>\n

If you run a critical website, it is a good practice to mirror your files to a secondary server. In the event that your main server has a network or hardware issue, having mirrored files provides you with the flexibility to immediately switch from one server to another.<\/p>\n

To sync your files from server\u00a0A (main)<\/strong>\u00a0to server\u00a0B (backup)<\/strong>, follow these steps.<\/p>\n

Install rsync<\/strong><\/h3>\n

Install rsync on both server A and server B.<\/p>\n

apt-get install rsync\r\n<\/code><\/pre>\n

Generate an SSH key on server B<\/strong><\/h3>\n

Run the following command on server B to generate an SSH key.<\/p>\n

ssh-keygen\r\n<\/code><\/pre>\n

Press enter to skip all inputs.<\/p>\n

Copy the content generated in\u00a0\/root\/.ssh\/id_rsa.pub<\/code>.<\/p>\n

Insert the SSH public key to server A<\/strong><\/h3>\n

Go to server A<\/strong>, insert the copied content into\u00a0\/root\/.ssh\/authorized_keys<\/code>.<\/p>\n

If this directory or file does not exist, create it. Now server B can log into server A using SSH.<\/p>\n

Start sync<\/strong><\/h3>\n

Go back to server B and start rsync for the first time. Review and run the command below. You will need to add the path to your website on both servers and the IP address of server A.<\/p>\n

rsync -avrt --delete --rsh='ssh -p 22' root@SERVER_A_IP_ADDRESS:\/path\/to\/your\/website\/in\/server\/a\/ \/backup\/path\/in\/server\/b\/\r\n<\/code><\/pre>\n

Type\u00a0yes<\/code>\u00a0if you been asked to save the authentication information. If you have configured ssh to listen on a custom port, change the 22 to your own port. Wait until all files has been synced over.<\/p>\n

Setup cronjob<\/strong><\/h3>\n

Setup a cronjob to sync your files automatically. This example syncs them every 3 minutes. Edit\u00a0\/etc\/crontab<\/code>.<\/p>\n

Review the following line, and append it in the\u00a0crontab<\/code>\u00a0file. You will need to update it as you did previously.<\/p>\n

*\/3 * * * * root rsync -avrt --delete --rsh='ssh -p 22' root@SERVER_A_IP_ADDRESS:\/path\/to\/your\/website\/in\/server\/a\/ \/backup\/path\/in\/server\/b\/ >\/dev\/null 2>&1<\/code><\/pre>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","manualknowledgebasecat":[233,242,247],"manual_kb_tag":[303],"_links":{"self":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2468"}],"collection":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/comments?post=2468"}],"version-history":[{"count":1,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2468\/revisions"}],"predecessor-version":[{"id":2469,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2468\/revisions\/2469"}],"wp:attachment":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/media?parent=2468"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manualknowledgebasecat?post=2468"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb_tag?post=2468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}