SME File Fabric HA Web Replication
The information in this document is provided on an as-is basis. You use it at your own risk. We accept no responsibility for errors or omissions, nor do we have any obligation to provide support for implementing or maintaining the configuration described here. Furthermore, we do not warrant that the design presented here is appropriate for your requirements.
SME designs, implements and supports HA File Fabric solutions for customers on a paid professional services basis. For more information please contact email@example.com
As part of the setup and configuration of the multiple web frontend servers, automatic replication of branding and configuration changes was implemented. This implementation involves replication of the configuration from the web servers to the primary database server as both backup and to serve as a repo for the other web servers to pull changes from.
This is implemented as a cron job that runs every 5 minutes. As such when making changes to branding or the configuration as appladmin, changes will take 10-15 minutes to show on each webserver depending on when changes are commited.
Note: When making changes to branding or config options as appladmin use only one webserver and wait for the changes to be replicated before attempting to make changes on a different webserver.
Master Database Server Setup
The Master Database server will hold the repository of branding and configuration. This will serve as the checking point for the web frontends. The files are stored in the user smeconfiguser in the location /home/smeconfiguser/smewebconfigs
Log into smesql01 (from HA Setup example or primary db server)
As user smeconfiguser:
mkdir smewebconfigs/ mkdir smewebconfigs/config
On each of the webservers the following should be repeated to create a cron job. This task will replicate changes to/from the folder created in the previous step on smesql01.
As the root user on each webserver:
Create a ssh key and copy to smesql01
ssh-keygen -f ~/.ssh/id_rsa -q -P "" ssh-copy-id smeconfiguser@<smesql01>
* Substitute the ip address or FQDN of smesql01 below.
Update rsync and create directory for replication script:
yum install -y rsync mkdir replication
Create the file replication/replicateFiles.sh with:
Paste the following into the vi session by pressing “i”. When finished press ESC, then “:wq” to save the file. Ensure that the storage= is set to the IP address or FQDN of smesql01
#!/bin/bash sleep $(( ( RANDOM % 20 ) + 1 )) storage="<smesql01>" /bin/rsync -rtu -e "ssh" /var/www/smestorage/public_html/config.inc.php smeconfiguser@$storage:~/smewebconfigs/config/ /bin/rsync -rtu -e "ssh" /var/www/smestorage/public_html/SMELICENSE.lic smeconfiguser@$storage:~/smewebconfigs/config/ /bin/rsync -rtu -e "ssh" /var/www/smestorage/public_html/templates/company smeconfiguser@$storage:~/smewebconfigs/ /bin/rsync -rtogu --chown=smestorage:smestorage --chmod=740 -e "ssh" smeconfiguser@$storage:~/smewebconfigs/config/config.inc.php /var/www/smestorage/public_html/config.inc.php /bin/rsync -rtogu --chown=smestorage:smestorage --chmod=644 -e "ssh" smeconfiguser@$storage:~/smewebconfigs/config/SMELICENSE.lic /var/www/smestorage/public_html/SMELICENSE.lic /bin/rsync -rtogu --chown=smestorage:smestorage --chmod=644 -e "ssh" smeconfiguser@$storage:~/smewebconfigs/company/ /var/www/smestorage/public_html/templates/company/
Finally the permissions need to be modified to allow root to run the script, and crontab must be setup to run the script automatically.
chmod 700 /root/replication/replicateFiles.sh crontab -e
Once crontab is open press “i” to insert the following. When finished press ESC, then “:wq” to save the file.
*/5 * * * * /root/replication/replicateFiles.sh
Once implemented the rebanding and configuration changes will be replicated to all webservers. It is important to note that to remove branding, the desired branding will need to be manually deleted from each of the webservers as deletes are not safe to replicate. This only applies to removing branding and not updating branding with new images.