I will show you in this tutorial how to install your first cluster Corosync and the Linux Cluster Manager Pacemaker.
Let me give small definitions about Corosync and Pacemaker.
The Corosync Cluster Engine is an open source project licensed under the new BSD License derived from the OpenAIS project. The mission of the Corosync effort is to develop, release, and support a community-defined, open source cluster executive for use by multiple open source and commercial cluster projects or products.
Pacemaker is open source high availability resource manager software used on computer clusters since 2004. Until about 2007, it was part of the Linux-HA project, then was split out to be its own project.
CRM Shell is a software to manage pacemaker resources.
Server:
node1: Centos 6.5 IP= 192.168.1.110 node2: Centos 6.5 IP=192.168.1.111 Selinux=Permissive Iptables add ports: (5404-5405)
add node1 and node2 to your /etc/hosts file.
Add the HA Clustering Repo to your Linux Centos nodes
vi /etc/yum.repos.d/ha-clustering.repo
add
[haclustering]
name=HA Clustering
baseurl=http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/
enabled=1
gpgcheck=0
Install the package on both nodes (node1 and node2):
yum install pacemaker corosync crmsh
If you have any dependencies issues about /sbin/xfs . please install it from here:
rpm -ivh http://mirror.centos.org/centos/5/centosplus/i386/RPMS/xfsprogs-2.9.4-1.el5.centos.i386.rpm
Use this Configuration and edit your IP adresses:
/etc/corosync/corosync.conf
compatibility: whitetank aisexec { # Run as root - this is necessary to be able to manage resources with Pacemaker user: root group: root } service { # Load the Pacemaker Cluster Resource Manager ver: 1 name: pacemaker use_mgmtd: no use_logd: no } totem { version: 2 #How long before declaring a token lost (ms) token: 5000 # How many token retransmits before forming a new configuration token_retransmits_before_loss_const: 10 # How long to wait for join messages in the membership protocol (ms) join: 1000 # How long to wait for consensus to be achieved before starting a new # round of membership configuration (ms) consensus: 7500 # Turn off the virtual synchrony filter vsftype: none # Number of messages that may be sent by one processor on receipt of the token max_messages: 20 # Stagger sending the node join messages by 1..send_join ms send_join: 45 # Limit generated nodeids to 31-bits (positive signed integers) clear_node_high_bit: yes # Disable encryption secauth: off # How many threads to use for encryption/decryption threads: 0 # Optionally assign a fixed node id (integer) # nodeid: 1234interface { interface { ringnumber: 0 member { memberaddr: 192.168.1.110 } member { memberaddr: 192.168.1.111 } bindnetaddr: 192.168.1.0 (netwokip) mcastaddr: 226.94.1.1 mcastport: 5405 ttl: 1 } } logging { fileline: off to_stderr: no to_logfile: yes to_syslog: yes logfile: /var/log/cluster/corosync.log debug: off timestamp: on logger_subsys { subsys: AMF debug: off } } amf { mode: disabled }
Generate corosync Authentication key with :
The key will be generated to /etc/corosync/
[root@node1 ~]# corosync-keygen Corosync Cluster Engine Authentication key generator. Gathering 1024 bits for key from /dev/random. Press keys on your keyboard to generate entropy. Press keys on your keyboard to generate entropy (bits = 64). Press keys on your keyboard to generate entropy (bits = 128). Press keys on your keyboard to generate entropy (bits = 192). Press keys on your keyboard to generate entropy (bits = 256). Press keys on your keyboard to generate entropy (bits = 320). Press keys on your keyboard to generate entropy (bits = 392). Press keys on your keyboard to generate entropy (bits = 456). Press keys on your keyboard to generate entropy (bits = 520). Press keys on your keyboard to generate entropy (bits = 592). Press keys on your keyboard to generate entropy (bits = 656). Press keys on your keyboard to generate entropy (bits = 728). Press keys on your keyboard to generate entropy (bits = 800). Press keys on your keyboard to generate entropy (bits = 864). Press keys on your keyboard to generate entropy (bits = 928). Press keys on your keyboard to generate entropy (bits = 992). Writing corosync key to /etc/corosync/authkey. [root@node1 ~]#
scp /etc/corosync/* root@node2:/etc/corosync/
Edit on node2 /etc/corosync/corosync.conf with the node2 IP address
Start corosync and pacemaker on both machines.
service corosync start Starting Corosync Cluster Engine (corosync): [ OK ] service pacemaker start Starting Pacemaker Cluster Manager [ OK ]
Check Linux Cluster Status:
# crm status Last updated: Thu Mar 6 04:58:10 2014 Last change: Wed Mar 5 15:22:54 2014 via crmd on node1 Stack: classic openais (with plugin) Current DC: node2 - partition with quorum Version: 1.1.10-14.el6_5.2-368c726 2 Nodes configured, 2 expected votes 0 Resources configured Online: [ node1 node2 ]