High Availability cluster in Linux
1. Highly available clusters are simple
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/85/03/wKioL1eZrQvgMrjlAAB9HRK7wVo857.jpg-wh_500x0-wm_3 -wmp_4-s_221954575.jpg "title=" 1.jpg "alt=" Wkiol1ezrqvgmrjlaab9hrk7wvo857.jpg-wh_50 "/>
1.1.Messaging Layer: The main collection node of the transaction resources Heartbeat and other information, respectively, there are the following:
HeartbeatV1 heartbeatV2 heartbeatV3
Corosync
Cman
Keepalived
Ultramokey
1.2.crm:cluster Resourse Manager manages the resources collected by the messaging layer, respectively, in the following ways:
Heartbeat v1 comes with a resource manager: Haresources
Heartbeat v2 comes with Explorer: Haresources and CRM
Heartbeat V3: Resource Manager CRM developed as a standalone project, pacemaker
1.3.ra:resource Agent, Resource agent, by LSB compliant script (start,stop,restart,status)
The main feature is that the CRM Resource manager allocates the resources to be executed by RA
RA Classes:ra Type
Legacy Heartbeat v1 RA
LSB (/etc/rc.d/init.d/)
OCF (Open Cluster Framework): With Pacemaker and Linbit (DRBD)
STONITH Isolation
Resource Type: Resource type
Primitive: Basic type
Clone: Clone
Group: Groups
MASTER/SLAVE:DRBD, master-slave relationship running on two nodes
Resource stickiness: The degree to which a resource depends on a point, defined by score
Resource constraint: Constraint
Position constraint location: The degree of resource-to-node inclination
Permutation constraint coloation: inter-resource dependency
Sequential constraint order: The order in which the resource takes action
2. Highly Available clusters
2.1. Three basic requirements
Recommendations for name resolution between nodes are written under the/etc/hosts file
SSH communication between nodes, it is recommended to use key authentication
Time synchronization between nodes recommended using NTP server
2.2. Three configuration files:
Authkeys: Key file, 600,
Configuration of the Ha.cf:heartbeat service
Haresources: Resource Management configuration file
3. The background of this experiment: the dual cluster node is node1.willow.com,ip 1.1.1.18 node2.willow.com,ip for 1.1.1.19
The node1.willow.com host is configured as follows: (all the same as the node2.willow.com cluster configuration)
3.1. Installing the HA cluster package
#yum--nogpgcheck Localinstall perl-mailtools-1.77-1.el5.noarch.rpm
#yum--nogpgcheck Localinstall heartbeat-2.1.4-9.el5.i386.rpm heartbeat-gui-2.1.4-9.el5.i386.rpm heartbeat-pils-2.1.4-10.el5.i386.rpm heartbeat-stonith-2.1.4-10.el5.i386.rpm libnet-1.1.4-3.el5.i386.rpm
#cd/usr/share/doc/heartbeat-2.1.4/
#cp-P Authkeys ha.cf haresources/etc/ha.d/
#chmod Authkeys
#cd/etc/ha.d/
3.2.vim Authkeys #新增如下內容:
Auth 1
1 MD5 willow! #其中willow is the salts that MD5 needs.
3.3.vim ha.cf #修改成如下內容:
Logfacilitylocal0
KeepAlive 1
Bcasteth0# Linux
Auto_failback on
Nodenode1.willow.com
Nodenode2.willow.com
Ping 1.1.1.144
3.3.vim haresources #修改成如下內容:
Node1.willow.com Ipaddr::1.1.1.100/24/eth0 httpd
#yum-y Install httpd
#echo "1.willow.com
#chkconfig httpd off
#setenforce 0
#iptalbes-F
The 3.4.node2.willow.com host modifies only the following sections (others are identical to the node1.willow.com cluster configuration, omitted)
#echo "2.willow.com
3.5. Simple Cluster Test:
Under the node1.willow.com host:
#serivce Heartbeat Start
#ssh Node2 ' serivce heartbeat start '
#tail-F/var/log/messages #看日志
At this point, you can see the effect through Web Access VIP1.1.1.100
#cd/usr/lib/heartbeat
#./ha_stanby #模拟node1节点掉线, the web automatically goes to the Node2 node for service
At this point the Web Access to the VIP1.1.1.100 and look at the effect
3.6. Share Web content via NFS server 1.1.1.20 the third Linux host, then cluster test
To turn on NFS sharing on a 1.1.1.20 host:
#mkdir-pv/web/ha
#echo "
#vim/etc/exports
/web/ha 1.1.1.0/24 (RO)
#service NFS Start
#service Portmap Start
On the Node1 host: Stop the Heartbeat service
#ssh Node2 ' serivce heartbeat Stop '
#serivce Heartbeat Stop
On Node1 and Node2 two hosts: same-in-the-Go modification haresources file
#vim haresources #修改如下内容
node1.willow.com Ipaddr::1.1.1.100/24/eth0 Filesystem::1.1.1.20:/web/ha::/var/www/html::nfs httpd
Again on the Node1 host: Start the heartbeat service
#serivce Heartbeat Start
#ssh Node2 ' serivce heartbeat start '
#tail-F/var/log/messages #看日志
At this point, you can see the effect through Web Access VIP1.1.1.100
#cd/usr/lib/heartbeat
#./ha_stanby #模拟node1节点掉线, the web automatically goes to the Node2 node for service
At this point the Web Access to the VIP1.1.1.100 and look at the effect
will continue to update this blog .....
This article is from the "Xavier Willow" blog, please be sure to keep this source http://willow.blog.51cto.com/6574604/1831812
High Availability cluster in Linux