Skip to content

Quickstart

Follow these steps to quickly get ClusterControl up and running in your infrastructure.

Step 1: Install ClusterControl

On the ClusterControl host, as root or sudo user, run:

wget https://severalnines.com/downloads/cmon/install-cc
chmod +x install-cc
sudo ./install-cc

Info

All new installations come with a 30-day fully functional Enterprise edition trial license (online installation only). Once expired, ClusterControl will default to Community edition.

Example

On Ubuntu 22.04 LTS:

    $ wget https://severalnines.com/downloads/cmon/install-cc
    Resolving severalnines.com (severalnines.com)... 104.21.94.86, 172.67.221.146, 2606:4700:3034::6815:5e56, ...
    Connecting to severalnines.com (severalnines.com)|104.21.94.86|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: unspecified [text/plain]
    Saving to: ‘install-cc’
    install-cc                                [ <=>                                                                      ]  79.83K  --.-KB/s    in 0.07s
    2024-09-17 07:47:12 (1.05 MB/s) - ‘install-cc’ saved [81747]

    $ chmod +x install-cc

    $ sudo ./install-cc
    2024-09-17 07:47:17 UTC -- Installing lsb-release ...
    Reading package lists...
    Building dependency tree...
    Reading state information...
    lsb-release is already the newest version (11.1.0ubuntu4).
    lsb-release set to manually installed.
    0 upgraded, 0 newly installed, 0 to remove and 37 not upgraded.
    !!
    2024-09-17 07:47:29 UTC -- Only RHEL/RockyLinux/AlmaLinux 8|9, Debian 11|12, Ubuntu 20.04|22.04|24.04 LTS versions are supported
    2024-09-17 07:47:29 UTC -- System RAM is > 1.5G
    2024-09-17 07:47:29 UTC -- Setting MySQL innodb_buffer_pool_size to 50% of system RAM
    2024-09-17 07:47:29 UTC -- MySQL innodb_buffer_pool_size set to 1955M

    2024-09-17 07:47:29 UTC -- Severalnines would like your help improving our installation process.
    2024-09-17 07:47:29 UTC -- Information such as OS, memory and install success helps us improve how we onboard our users.
    2024-09-17 07:47:29 UTC -- None of the collected information identifies you personally.
    2024-09-17 07:47:29 UTC -- !!
    => Would you like to help us by sending diagnostics data for the installation? (Y/n): Y

    This script will add Severalnines repository server for deb and rpm packages and
    install the ClusterControl Web Applicaiton and Controller.
    An Apache and MySQL server will also be installed. An existing MySQL Server on this host can be used.

    => Enter a MySQL root password to use: 2024-09-17 08:31:53 UTC --
    => Enter the MySQL root password again:
    => Enter a CMON MySQL user password to use: 2024-09-17 08:31:58 UTC --
    => Enter the CMON user password again:

    ...
    ...

    2024-09-17 08:37:12 UTC -- ClusterControl installation completed!
    Open your web browser to https://178.62.210.68 and create a default Admin User.
    If you want to uninstall ClusterControl then please follow the instructions here, https://severalnines.com/docs/administration.html#uninstall

For more information on the installation methods, see Installation.

Step 2: Create the first admin user

Open https://<ClusterControl_host>/ in your browser to create the first admin user.

Example

ClusterControl Registration

Step 3: Set up SSH key-based authentication

Set up passwordless SSH (key-based authentication) to all target nodes. Run the following commands on the ClusterControl server:

# as root or sudo user
ssh-keygen -t rsa                                       # press Enter on all prompts
ssh-copy-id -i ~/.ssh/id_rsa {target_node_IP_address}   # repeat this for all target nodes
Note

You could also add the generated public key, ~/.ssh/id_rsa.pub to all target nodes' ~/.ssh/authorized_keys file manually.

Example
$ whoami
root

$ ssh-keygen -t rsa
$ ssh-copy-id -i /root/.ssh/id_rsa [email protected]   # db1
$ ssh-copy-id -i /root/.ssh/id_rsa [email protected]   # db2
$ ssh-copy-id -i /root/.ssh/id_rsa [email protected]   # db3
$ whoami
ubuntu

$ ssh-keygen -t rsa
$ ssh-copy-id -i /home/ubuntu/.ssh/id_rsa [email protected]   # db1
$ ssh-copy-id -i /home/ubuntu/.ssh/id_rsa [email protected]   # db2
$ ssh-copy-id -i /home/ubuntu/.ssh/id_rsa [email protected]   # db3
Note

For cloud instances, you can use the corresponding private key pair generated by the cloud provider and upload it onto the ClusterControl host and specify the physical path when configuring the SSH-related parameters in the ClusterControl GUI (deploy a cluster, import nodes, etc).

Step 4: Deploy or import database cluster/server

You can deploy a new database cluster or import an existing database cluster into ClusterControl.

Deploy or Import Cluster

