Skip to content

ClusterControl Configuration

Configuration Files

A single cmon process is capable of managing one or more database clusters. Each of the clusters requires one exclusive configuration file residing in the /etc/cmon.d/ directory. For instance, the default cmon configuration file is located at /etc/cmon.cnf, and commonly used to store the default (minimal) configuration for the cmon process to run.

Example of the CMON main configuration file located at /etc/cmon.cnf:

# Content of /etc/cmon.cnf

mysql_port=3306
mysql_hostname=127.0.0.1
mysql_password=cm0nP4ss
hostname=10.0.0.196
logfile=/var/log/cmon.log
rpc_key=390faeffb8166277a4f25336a69efa50915635a7

For the first cluster (cluster_id=1), the configuration options should be stored inside /etc/cmon.d/cmon_1.cnf. For the second cluster, it would be /etc/cmon.d/cmon_2.cnf with cluster_id=2 respectively, and so on. The following shows an example content of cmon cluster’s configuration file located at /etc/cmon.d/cmon_4.cnf:

# Content of /etc/cmon.d/cmon_4.cnf

cluster_id=4
cmon_user=cmon
created_by_job=1
db_stats_collection_interval=30
enable_query_monitor=1
galera_vendor=percona
galera_version=3.x
group_owner=1
host_stats_collection_interval=60
hostname=10.0.0.196
logfile=/var/log/cmon_4.log
mode=controller
monitored_mountpoints=/var/lib/mysql/
monitored_mysql_port=3306
monitored_mysql_root_password='7XU@Wy4nqL9'
mysql_bindir=/usr/bin/
mysql_hostname=127.0.0.1
mysql_password='cm0nP4ss'
mysql_port=3306
mysql_server_addresses=10.0.0.99:3306,10.0.0.253:3306,10.0.0.181:3306
mysql_version=5.6
name='Galera Cluster'
os=redhat
osuser=root
owner=1
pidfile=/var/run
basedir=/usr
repl_password='9hHRgQLSsZz3Vd4a'
repl_user=rpl_user
rpc_key=3V0RaV6dE8KSyClE
ssh_identity=/root/.ssh/id_rsa
ssh_port=22
type=galera
vendor=percona

An example of cmon configuration file hierarchy is as follows:

Example cluster Configuration file Cluster identifier Log file location
Default configuration /etc/cmon.cnf N/A logfile=/var/log/cmon.log
Cluster #1 (Galera) /etc/cmon.d/cmon_1.cnf cluster_id=1 logfile=/var/log/cmon_1.log
Cluster #2 (MongoDB) /etc/cmon.d/cmon_2.cnf cluster_id=2 logfile=/var/log/cmon_2.log
Cluster #N (cluster type) /etc/cmon.d/cmon_N.cnf cluster_id=N logfile=/var/log/cmon_N.log

Note

It’s highly recommended to separate cmon logging for each cluster to its own log file. In the above example, we can see that cluster_id and logfile are two important configuration options to distinguish the cluster.

The ClusterControl Controller will import the configuration options defined in each configuration file into the CMON database during the process starts up. Once loaded into the runtime configuration, cmon uses all of these information to manage the database clusters accordingly.

Runtime configuration

The runtime configuration is considered the active configuration and can be viewed via ClusterControl GUI by going to ClusterControl → choose a database cluster → Settings → Runtime Configuration or by using the ClusterControl CLI:

s9s cluster --list-config --cluster-id=1

For list of all configuration options, see Configuration Options.

Applying configuration changes

It is worth noting that ClusterControl configuration options can be set in multiple ways. This can be done by the following approaches:

  • Editing the file /etc/cmon.d/cmon_X.cnf, where X is the cluster id of your cluster. Although this approach is not recommendable and strongly discouraged.
  • Via the web UI by going to ClusterControl → choose a database cluster → Settings → System settings. Then search for the desired parameter you plan to change and click on the pencil icon to modify the value.
  • Using s9s cluster command. For example:

    s9s cluster \
        --change-config \
        --cluster-id=25 \
        --opt-name=replication_pre_failover_script \
        --opt-value="/root/check_before_failover.sh"
    

There are certain variables that upon changes via runtime, shall reflect immediately. However, it is strongly recommended that you have to restart the cmon daemon whenever you apply changes to the configuration options.

For list of all configuration options, see Configuration Options.