Creating the Cluster
To create the cluster:
-
Authenticate the pcs cluster configuration tool for the
hacluster
user on each node in your configuration by running the following command on one of the nodes that will form part of the cluster:sudo pcs host auth node1 node2 -u hacluster
Replace node1 and node2 with the resolvable hostnames of the nodes that will form part of the cluster.
Alternately, if the node names are not resolvable, specify the IP addresses where the nodes can be accessed, as shown in the following example:
sudo pcs host auth node1 addr=192.0.2.1 node2 addr=192.0.2.2 -u hacluster
Replace 192.0.2.1 and 192.0.2.2 with the IP addresses of each of the respective hosts in the cluster.
The tool prompts you to provide a password for the
hacluster
user. Provide the password that you set for this user when you installed and configured the Pacemaker software on each node. -
Create the cluster by using the pcs cluster setup command. You must specify a name for the cluster and the node names and IP addresses for each node in the cluster. For example, run the following command:
sudo pcs cluster setup pacemaker1 node1 addr=192.0.2.1 node2 addr=192.0.2.2
Replace pacemaker1 with an appropriate name for the cluster. Replace node1 and node2 with the resolvable hostnames of the nodes in the cluster. Replace 192.0.2.1 and 192.0.2.2 with the IP addresses of each of the respective hosts in the cluster.
Note that if you used the
addr
option to specify the IP addresses when authenticated the nodes, you do not need to specify them again when running the pcs cluster setup command.The cluster setup process destroys any existing cluster configuration on the specified nodes and creates a configuration file for the Corosync service that is copied to each of the nodes within the cluster.
You can, optionally, use the
--start
option when running the pcs cluster setup command to automatically start the cluster once it is created. -
If you have not already started the cluster as part of the cluster setup command, start the cluster on all of the nodes. To start the cluster manually, use the pcs command:
sudo pcs cluster start --all
Starting the
pacemaker
service fromsystemd
is another way to start the cluster on all nodes, for example:sudo systemctl start pacemaker.service
-
Optionally, you can enable these services to start at boot time so that if a node reboots, it automatically rejoins the cluster, for example:
sudo pcs cluster enable --all
Alternately you can enable the
pacemaker
service fromsystemd
on all nodes, for example:sudo systemctl enable pacemaker.service
Note:
Some users prefer not to enable these services so that a node failure resulting in a full system reboot can be properly debugged before it rejoins the cluster.