Install Controller
On standby controller host, download and install cmon controller packages. For MongoDB, download the respective cmon packages for mongodb at our download site.
Debian/Ubuntu:
$ wget http://www.severalnines.com/downloads/cmon/cmon-1.2.5-152-64bit-glibc23-mc70.tar.gz
$ tar -xzf cmon-1.2.5-152-64bit-glibc23-mc70.tar.gz -C /usr/local
$ ln -sf /usr/local/cmon-1.2.5-152-64bit-glibc23-mc70/ /usr/local/cmon
$ cp /usr/local/cmon/bin/s9s* /usr/bin
$ cp /usr/local/cmon/etc/cmon.cnf.controller /etc/cmon.cnf
$ cp /usr/local/cmon/etc/init.d/cmon /etc/init.d/
RHEL/CentOS/Fedora/Amazon Linux:
$ wget http://www.severalnines.com/downloads/cmon/cmon-controller-1.2.5-152-1.x86_64.rpm
$ yum localinstall cmon-controller-1.2.5-152-1.x86_64.rpm
Import CMON DB
CMON needs a MySQL database to run. Make sure to install MySQL server beforehand:
Debian/Ubuntu:
$ apt-get install mysql-server mysql-client
RHEL/CentOS/Fedora/Amazon Linux:
$ yum install mysql mysql-server
Once installed, create a database named 'cmon' and import the CMON schema and data files located at /usr/local/cmon/share/cmon for Debian or /usr/share/cmon for Redhat.
$ mysql -uroot -p -e 'create schema cmon'
$ mysql -uroot -p cmon < /usr/local/cmon/share/cmon/cmon_db.sql # For Redhat: /usr/share/cmon/cmon_db.sql
$ mysql -uroot -p cmon < /usr/local/cmon/share/cmon/cmon_data.sql # For Redhat: /usr/share/cmon/cmon_data.sql
**Omit -p if you have not configure MySQL root password after its installation.
Configure Controller
Open the configuration file at /etc/cmon.cnf and configure your cmon controller accordingly. You may copy the cmon configuration file from the primary ClusterControl and just change the "hostname" and "mysql_hostname" values. Here are some highlights on the configuration values:
Debian/Ubuntu:
os=debian
# type = [mysqlcluster|replication|galera]
type=galera
agentless=1
mysql_basedir=/usr/local/mysql
# mysql_hostname = Main IP for this host
mysql_hostname=192.168.0.100
#hostname is the hostname of the current host
hostname=192.168.0.100
os_user=root
# mysql servers in the cluster. "," or " " sep. list
mysql_server_addresses=192.168.0.201,192.168.0.202,192.168.0.203
wwwroot=/var/www/
RHEL/CentOS/Fedora/Amazon Linux:
os=redhat
# type = [mysqlcluster|replication|galera]
type=galera
agentless=1
mysql_basedir=/usr
# mysql_hostname = Main IP for this host
mysql_hostname=192.168.0.100
#hostname is the hostname of the current host
hostname=192.168.0.100
os_user=root
# mysql servers in the cluster. "," or " " sep. list
mysql_server_addresses=192.168.0.201,192.168.0.202,192.168.0.203
wwwroot=/var/www/html
Append following line to the end of configuration file:
enable_autorecovery=0
This to ensure the standby server will not performing automatic database cluster recovery if it detects any failure on the DB side.
Next, GRANT some privileges for cmon user on standby controller and agent hosts via mysql console:
> GRANT ALL ON *.* TO 'cmon'@'127.0.0.1' IDENTIFIED BY '<cmon password>' WITH GRANT OPTION;
> GRANT ALL ON *.* TO 'cmon'@'<Standby ClusterControl IP>' IDENTIFIED BY '<cmon password>' WITH GRANT OPTION;
Make sure you use the same cmon password for all GRANTs, as defined in /etc/cmon.cnf under cmon_password value.
Install ClusterControl UI
Use an automation script to install ClusterControl UI. On the controller host, do:
$ wget http://www.severalnines.com/downloads/cmon/setup-cc-ui.sh
$ chmod 755 setup-cc-ui.sh
$ ./setup-cc-ui.sh
Follow the instructions up until finish. You will then need to open http://<standby_ClusterControl_IP>/install to finalize the installation. Copy the API token value and CMON URL and use them to register the API on the Cluster Registration page.
Configure Database Hosts
For MySQL-based cluster, we need to GRANT some privileges for cmon user from standby host so it could pull the database stats from agent hosts. On each of the agent's host, do:
> GRANT ALL PRIVILEGES ON *.* TO 'cmon'@'<Standby ClusterControl IP>' IDENTIFIED BY '<cmon password>' WITH GRANT OPTION;
> GRANT SELECT ON mysql.* TO 'cmon'@'<Standby ClusterControl IP>' IDENTIFIED BY '<cmon password>';
> GRANT SELECT ON ndbinfo.* TO 'cmon'@'<Standby ClusterControl IP>' IDENTIFIED BY '<cmon password>';
MongoDB-based cluster can skip this step.
Start CMON
Start CMON service on the standby controller host:
$ /etc/init.d/cmon start
You can access the ClusterControl UI on the standby host at https://<standby_ClusterControl_IP>/clustercontrol. In case if the main ClusterControl is down, you can simply change the agent’s mysql_hostname value in /etc/cmon.cnf to the standby controller host. Do not forget to restart the cmon service (on agent) to apply the changes.
** You can also use our bootstrap script with --install-standby option. More details in this page.
Comments
2 comments
Thanks for sharing a useful information. kindly keep update regularly.
Installing a ClusterControl Standby Server is an essential step for enhancing the high availability and disaster recovery capabilities of your database infrastructure. The standby server acts as a backup that can automatically take over in case of a failure in the primary server, minimizing downtime professional teeth whitening stoke on trent and ensuring business continuity. To set up a standby server, the process involves deploying the ClusterControl tool, which orchestrates the replication and monitoring of the standby instance.
Please sign in to leave a comment.