3.2 启动所有节点的corosync
[iyunv@master mysqlinstall]# service corosync start
Starting Corosync Cluster Engine (corosync): [ OK ]
[iyunv@master mysqlinstall]# service corosync status
corosync (pid 22130) is running...
[iyunv@master mysqlinstall]#
查看corosync启动信息
A. 查看corosync引擎是否正常启动
[iyunv@master mysqlinstall]# grep -e "Corosync Cluster Engine" -e "configuration file" /var/log/cluster/corosync.log
Nov 28 02:05:49 corosync [MAIN ] Corosync Cluster Engine ('1.4.1'): started and ready to provide service.
Nov 28 02:05:49 corosync [MAIN ] Successfully read main configuration file '/etc/corosync/corosync.conf'.
Dec 10 00:24:53 corosync [MAIN ] Corosync Cluster Engine exiting with status 0 at main.c:1858.
B. 查看初始化成员节点通知是否正常发出
[iyunv@master mysqlinstall]# grep TOTEM /var/log/cluster/corosync.log | more
Nov 20 23:55:44 corosync [TOTEM ] Initializing transport (UDP/IP Unicast).
Nov 20 23:55:44 corosync [TOTEM ] Initializing transmit/receive security: libtomcrypt SOBER128/SHA1HMAC (mode 0).
Nov 20 23:55:45 corosync [TOTEM ] The network interface [192.168.213.91] is now up.
Nov 20 23:55:45 corosync [TOTEM ] adding new UDPU member {192.168.213.91}
Nov 20 23:55:45 corosync [TOTEM ] adding new UDPU member {192.168.213.92}
Nov 20 23:55:45 corosync [TOTEM ] A processor joined or left the membership and a new membership was formed.
Nov 20 23:56:17 corosync [TOTEM ] A processor joined or left the membership and a new membership was formed.
C. 检查启动过程中是否有错误产生
[iyunv@master mysqlinstall]# grep ERROR: /var/log/cluster/corosync.log | more
Nov 20 23:55:45 corosync [pcmk ] ERROR: process_ais_conf: You have configured a cluster using the Pacemaker plugin for Corosync. Th
e plugin is not supported in this environment and will be removed very soon.
Nov 20 23:55:45 corosync [pcmk ] ERROR: process_ais_conf: Please see Chapter 8 of 'Clusters from Scratch' (http://www.clusterlabs.
org/doc) for details on using Pacemaker with CMAN
D. 查看pacemaker是否正常启动
grep pcmk_startup /var/log/cluster/corosync.log
查看集群状态
[iyunv@master mysqlinstall]# crm_mon
Attempting connection to the cluster...
Last updated: Tue Dec 10 02:00:24 2013
Last change: Tue Dec 10 01:17:19 2013 via crm_attribute on master
Stack: classic openais (with plugin)
Current DC: slave92 - partition with quorum
Version: 1.1.10-1.el6_4.4-368c726
3 Nodes configured, 3 expected votes
4 Resources configured
Online: [ master slave92 ]
OFFLINE: [ slave93 ]
vip (ocf::heartbeat:IPaddr): Started master
Master/Slave Set: ms_MySQL [p_mysql]
Masters: [ master ]
Slaves: [ slave92 ]
vip_r (ocf::heartbeat:IPaddr): Started master
显示本集群可用节点
[iyunv@master mysqlinstall]# crm_node -l
1540729024 master member
1557506240 slave92 member
需要修改两个文件
1.
[iyunv@master mysqlinstall]# vi /etc/init.d/mysqld
....
....
# Set pid file if not given
#
if test -z "$mysqld_pid_file_path"
then
###by zxg modify
mysqld_pid_file_path=$datadir/master.pid
#mysqld_pid_file_path=$datadir/`hostname`.pid
else
case "$mysqld_pid_file_path" in
....
2.
[iyunv@master mysqlinstall]# vi /usr/lib/ocf/resource.d/heartbeat/mysql
....
....
OCF_RESKEY_config_default="/etc/my.cnf"
OCF_RESKEY_datadir_default="/var/lib/mysql"
OCF_RESKEY_user_default="mysql"
OCF_RESKEY_group_default="mysql"
OCF_RESKEY_log_default="/var/log/mysqld.log"
###by zxg modify
#OCF_RESKEY_pid_default="/var/run/mysql/mysqld.pid"
OCF_RESKEY_pid_default="/mysql/data/mysql5528/data/master.pid"
OCF_RESKEY_socket_default="/var/lib/mysql/mysql.sock"
...
...