Wednesday, 31 August 2016

Install and Configure Linux High-Availability Cluster tool "Pacemaker"

This example is based on the environment like follows. Configure basic cluster environment on here.

DB1:10.20.9.60(db1)

DB2:10.20.9.61(db2)

Install Pacemaker like follows on all Nodes.

[root@db1 ~]# yum -y install pacemaker pcs

[root@db1 ~]# systemctl start pcsd 

 

[root@db1 ~]# systemctl enable pcsd

# set password for cluster admin user

 

[root@db1 ~]# passwd hacluster 

Changing password for user hacluster.

New password:

Retype new password:

passwd: all authentication tokens updated successfully.

 

[2] Configure like follows on a Node.

 

# establish authorization

 

[root@db1 ~]# pcs cluster auth db1 db2 

Username: hacluster 

Password:

db1: Authorized

db2: Authorized

# configure cluster

 

[root@db1 ~]# pcs cluster setup --name ha_cluster db1 db2 

Shutting down pacemaker/corosync services...

Redirecting to /bin/systemctl stop pacemaker.service

Redirecting to /bin/systemctl stop corosync.service

Killing any remaining services...

Removing all cluster configuration files...

db1: Succeeded

db2: Succeeded

# start srvices for cluster

 

[root@db1 ~]# pcs cluster start --all 

db2: Starting Cluster...

db1: Starting Cluster...

# enable cluster

 

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

db1: Cluster Enabled

db2: Cluster Enabled

# show status

 

[root@db1 ~]# pcs status cluster

Cluster Status:

 Last updated: Wed Aug 31 11:28:19 2016         Last change: Wed Aug 31 06:17:00 2016 by root via cibadmin on db1

 Stack: corosync

 Current DC: db2 (version 1.1.13-10.el7_2.4-44eb2dd) - partition with quorum

 2 nodes and 1 resource configured

 Online: [ db1 db2 ]

PCSD Status:

  db1: Online

  db2: Online

 

 

[root@db1 ~]# pcs status corosync

Membership information

----------------------

    Nodeid      Votes Name

         1          1 db1 (local)

         2          1 db2

 

 

No comments:

Post a Comment