# create a 3-node Galera cluster (Percona XtraDB Cluster) v8.0
$ s9s cluster --create \
    --cluster-type=galera \
    --nodes="192.168.17.101;192.168.17.102;192.168.17.103" \
    --vendor=percona \
    --provider-version=8.0 \
    --db-admin-passwd='Str0nGpa$$word' \
    --os-user=root \
    --os-key-file=/root/.ssh/id_rsa \
    --cluster-name='Percona XtraDB Cluster 8.0'

First, authenticate and store the session cookie:

curl -k 'https://<ClusterControl_host>:9501/v2/auth' \
-XPOST -d \
    '{"operation":"authenticateWithPassword",
        "user_name":"admin",
        "password":"Str0nGpa$$word"
    }' \
-c cookies.jar

Then submit the deployment job:

curl -k 'https://<ClusterControl_host>:9501/v2/jobs' \
    -XPOST -d '{
        "operation": "createJobInstance",
        "job": {
            "class_name": "CmonJobInstance",
            "job_spec": {
                "command": "create_cluster",
                "job_data": {
                    "cluster_name": "Percona XtraDB Cluster 8.0",
                    "cluster_type": "galera",
                    "config_template": "my.cnf.80-pxc",
                    "datadir": "/var/lib/mysql",
                    "db_password": "Str0nGpa55word",
                    "db_user": "root",
                    "disable_firewall": true,
                    "disable_selinux": true,
                    "enable_ssl": true,
                    "generate_token": true,
                    "install_software": true,
                    "port": "3306",
                    "ssh_keyfile": "/root/.ssh/id_rsa",
                    "ssh_port": "22",
                    "ssh_user": "root",
                    "sudo_password": "",
                    "type": "mysql",
                    "vendor": "percona",
                    "version": "8.0",
                    "nodes": [
                        {
                            "hostname": "192.168.17.101",
                            "hostname_data": "192.168.17.101",
                            "hostname_internal": "",
                            "port": "3306"
                        },
                        {
                            "hostname": "192.168.17.102",
                            "hostname_data": "192.168.17.102",
                            "hostname_internal": "",
                            "port": "3306"
                        },
                        {
                            "hostname": "192.168.17.103",
                            "hostname_data": "m192.168.17.103",
                            "hostname_internal": "",
                            "port": "3306"
                        }
                    ],
                    "with_tags": [
                        "galera",
                        "multimaster",
                        "mysql"
                    ]
                }
            }
        }
        }' \
    -b cookies.jar
resource "clustercontrol_db_cluster" "my-galera-cluster" {

    db_cluster_create = true
    db_cluster_name = "Percona XtraDB Cluster 5.7"
    db_cluster_type = "galera"
    db_version = "8.0"
    db_vendor = "percona"
    db_admin_user_password = "Str0nGpa$$word"
    db_host {
        hostname = "192.168.17.101"
    }
    db_host {
        hostname = "192.168.17.102"
    }
    db_host {
        hostname = "192.168.17.103"
    }
    ssh_key_file = "/root/.ssh/id_rsa"
    ssh_user = "root"
    db_deploy_agents = true
    disable_firewall = true
    disable_selinux = true
    db_install_software = true

}
More info

Step 5: Start managing

Use the ClusterControl GUI or CLI to monitor and manage your database cluster/server.

ClusterControl Dashboard

# list all database clusters
$ s9s cluster --list --long

# list all managed database nodes        
$ s9s node --list --long 

# scale out a cluster by adding a new node
$ s9s cluster --add-node \
    --nodes=192.168.17.104 \
    --cluster-id=1 \
    --wait

# perform a cluster rolling restart in 20 minutes
$ s9s cluster --rolling-restart \
    --cluster-id=1 \
    --schedule="$(date -d 'now + 20 min')"

List clusters and nodes (using the session cookie obtained in Step 4):

curl -k 'https://<ClusterControl_host>:9501/v2/clusters' \
    -XPOST -d '{"operation":"getAllClusterInfo"}' \
    -b cookies.jar

Trigger a rolling restart of a cluster:

curl -k 'https://<ClusterControl_host>:9501/v2/jobs' \
    -XPOST -d '{
        "cluster_id": 1,
        "job": {
            "class_name": "CmonJobInstance",
            "title": "Rolling Restart",
            "job_spec": {
                "command": "rolling_restart"
            }
        },
        "operation": "createJobInstance"
    }' \
    -b cookies.jar

See Reference Manuals → API/SDK → ClusterControl RPC API for the full list of available operations, including adding nodes.

Scale the cluster by declaring an additional db_host block and re-applying:

resource "clustercontrol_db_cluster" "my-galera-cluster" {
    # ... existing configuration from Step 4 ...
    db_host {
        hostname = "192.168.17.101"
    }
    db_host {
        hostname = "192.168.17.102"
    }
    db_host {
        hostname = "192.168.17.103"
    }
    db_host {
        hostname = "192.168.17.104"
    }
}
$ terraform apply

Terraform manages the cluster's declared topology; operational tasks like rolling restarts are not part of its resource model and should be performed through the GUI, CLI, or RPC API.

More info

Step 6: Additional resources