Skip to content

Uninstall or Reinstall ClusterControl

Reinstall

To easiest way to re-install ClusterControl is:

If you are running on MySQL, substitute "mariadb" with "mysql":

$ systemctl stop mariadb cmon cmon-ssh cmon-events cmon-cloud
$ dnf remove clustercontrol* s9s* mariadb*
$ rm -Rf /var/lib/mysql
$ rm -Rf /var/lib/cmon
$ rm -Rf /etc/s9s.conf
$ rm -Rf /root/.s9s 

If you are running on MySQL, substitute "mariadb" with "mysql":

$ systemctl stop mariadb cmon cmon-ssh cmon-events cmon-cloud
$ apt purge clustercontrol* s9s* mariadb*
$ rm -Rf /var/lib/mysql
$ rm -Rf /var/lib/cmon
$ rm -Rf /etc/s9s.conf
$ rm -Rf /root/.s9s

Then, perform the installation again using the installer script:

$ ./install-cc

Uninstall

If ClusterControl is installed on a dedicated host (i.e., not co-located with your application), uninstalling ClusterControl is pretty straightforward. It is enough to bring down the ClusterControl node and revoke the ClusterControl-related user privileges from the managed database nodes:

--- On the managed database nodes
mysql> DELETE FROM mysql.user WHERE user LIKE 'cmon%';
mysql> FLUSH PRIVILEGES;
--- On the managed database nodes
postgres=# DROP USER 'cmon*';

Then, remove all lines related to ClusterControl database users (cmon*) inside pg_hba.conf.

// Iterate over all users in the current database
db.getUsers().forEach(function(user) {
    // If the username starts with "cmon"
    if (user.user.match(/^cmon/)) {
        print("Dropping user: " + user.user);
        // Drop the user
        db.dropUser(user.user);
    }
});
# On the managed database nodes
for user in $(redis-cli ACL LIST | grep '^user cmon' | cut -d' ' -f2)
do
    echo "Deleting user: $user"
    redis-cli ACL DELUSER "$user"
done

Before removing the package, stop all cmon related services:

$ systemctl stop cmon cmon-ssh cmon-events cmon-cloud
$ service cmon stop
$ service cmon-ssh stop
$ service cmon-events stop
$ service cmon-cloud stop

If ClusterControl is installed via the Severalnines repository, use the following command to uninstall via the respective package manager:

$ yum remove -y clustercontrol* s9s*
$ sudo apt-get remove -y clustercontrol* s9s*

Remove ClusterControl-related databases and privileges:

mysql> DROP SCHEMA cmon;
mysql> DROP SCHEMA dcps;
mysql> DELETE FROM mysql.user WHERE user LIKE 'cmon%';
mysql> FLUSH PRIVILEGES;