How to Install and Start Redhat Cluster
In the first part, we explained in detail on how to install and configure 2 Node RedHat Cluster.
We covered the following high-level steps in the previous tutorial:
- Install and start RICCI cluster service
- Create cluster on active node
- Add a node to cluster
- Add fencing to cluster
- Configure failover domain
- Add resources to cluster
In this tutorial, we’ll cover the following high-level steps to finish the cluster setup:
- Sync cluster configuration across nodes
- Start the cluster
- Verify failover by shutting down an active node
1. Sync Configurations across Nodes
Anytime a configuration change is made, or the 1st time when you are installing and configuring the cluster, you should sync the configurations from active node to all the nodes.
The following command will sync the cluster configurations to all the available nodes:
[[email protected] ~]# ccs -h rh1 --sync --activaterh2 password:
2. Verify Cluster Configuration
Finally, verify that the configurations are valid as shown below.
[[email protected] ~]# ccs -h rh1 --checkconfAll nodes in sync.
If there are any configuration issues, or when the configurations on the active node does not match the configurations on all the nodes in the cluster, the above command will list them appropriately.
3. Verify Cluster Failover
To verify the failover of the cluster, stop the cluster on active node or shut-down the active node. This should force the cluster to automatically failover the IP resource and filesystem resource to the next available node defined in the failover domain.
This is what we currently see on the node1.
[[email protected] ~]# clustatCluster Status for mycluster @ Sat Mar 15 14:16:00 2015Member Status: Quorate Member Name ID Status ------ ---- ---- ------ rh1 1 Online, Local, rgmanager rh2 2 Online, rgmanager Service Name Owner (Last) State ------- ---- ----- ------ ----- service:webservice1 rh1 started[[email protected] ~]# hostnamerh1.mydomain.net[[email protected] ~]# ip addr show1: lo: mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:e6:6d:b7 brd ff:ff:ff:ff:ff:ff inet 192.168.1.10/24 brd 192.168.1.255 scope global eth0 inet 192.168.1.12/24 scope global secondary eth0 inet6 fe80::a00:27ff:fee6:6db7/64 scope link valid_lft forever preferred_lft forever[[email protected] ~]# df -h /var/wwwFilesystem Size Used Avail Use% Mounted on/dev/mapper/cluster_vg-vol01 993M 18M 925M 2% /var/www
4. Start the Cluster
To start the cluster on Node1, do the following:
[[email protected] ~]# ccs -h rh1 –start
To start cluster on both the nodes, do the following:
[[email protected] ~]# ccs -h rh1 –startall
To stop the cluster on Node1, do the following:
[[email protected] ~]# ccs -h rh1 –stop
To stop cluster on both the nodes, do the following:
[[email protected] ~]# ccs -h rh1 –stopall
5. View Cluster Status
When everything is up and running in your Redhat or CentOS Linux Cluster, you can view the cluster status as shown below:
[[email protected] cluster]# clustatCluster Status for mycluster @ Sat Mar 15 02:05:59 2015Member Status: Quorate Member Name ID Status ------ ---- ---- ------ rh1 1 Online, Local, rgmanager rh2 2 Online Service Name Owner (Last) State ------- ---- ----- ------ ----- service:webservice1 rh1 started
As you see in the above output, it indicates that there are two nodes in our cluster, and both the nodes are online, and and rh1 is the active node.
6. Force Cluster Failover
Now bring down the node1, and all the service and resource should failover to second node and you will see like the below output.
[[email protected] ~]# shutdown -h now
After the node1 is down, the following is what you’ll see on the node1.
[email protected] ~]# clustatCluster Status for mycluster @ Sat Mar 18 14:41:23 2015Member Status: Quorate Member Name ID Status ------ ---- ---- ------ rh1 1 Offline rh2 2 Online, Local, rgmanager Service Name Owner (Last) State ------- ---- ----- ------ ----- service:webservice1 rh2 started
The above output indicates that there are two nodes in the cluster (rh1 and rh2). rh1 is down, and currently rh2 is the active node.
Also, as you see below, on rh2, the filesystem and the ip-address got failover from rh1 without any issues.
[[email protected] ~]# df -h /var/wwwFilesystem Size Used Avail Use% Mounted on/dev/mapper/cluster_vg-vol01 993M 18M 925M 2% /var/www[[email protected] ~]# ip addr show1: lo: mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever2: eth0: mtu 1500 qdisc pfifo_fast state UP ql en 1000 link/ether 08:00:27:e6:6d:b7 brd ff:ff:ff:ff:ff:ff inet 192.168.1.11/24 brd 192.168.1.255 scope global eth0 inet 192.168.1.12/24 scope global secondary eth0 inet6 fe80::a00:27ff:fee6:6db7/64 scope link tentative dadfailed valid_lft forever preferred_lft forever
7. Full Working cluster.conf Example File
The following the final working cluster.conf configuration file for a 2 node redhat cluster.
[[email protected] ~]# cat /etc/cluster/cluster.conf
>