Today i was working to create one Cluster between two Ubuntu machine, During that time type wrong Cluster name and created Cluster with wrong name.Although it will not effect functions of Cluster, but what would be procedure in case i need to correct this Cluster name. So in this post we will see, how we can rename pacemaker Cluster name.

To prepare things and to create test setup for this kind of activity, i have created one Cluster in Ubuntu 18.04 Machine.

SetUP

As mentioned to demonstrate cluster rename thing, we have created one test Cluster on Ubuntu 18.04 Machine.

root@srv33:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:        18.04
Codename:       bionic
root@srv33:~# uname -r
4.15.0-128-generic

With below Cluster Supporting versions.

root@srv33:~# corosync -v
Corosync Cluster Engine, version '2.4.3'
Copyright (c) 2006-2009 Red Hat, Inc.
root@srv33:~# pacemakerd --version
Pacemaker 1.1.18
Written by Andrew Beekhof
root@srv33:~# pcs --version
0.9.164

So as created cluster has wrong name(mistake in Typo), that i would like to correct it Without effecting any resource of cluster and its functions.

Cluster details

To see cluster details, we can use below commands.

To know Cluster name and other details on cluster

# pcs property list
Cluster Properties:
 cluster-infrastructure: corosync
cluster-name:  HttpClsuter
 dc-version: 1.1.18-2b07d5c5a9
 have-watchdog: false
 no-quorum-policy: ignore
 stonith-enabled: false

Same way we can get cluster details and configuration with below command.

# pcs command to show configuration details
pcs config

# crm command to know configuration details
crm config show

#pcs command to know resource details
pcs resource

In above commands output we can see Cluster name is “HttpClsuter”. So i did mistake while typing and now cluster name is wrong in configuration, that has typo mistake.
Now Cluster is full function and we don’t want to delete any resource and cluster things and also want to rename cluster with no downtime on any of resource and services provided through it.

Rename Cluster Name

To rename/Correct Cluster name in running cluster, first we need to change in /etc/corosync/corosync.conf file like below.

root@srv33:~# grep cluster_name /etc/corosync/corosync.conf
    cluster_name: HttpCluster

Once we did mentioned correct cluster name in /etc/corosync/corosync.conf file, we need to sync this to cluster configuration through pcs command like below that will make it’s entry in other nodes as well.

root@srv33:~# pcs cluster sync
srv33: Succeeded
srv36: Succeeded

With above command, whatever name we mentioned in file on this node will get in sync with another nodes as well.

But this is just static configuration, running configuration is still same.

root@srv33:~# pcs property list | grep cluster-name
 cluster-name:  HttpClsuter

To make changes in running configuration we need to make changes in running configuration as well pcs property command like below.

root@srv33:~# pcs property set cluster-name=HttpCluster --force
root@srv33:~# pcs property list | grep cluster-name
 cluster-name: HttpCluster

So now out cluster name is renamed and corrected as it should be. With above commands and details now we know how to rename Cluster name in running cluster without interrupting current configuration.