HomePage » LinuxHA » LinuxCorosync


Corosync and Pacamaker


Download prebuilt packages from: http://www.clusterlabs.org/rpm/ or install the repo file. Then install the software with yum:

yum -y install corosync
yum -y install pacemaker.x86_64
cd /etc/corosync
corosync-keygen
# Then copy authkey to all nodes in the cluster


Corosync.conf

This should be sufficient for a 2-node starter

# Please read the corosync.conf.5 manual page
compatibility: whitetank

totem {
	version: 2
	secauth: off
	threads: 0
	rrp_mode: active

	interface {
		ringnumber: 0
		bindnetaddr: 10.0.0.26
		mcastaddr: 226.94.1.1
		mcastport: 5405
	}
	interface {
		ringnumber: 1
		bindnetaddr: 192.168.10.1
		mcastaddr: 227.94.1.1
		mcastport: 5405
	}

}

logging {
	fileline: off
	to_stderr: no
	to_logfile: yes
	to_syslog: yes
	logfile: /var/log/corosync.log
	debug: off
	timestamp: on
	logger_subsys {
		subsys: AMF
		debug: off
	}
}

amf {
	mode: disabled
}

service {
# Load the Pacemaker Cluster Resource Manager
name: pacemaker
ver: 0
}


Load crm config

Create the following config:
primitive drbd_mysql ocf:linbit:drbd \
		params drbd_resource="r0" \
		op monitor interval="15s"
primitive fs_mysql ocf:heartbeat:Filesystem \
		params device="/dev/drbd0" directory="/data/" fstype="ext4"
primitive ip_mysql ocf:heartbeat:IPaddr2 \
		params ip="1.2.3.4" nic="eth0"
primitive mysqld lsb:mysqld

group mysql fs_mysql ip_mysql mysqld apache 
ms ms_drbd_mysql drbd_mysql \
		meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"
colocation mysql_on_drbd inf: mysql ms_drbd_mysql:Master
order mysql_after_drbd inf: ms_drbd_mysql:promote mysql:start
property $id="cib-bootstrap-options" \
		no-quorum-policy="ignore" \
		stonith-enabled="false" \
		expected-quorum-votes="2" \
		dc-version="1.0.4-2ec1d189f9c23093bf9239a980534b661baf782d" \
		cluster-infrastructure="openais"


Then load the config with crm:
# crm
crm(live)# configure
crm(live)configure# load replace /root/crmconfig
crm(live)configure# commit
crm(live)configure# quit


failover

A reboot or failure of the primary will trigger a failover, which happens automatically. To manually failover without rebooting, we can do it with the crm cli inteface:

node1>crm node
crm(live)node# standby

node2>crm resource
crm(live)resource# cleanup mysql


failback

Failback occurs when the primary node enters into the cluster. To manually failback, simply follow the failover instructions and reverse the nodes.

other crm commands

crm_mon - check cluster status
crm configure show - display cluster config

There are 3 comments on this page. [Display comments]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki