Create a high availability cluster

You can create a Red Hat High Availability Add-On cluster. This example uses nodes z1.example.com and z2.example.com.

Before you begin

  • You have created a Red Hat account. Note

    To display the parameters of a pcs command and a description of those parameters, use the -h option of the pcs command.

Procedure

  1. Authenticate the pcs user hacluster for each node in the cluster on the node from which you will be running pcs.
    [root@z1 ~]# pcs host auth z1.example.com z2.example.com
    Username: hacluster
    Password:
    z1.example.com: Authorized
    z2.example.com: Authorized

    This command authenticates user hacluster on z1.example.com for both of the nodes in a two-node cluster that will consist of z1.example.com and z2.example.com.

  2. Run the following command from the z1.example.com node to create the two-node cluster my_cluster that consists of nodes z1.example.com and z2.example.com:
    [root@z1 ~]# pcs cluster setup my_cluster --start z1.example.com z2.example.com

    This will propagate the cluster configuration files to both nodes in the cluster. This command includes the --start option, which will start the cluster services on both nodes in the cluster.

  3. Enable the cluster services to run on each node in the cluster when the node boots:
    Note

    For your particular environment, you can skip this step by keeping the cluster services disabled. If enabled and a node goes down, any issues with your cluster or your resources are resolved before the node rejoins the cluster. If you keep the cluster services disabled, manually start the services when you reboot a node by running the pcs cluster start command on that node.

    [root@z1 ~]# pcs cluster enable --all

Results

  • Display the status of the cluster you created:
    [root@z1 ~]# pcs cluster status
    Cluster Status:
     Stack: corosync
     Current DC: z2.example.com (version 2.0.0-10.el8-b67d8d0de9) - partition with quorum
     Last updated: Thu Oct 11 16:11:18 2018
     Last change: Thu Oct 11 16:11:00 2018 by hacluster via crmd on z2.example.com
     2 Nodes configured
     0 Resources configured
    ...

    There could be a slight delay before the cluster is up and running when you start the cluster services with the --start option of the pcs cluster setup command. Ensure that the cluster is up and running before performing any subsequent actions.