Pacemaker, is a cluster resource manager. It enables node and resource level failure detection and recovery of the maximum Availability Cluster service (also known as resource management) using the messaging and membership capabilities provided by your preferred cluster infrastructure (Openais or Heaerbeat).
It can do clusters of any size and comes with a robust dependency model that enables administrators to accurately express the relationships between cluster resources (including order and location). Almost any script that can be scripted can be administered as part of a pacemaker cluster.
Features of Pacemaker:
Host and application-level fault detection and recovery
Support for virtually any redundant configuration
Supports multiple cluster configuration modes at the same time
Configuration policy handles quorum loss (when multiple machines fail)
Support app startup/shutdown sequence
Supported, must/must run on the same machine application
Applications that support multiple modes (such as master/slave)
You can test for any failure or cluster status
Primitive (native): basic resources, raw resources
Group: Resource Group
Clone: Clones the resource (which can be run on multiple nodes at the same time) before cloning is defined as primitive. Mainly includes stonith and clustered file system (cluster filesystem)
Master/slave: master-slave resources such as Drdb
Lsb:linux tables in the library, typically located in the/etc/rc.d/init.d/directory support Start|stop|status and other parameters of the service script are LSB
Ocf:open cluster framework, open cluster architecture
Heartbeat:heartbaet V1 Version
Stonith: Designed for configuring Stonith devices
172.25.85.2 server2.example.com (1024)
172.25.85.3 server3.example.com (1024)
1. SERVER2/3:
/etc/init.d/ldirectord stop
Chkconfig Ldirectord off
Yum Install Pacemaker-y
Rpm-q Corosync
Server2:
Cd/etc/corosync
CP Corosync.conf.example corosync.conf
Vim/etc/corosync/corosync.conf
Bindnetaddr:172.25.85.0service {Name:pacemaker ver:0}
scp/etc/corosync/corosync.conf [Email protected]:/etc/corosync/
/etc/init.d/corosync start
CRM_VERIFY-LV # #检测配置文件是否正确
Server3:
/etc/init.d/corosync start
Tail-f/var/log/messages
2. Server2:
Yum Install crmsh-1.2.6-0.rc2.2.1.x86_64.rpm pssh-2.3.1-2.1.x86_64.rpm
Crm
CRM (Live) configure# Property No-quorum-policy=ignore # #将修改同步到其他节点crm (live) configure# commit
Vim/etc/httpd/conf/httpd.conf
<Location/server-status> SetHandler server-status Order Deny,allow deny from all to 127.0.0.1&L T;/location>
Crm
CRM (Live) configure# primitive VIP OCF:HEARTBEAT:IPADDR2 params ip=172.25.85.100 CRM (live) configure# primitive VIP OCF: HEARTBEAT:IPADDR2 params ip=172.25.85.100 cidr_netmask=32 op monitor interval=30s primitive website ocf:heartbeat: Apache params configfile=/etc/httpd/conf/httpd.conf op monitor interval=60s CRM (live) configure# commit
You can use Crm_mon to view:
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/85/72/wKioL1ejfJGDQRR9AAB7IQUmmvQ916.png-wh_500x0-wm_3 -wmp_4-s_985027548.png "title=" screenshot from 2016-07-24 09-56-22.png "alt=" Wkiol1ejfjgdqrr9aab7iqummvq916.png-wh_ "/>
CRM (Live) configure# collocation website-with-ip inf:website VIP # #将这两个资源整合到一个主 On-Machine
CRM (Live) configure# commit
CRM (live) configure# Delete Website-with-ip
CRM (Live) configure# commit
CRM (live) configure# Group Apache VIP website # #创建一个资源组apac He
CRM (Live) configure# commit
Crm_mon
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/85/72/wKiom1ejfOGSrN-2AAA6JZcWG3A607.png-wh_500x0-wm_3 -wmp_4-s_3614475291.png "title=" screenshot from 2016-07-24 10-11-25.png "alt=" Wkiom1ejfogsrn-2aaa6jzcwg3a607.png-wh _50 "/>
CRM (Live) node# Showserver2.example.com:normalserver3.example.com:normalcrm (live) node# standby server2.example.com
CRM (Live) resource# stop Apache CRM (live) resource# Show Resource Group:apache VIP (OCF::HEARTBEAT:IPADDR2): Stop PED website (ocf::heartbeat:apache): Stoppedcrm (live) configure# delete Apache CRM (live) configure# Delete websit eCRM (live) configure# commit
Note
To delete a resource:
CRM (Live) resource# stop website
CRM (live) configure# Delete website
Server3:
Yum Install crmsh-1.2.6-0.rc2.2.1.x86_64.rpm pssh-2.3.1-2.1.x86_64.rpm
Vim/etc/httpd/conf/httpd.conf
<Location/server-status> SetHandler server-status Order Deny,allow deny from all to 127.0.0.1&L T;/location>
Crm_mon # #
3. True on-machine: Systemctl start Fence_virtd.service
Server2:
Stonith_admin-i
Stonith_admin-m-A FENCE_XVM
Crm
CRM (Live) configure# property stonith-enabled=true
Primitive vmfence STONITH:FENCE_XVM params pcmk_host_map= "server2.example.com:ricci1;server3.example.com: HEARTBEAT1 "OP Monitor interval=1min
Primitive SqlData OCF:LINBIT:DRBD params drbd_resource=sqldata op monitor interval=30s
Ms Sqldataclone SqlData Meta master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
CRM (Live) configure# commit
Crm_mon
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/85/72/wKioL1ejfd2R6InsAABCTa7S7es681.png-wh_500x0-wm_3 -wmp_4-s_1739394688.png "title=" screenshot from 2016-07-24 11-16-57.png "alt=" Wkiol1ejfd2r6insaabcta7s7es681.png-wh _50 "/>
Primitive Sqlfs ocf:heartbeat:Filesystem params device=/dev/drbd1 directory=/var/lib/mysql FSTYPE=EXT4
colocation SQLFS_ON_DRBD Inf:sqlfs Sqldataclone:master
Order Sqlfs-after-sqldata Inf:sqldataclone:promote Sqlfs:start
CRM (Live) configure# commit
Crm_mon
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/85/72/wKiom1ejfiGBAIs2AABQxYsBI4A692.png-wh_500x0-wm_3 -wmp_4-s_806411851.png "title=" screenshot from 2016-07-24 11-19-31.png "alt=" Wkiom1ejfigbais2aabqxysbi4a692.png-wh_ "/>
CRM (Live) configure# primitive MySQL lsb:mysqld op monitor interval=30scrm (live) configure# group MyGroup VIP Sqlfs Mysqlin Fo:resource references in COLOCATION:SQLFS_ON_DRBD updatedinfo:resource references in Order:sqlfs-after-sqldata Updated
CRM (Live) configure# commit
Crm_mon
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/85/72/wKioL1ejfkTgSt4wAABnEyLkYiU232.png-wh_500x0-wm_3 -wmp_4-s_906286028.png "title=" screenshot from 2016-07-24 11-28-34.png "alt=" Wkiol1ejfktgst4waabneylkyiu232.png-wh_ "/>
CRM (Live) resource# refresh MyGroup
Server3:
Crm_mon # #监控节点状态
The pacemaker of the enterprise