The heartbeat of high-availability cluster resource management based on CRM
1, the working model of the cluster:
a/p: Two nodes, working with master preparation model
N-m n>m,n nodes, M services
N-N:N nodes, N services
A/A: Dual Master Model:
2. How to transfer resources
Rgmanager:failover Domain Priority
Pacemaker
Resource stickiness:
Resource constraints (three types):
Location constraints: Resources tend to be on that node
INF: Infinity
N:
-N:
-inf: Negative Infinity
Permutation constraints: the tendency of resources to run on the same node
Inf:
-inf:
Order constraints: The starting and closing order of resources
3. How to make three resources in Web service: VIP, httpd, and filesystem running on the same node
1. Arranging constraints
2. Resource groups (resource group)
4. How to handle resources running on the current node if the node is not a member of a cluster node
Stopped: Stop
Ignore: Ignore
Freeze: Do not connect to new requests
Suicide: Kill the server
5, a resource just when the configuration is complete, whether to start
Target-role?
6. RA type
Heartbeat legacy
Lsb
OCF
STONITH
7. Resource type
Primitive,native: Master resource, can only run on one node
Group: Groups Resources
Clone: Cloning A resource
Total clones, maximum number of clones to run per node
Stonith cluster filesystem
Master/salve: Master-Slave resources
8. Distributed Lock:
/usr/lib64/heartbeat
hearsources2cib.py
9. Graphical Configuration
Ha.cf
CRM on
/usr/lib64/heartbeat/ha_propagate transferring a configuration file to another node
10. Installing the GUI
Heartbeat v2 using CRM as Ijiqun Explorer: Need to add in HA.CF
CRM on
CRM via MGMTD Integrated Monitoring 5560/tcp
The host that needs to start Hb_gui adds a password to the Hacluster user and starts with Hb_gui
With quorum: Statutory number of votes
Without quorum: no legal votes
11. Define a highly available Web service
VIP
httpd
from
to: based on it
Web Service
Vip
httpd
Nfs
Note Haresources is not compatible with CRM and is not read by CRM
Second, the configuration
1, HA.CF
[Email protected] heartbeat]# VIM/ETC/HA.D/HA.CF
Mcast eth0 225.0.100.19 694 1 0
CRM on
[Email protected] heartbeat]#/usr/lib64/heartbeat/ha_propagate
Propagating HA configuration files to node datanode4.abc.com.
HA.CF 100% 10KB 10.4kb/s 00:00
Authkeys 100% 694 0.7kb/s 00:00
Setting HA startup configuration on Node datanode4.abc.com.
2. Note that haresources is not compatible with CRM and is not read by CRM
[Email protected] heartbeat]# Mv/etc/ha.d/haresources/root
The bottom MV is Datanode4 's mainframe.
[Email protected] ha.d]# MV haresources/root/
[[Email protected] heartbeat]# service heartbeat start
LOGD is already running
Starting High-availability Services:
Done.
[[email protected] heartbeat]# ssh datanode4 ' service heartbeat start '
LOGD is already running
Starting High-availability Services:
Done.
3. View Logs
[Email protected] heartbeat]# tail-f/var/log/messages
June 16:00:29 SNN CRMD: [2223]: notice:populate_cib_nodes:Node:datanode4.abc.com (uuid:0862d824-047e-4826-9e26-21a7 603F53C8)
June 16:00:30 SNN CRMD: [2223]: notice:populate_cib_nodes:Node:snn.abc.com (uuid:6009ca6a-56eb-4d35-872e-3b8dc0fc98 51)
June 16:00:30 SNN CRMD: [2223]: info:do_ha_control:Connected to Heartbeat
June 16:00:30 SNN CRMD: [2223]: Info:do_ccm_control:CCM connection established ... waiting for first callback
June 16:00:30 SNN CRMD: [2223]: info:do_started:Delaying start, CCM (0000000000100000) not connected
June 16:00:30 SNN CRMD: [2223]: info:crmd_init:Starting Crmd ' s Mainloop
June 16:00:30 SNN CRMD: [2223]: Notice:crmd_client_status_callback:Status update:client SNN.ABC.COM/CRMD now have stat US [Online]
June 16:00:30 SNN CRMD: [2223]: Notice:crmd_client_status_callback:Status update:client SNN.ABC.COM/CRMD now have stat US [Online]
June 16:00:30 SNN CRMD: [2223]: notice:crmd_client_status_callback:Status update:client Datanode4.abc.com/crmd now ha s status [online]
June 16:00:30 SNN CIB: [2219]: Info:mem_handle_event:Got an event oc_ev_ms_new_membership from CCM
June 16:00:30 SNN CIB: [2219]: info:mem_handle_event:instance=5, nodes=2, new=2, lost=0, n_idx=0, new_idx=0, old_idx=4
June 16:00:30 SNN CIB: [2219]: info:cib_ccm_msg_callback:PEER:datanode4.abc.com
June 16:00:30 SNN CIB: [2219]: info:cib_ccm_msg_callback:PEER:snn.abc.com
June 16:00:31 SNN CRMD: [2223]: info:do_started:Delaying start, CCM (0000000000100000) not connected
June 16:00:31 SNN CRMD: [2223]: Info:mem_handle_event:Got an event oc_ev_ms_new_membership from CCM
June 16:00:31 SNN CRMD: [2223]: info:mem_handle_event:instance=5, nodes=2, new=2, lost=0, n_idx=0, new_idx=0, old_idx= 4
June 16:00:31 SNN CRMD: [2223]: Info:crmd_ccm_msg_callback:Quorum (re) attained after Event=new membership (id=5)
June 16:00:31 SNN CRMD: [2223]: Info:ccm_event_detail:NEW membership:trans=5, nodes=2, new=2, lost=0 n_idx=0, New_idx =0, old_idx=4
June 16:00:31 SNN CRMD: [2223]: info:ccm_event_detail: #011CURRENT: datanode4.abc.com [Nodeid=0, born=3]
June 16:00:31 SNN CRMD: [2223]: info:ccm_event_detail: #011CURRENT: snn.abc.com [nodeid=1, born=5]
June 16:00:31 SNN CRMD: [2223]: info:ccm_event_detail: #011NEW: datanode4.abc.com [Nodeid=0, born=3]
June 16:00:31 SNN CRMD: [2223]: info:ccm_event_detail: #011NEW: snn.abc.com [nodeid=1, born=5]
June 16:00:31 SNN CRMD: [2223]: Info:do_started:The local CRM is operational
June 16:00:31 SNN CRMD: [2223]: info:do_state_transition:State transition s_starting s_pending [input=i_pending Cause=c_ccm_callback origin=do_started]
4. View Cluster monitoring status
[Email protected] heartbeat]# Crm_mon
Refresh in 6s ...
============
Last Updated:fri June 19 16:11:34 2015
Current DC:snn.abc.com (6009ca6a-56eb-4d35-872e-3b8dc0fc9851)
2 Nodes configured.
0 Resources configured.
============
Node:datanode4.abc.com (0862D824-047E-4826-9E26-21A7603F53C8): Online
Node:snn.abc.com (6009ca6a-56eb-4d35-872e-3b8dc0fc9851): Online
4, the CRM command tool
[Email protected] heartbeat]# Crm_sh
/usr/sbin/crm_sh:31:deprecationwarning:the popen2 module is deprecated. Use the Subprocess module.
From Popen2 import Popen3
CRM # Help
USAGE:CRM (nodes|config|resources)
CRM # Nodes
CRM Nodes # Help
Usage:nodes (Status|list)
CRM Nodes # List
<node id= "0862d824-047e-4826-9e26-21a7603f53c8" uname= "datanode4.abc.com" type= "normal"/>
<node id= "6009ca6a-56eb-4d35-872e-3b8dc0fc9851" uname= "snn.abc.com" type= "normal"/>
CRM Nodes #
5, install heartbeat when automatically create a user hacluster, but no password, need to create
[Email protected] heartbeat]# cat/etc/passwd |grep hacluster
Hacluster:x:498:498:heartbeat User:/var/lib/heartbeat/cores/hacluster:/sbin/nologin
[Email protected] heartbeat]# passwd hacluster
Change the password for the user hacluster.
New Password:
Invalid Password: Too short
Invalid Password: too simple
Re-enter the new password:
PASSWD: All the authentication tokens have been successfully updated.
6, directly run Hb_gui
[Email protected] ~]# Hb_gui
Traceback (most recent):
File "/usr/bin/hb_gui", line $, in <module>
Import GTK, Gtk.glade, GObject
File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line @ <module>
_init ()
File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line-up, in _init
_gtk.init_check ()
Runtimeerror:could not open Display
There are error hints above
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/BB/wKiom1WD4kKjHhq7AAKYGhh-2CI498.jpg "title=" 22.png "alt=" Wkiom1wd4kkjhhq7aakyghh-2ci498.jpg "/>
Download and install Xmanager on the client
When you re-execute the command
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/BB/wKiom1WD5IqhUc9SAATt458E-Gk900.jpg "title=" 23.png "alt=" Wkiom1wd5iqhuc9saatt458e-gk900.jpg "/>
Iii. definition of Ha_gui
1. Define the Master resource name
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/BB/wKiom1WD6obRT9D7AAIGDmQ8Q0c090.jpg "title=" 24.png "alt=" Wkiom1wd6obrt9d7aaigdmq8q0c090.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/BB/wKiom1WD68-DYSRoAAMtZVcpp9A772.jpg "title=" 25.png "alt=" Wkiom1wd68-dysroaamtzvcpp9a772.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/BB/wKiom1WD7P3Doq-HAAOUjNleYHs777.jpg "title=" 26.png "alt=" Wkiom1wd7p3doq-haaoujnleyhs777.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/B8/wKioL1WD7rvSGA57AAKp1DNjKL0275.jpg "title=" 27.png "alt=" Wkiol1wd7rvsga57aakp1dnjkl0275.jpg "/>
2, following the definition of master resources
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/BC/wKiom1WD7zqSGPJRAAHxYAQLXVc864.jpg "title=" 28.png "alt=" Wkiom1wd7zqsgpjraahxyaqlxvc864.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/BC/wKiom1WD70ThbOgEAAMIoGhwXXQ196.jpg "title=" 29.png "alt=" Wkiom1wd70thbogeaamioghwxxq196.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/B8/wKioL1WD8QTS3DV8AAKFjBQlP-o714.jpg "title=" 30.png "alt=" Wkiol1wd8qts3dv8aakfjbqlp-o714.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/B9/wKioL1WD9YXSnFgFAAJQK879AXg158.jpg "title=" 31.png "alt=" Wkiol1wd9yxsnfgfaajqk879axg158.jpg "/>
3, let two resources run the same node, there are two methods: (1) Define the arrangement constraints, (2) define the resource group
(1) Defining permutation constraints
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/BC/wKiom1WD9heC77D6AAH_sfWkoJ0818.jpg "title=" 32.png "alt=" Wkiom1wd9hec77d6aah_sfwkoj0818.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/B9/wKioL1WD99eiBjFNAAOlnl00Zjw580.jpg "title=" 33.png "alt=" Wkiol1wd99eibjfnaaolnl00zjw580.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/BC/wKiom1WD9oGgrfb2AAH4VGL2ac8178.jpg "title=" 34.png "alt=" Wkiom1wd9oggrfb2aah4vgl2ac8178.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/BC/wKiom1WD9t_QLYzqAAEawH1atdk598.jpg "title=" 35.png "alt=" Wkiom1wd9t_qlyzqaaeawh1atdk598.jpg "/>
4, let the SNN node become prepared
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/BC/wKiom1WD98yS7sX-AAIv0RMduF4084.jpg "style=" float: none; "title=" 36.png "alt=" Wkiom1wd98ys7sx-aaiv0rmduf4084.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/B9/wKioL1WD-X-BQLiUAAJdCkZBs-s135.jpg "style=" float: none; "title=" 37.png "alt=" Wkiol1wd-x-bqliuaajdckzbs-s135.jpg "/>
Iv. ways to define Groups
Web server:
vip:192.168.1.8
httpd
Nfs:/192.168.1.4:/web/htdocs hanging on to/var/www/html
1. Delete the original master resource
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/B9/wKioL1WD-_6BKl24AAHktqrP8ZI523.jpg "title=" 38.png "alt=" Wkiol1wd-_6bkl24aahktqrp8zi523.jpg "/>
2. Define Group master Source
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/BA/wKioL1WECZSBUX-BAAITS2IhDXw499.jpg "style=" float: none; "title=" 41.png "alt=" Wkiol1weczsbux-baaits2ihdxw499.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/BD/wKiom1WEB-KBPjLnAAMH5qhE7XI203.jpg "style=" float: none; "title=" 43.png "alt=" Wkiom1web-kbpjlnaamh5qhe7xi203.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/BA/wKioL1WECZXiY09nAAI9tZyRdEE589.jpg "style=" float: none; "title=" 44.png "alt=" Wkiol1weczxiy09naai9tzyrdee589.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/BD/wKiom1WEB-Oy5shJAAOr9bfv-Bg743.jpg "style=" float: none; "title=" 45.png "alt=" Wkiom1web-oy5shjaaor9bfv-bg743.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/BD/wKiom1WEB-OCBJnKAAMwMXL56jM083.jpg "style=" float: none; "title=" 46.png "alt=" Wkiom1web-ocbjnkaamwmxl56jm083.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/BA/wKioL1WECZbj9WRcAAJzBPG6uvc027.jpg "style=" float: none; "title=" 47.png "alt=" Wkiol1weczbj9wrcaajzbpg6uvc027.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/BA/wKioL1WECg3QYMOeAALWGkxiE-c668.jpg "title=" 48.png "alt=" Wkiol1wecg3qymoeaalwgkxie-c668.jpg "/>
3, httpd cannot start, check the log as follows
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/BD/wKiom1WECJSzDz34AAtEM83nkEY497.jpg "title=" 49.png "alt=" Wkiom1wecjszdz34aatem83nkey497.jpg "/>
From the log, NFS normal hanging on to 4 this host, but httpd first start and close, I have not found out why, expect some altar know, may wish to point out, thank you all
This article is from the "Scattered People" blog, please be sure to keep this source http://zouqingyun.blog.51cto.com/782246/1663710
The heartbeat of High availability cluster resource management based on CRM (II.)