This post may help others, who are trying to setup 2 nodes cluster for Virtual-IP, Service fail-over.
1. Install basic packages from repository
Code:
#yum install pacemaker corosync
2. Generate corosync key and place the key to all the cluster nodes under /etc/corosync with 400 permission
3. Place the corosync.conf in /etc/corosync
Code:
==========================================
compatibility: whitetank
totem {
version: 2
token: 3000
token_retransmits_before_loss_const: 10
join: 60
consensus: 3600
vsftype: none
max_messages: 20
secauth: off
threads: 0
clear_node_high_bit: yes
rrp_mode: none
interface {
ringnumber: 0
bindnetaddr: network_address (This ip range need to be change according to your network setup)
mcastaddr: 226.94.1.1 (Change the IP based on #netstat -g result)
mcastport: 5405
ttl: 1
}
}
logging {
fileline: off
to_stderr: no
to_logfile: yes
to_syslog: yes
syslog_facility: daemon
logfile: /var/log/cluster/corosync.log
debug: off
timestamp: on
logger_subsys {
subsys: AMF
debug: off
tags: enter|leave|trace1|trace2|trace3|trace4|trace6
}
}
amf {
mode: disabled
}
=======================================
4. Place the pcmk under the following path /etc/corosync/service.d/
Code:
service{
# Load the Pacemaker Cluster Resource Manager
name: pacemaker
ver: 1
}
The above is pretty much enough to configure corosync, and there are no separate config file for pacemaker & openais(everything is under corosync.conf)
5. Now start the services
/etc/init.d/corosync start (corosync must start before pacemaker)
/etc/init.d/pacemaker start
6. Verify the configuration
if any errors related to stonith & quorum excute the following to avoid errors
7. Ignore the stonith
Code:
#crm configure property stonith-enabled=false
8.Ignore quorum
Code:
#crm configure property no-quorum-policy=ignore
9. For ocf scripts, Linux-ha resource-agents need to be install
Code:
#yum install resource-agents
can use some other resource agents too..
To use LSB Resource Agents
http://linux-ha.org/wiki/LSB_Resource_Agents
10. The following is the way to add and manage resources
11. Add virtual IPv4
Code:
primitive VIPv4 ocf:heartbeat:IPaddr2 \
params ip="xx.xx.xx.xx" \
nic="bond0" \
cidr_netmask="28" \
op start interval="0s" timeout="60s" \
op monitor interval="5s" timeout="20s" \
op stop interval="0s" timeout="60s"
12. Add virtual IPv6
Code:
primitive VIPv6 ocf:heartbeat:IPv6addr \
params ipv6addr="xxxx:xxxx:xx:xx:xx:xx" \
nic="bond0" \
cidr_netmask="64" \
op start interval="0s" timeout="60s" \
op monitor interval="5s" timeout="20s" \
op stop interval="0s" timeout="60s"
13. Add Apache service
Code:
primitive HTTPD ocf:heartbeat:httpd \
params configfile="/etc/httpd/conf/httpd.conf" \
port="80" \
op start interval="0s" timeout="60s" \
op monitor interval="5s" timeout="20s" \
op stop interval="0s" timeout="60s"
14. Add group
Code:
#group webserver VIPv4 VIPv6 HTTPD
15. To prevent situation when resource apache migrate to node2 and resource IP stays at node1(It happens when apache at node1 hung but network stack works well) we need to make colocation
Code:
#crm configure colocation SPEED_TEST inf: HTTPD VIPv4 VIPv6
16. To make pacemaker start up apache only after IP is set up. In other words describe start up order run:
Code:
#crm configure order START_ORDER inf: VIPv4 VIPv6 HTTPD
17. To check cluster status
Note:- If anything wrong please correct...