Open main menu

CDOT Wiki β

Changes

OPS345 Assignment 1

1,069 bytes added, 00:09, 26 January 2022
Sync files with www
** Paste the contents of /home/yourusername/.ssh/id_rsa_wwwsync.pub from www-slave1 to the end of that file as one line.
* Test your key authentication setup as yourusername on www-slave1 to confirm you can log in to yourusername@10.3.45.11 (www) without a password:<source>ssh -i /home/yourusername/.ssh/id_rsa_wwwsync yourusername@10.3.45.11</source>
Now set up rsync:
* Create a new file in /var/www/html on www and use this command on www-slave1 to make sure that new file is copied to www-slave1:<source>rsync -e "ssh -i ~/.ssh/id_rsa_wwwsync" -au --exclude="nextcloud" yourusername@10.3.45.11:/var/www/html/* /var/www/html</source>
* Create a new file in /var/www/html on www-slave1 and use this command on www-slave1 to make sure that new file is copied to www:<source>rsync -e "ssh -i ~/.ssh/id_rsa_wwwsync" -au --exclude="nextcloud" /var/www/html/* asmith15@10.3.45.11:/var/www/html</source>
* Once you confirm both rsync commands above work: make them run automatically every 5 minutes by editing your user's crontab on www-slave1:<source>*/5 * * * * rsync -e "ssh -i ~/.ssh/id_rsa_wwwsync" -au --exclude="nextcloud" asmith15@10.3.45.11:/var/www/html/* /var/www/html
*/5 * * * * rsync -e "ssh -i ~/.ssh/id_rsa_wwwsync" -au --exclude="nextcloud" /var/www/html/* asmith15@10.3.45.11:/var/www/html</source>
* Test that by creating some files on www, some other files on www-slave1, and waiting more than 5 minutes.