AUTOM8N Cluster Installation

AUTOM8N Cluster offers clustering and Load Balancing of the web applications deployed on a cPanel server. The cluster setup comprise of a single cPanel master node and one or more cPanel DNS only slave nodes(cPanel DNS only is a free product from cpanel).

AUTOM8N replicates /home, /var/lib/mysql and the necessary config files and setup a DNS Load-Balancer to distribute traffic and failover

Warning

Unison FileSync delay increases with filesystem size and therefore /home of size more than 256 GB is not recommended

Note

setup lsphp(mod_lsapi) on Apache to be used in AUTOM8N Cluster https://autom8n.com/howtos/autom8n_cluster_on_cloudlinux.html

AUTOM8N Cluster Prerequisites

  1. cPanel full version installed on the master server and cPanel DNS only installed on all slaves

  2. MariaDB 10.x ( Upgrade to MariaDB,preferably the latest version fom WHM )

  3. CSF firewall installed and enabled on all servers in cluster . The setup will fail if CSF firewall is not installed prior to setup

  4. The master server should be able to login as root to all slaves without a password. Setup ssh key of the master on all slaves

Note

There should not be any external firewalls blocking TCP/UDP port between the master server and slaves as this cause setup to fail

Note

The hostname should not change after setup as this breaks cluster synchronization

Setting up the cluster

Setup Autom8n standalone on the master server https://autom8n.com/docs/installation_standalone.html

Add cluster slave details

You can fill in the details of the first slave server and save the settings.

Note that the Slave Main IP and Slave DB IP will be same on most setup, unless you have a LAN interface to have the mysql replication setup. If in doubt fill in the slaves main IP on both fields

Add additional slave details

You can add additional slave servers and additional home directories like home2, home3 etc to be synced by the Unison filesync . Additional slaves can be setup anytime in the life cycle of a cluster for horizontal scalability

Run the Cluster setup Ansible playbook

cd /opt/nDeploy/conf/nDeploy-cluster
ansible-playbook -i ./hosts cluster.yml

cPanel Horizontal scaling . Adding more web servers

You can add more servers to the cluster anytime from the WHM Autom8n plugin user interface

Remove MySQL dump lock so that MySQL replication can be setup on the new slaves

rm -f /opt/nDeploy/conf/XTENDWEB_MYSQL_DUMP_LOCK_DO_NOT_REMOVE

Run the Cluster setup Ansible playbook

cd /opt/nDeploy/conf/nDeploy-cluster
ansible-playbook -i ./hosts cluster.yml

The one extra thing you need to do if you are adding additional servers or if you are setting up AUTOM8N cluster on an existing cPanel server with accounts and database’s already present is apply the necessary grants for the slave servers

mysqlaccess

Grants can be setup from Home »SQL Services »Additional MySQL Access Hosts section in WHM. Click on the “click here” link to setup additional grants required for the slaves

Testing domain on cluster setup

Since the web application runs on multiple servers that are independent of each other there is a chance that one of the server is not serving page correctly and this goes unnoticed because of round robin DNS

To test individual servers do

curl -v -I https://domain.com --resolve "domain.com:443:xxx.xxx.xxx.xxx"
# Where xxx.xxx.xxx.xxx is the master or slave servers IP that you need to test

Cluster Administration scripts

/opt/nDeploy/scripts/cluster_home_ensure_all.py
# Ensures the users and shell is in sync

/opt/nDeploy/scripts/cluster_dns_ensure_all.sh
#Ensure DNS changes are uptodate

/opt/nDeploy/scripts/cluster_sync_rpms.sh
#Ensure the entire LEMP stack is in sync
# Note that this does not include manually installed pecl modules etc

/opt/nDeploy/scripts/fix_unison_filesync.py restart|reset
# Reset starts unison cluster from scratch,so use it rarely if
# unison is not starting up
# restart as the name implies restarts Unison