corosync+pacemaker+mysql+drbd 实现mysql的高可用

2016-07-12 10:26:24来源:oschina作者:osenlin人点击

corosynccorosync的由来是源于一个Openais的项目,是Openais的一个子 项目,可以实现HA心跳信息传输的功能,是众多实现HA集群软件中之一,heartbeat与corosync是流行的Messaging Layer (集群信息层)工具。而corosync是一个新兴的软件,相比Heartbeat这款很老很成熟的软件,corosync与Heartbeat各有优势,博主就不在这里比较之间的优势了,corosync相对于Heartbeat只能说现在比较流行。


pacemaker:是众多集群资源管理器(Cluster Resource Manager)CRM中的一个,其主要功能是管理来着集群信息层发送来的信息。Pacemaker是集群的核心,它管理逻辑和集群信息. 集群信息更新通过Corosync通知到各个节点.


mysql:一个开源的关系型数据库


drbd:DRBD:(distributed replication block device)即分布式复制块设备。它的工作原理是:在A主机上有对指定磁盘设备写请求时,数据发送给A主机的kernel,然后通kernel中的一个模块,把相同的数据传送给B主机的kernel中一份,然后B主机再写入自己指定的磁盘设备,从而实现两主机数据的同步,也就实现了写操作高可用。类似于raid1一样,实现数据的镜像,DRBD一般是一主一从,并且所有的读写操作,挂载只能在主节点服务器上进行,,但是主从DRBD服务器之间是可以进行调换的。


各个组件之间的关系:其实mysql与drbd根本没有半毛钱的关系,而drbd与mysql相结合就有很重要的作用了,因为drbd实现数据的镜像,当drbd的主节点挂了之后,drbd的辅助节点还可以提供服务,但是主节点不会主动的切换到辅助的节点上面去,于是乎,高可用集群就派上用场了,因为资源定义为高可用的资源,主节点出现故障之后,高可用集群可以自动的切换到辅助节点上去,实现故障转移继续提供服务。


二、安装高可用集群的提前准备


1)、hosts文件


#把主机名改成jie2.com[root@jie2~]#sed-is/`grepHOSTNAME/etc/sysconfig/network|awk-F'=''{print$2}'`/jie2.com/g/etc/sysconfig/network#把主机名改成jie3.com[root@jie3~]#sed-is/`grepHOSTNAME/etc/sysconfig/network|awk-F'=''{print$2}'`/jie3.com/g/etc/sysconfig/network[root@jie2~]#cat>>/etc/hosts<172.16.22.2jie2.comjie2>172.16.22.3jie3.comjie3>EOF[root@jie3~]#cat>>/etc/hosts<172.16.22.2jie2.comjie2>172.16.22.3jie3.comjie3>EOF

2)、ssh互信


[root@jie2~]#ssh-keygen-trsa-P''[root@jie2~]#ssh-copy-id-i.ssh/id_rsa.pubjie3[root@jie3~]#ssh-keygen-trsa-P''[root@jie3~]#ssh-copy-id-i.ssh/id_rsa.pubjie2

3)、关闭NetworkManger


[root@jie2~]#chkconfig--delNetworkManager[root@jie2~]#chkconfigNetworkManageroff[root@jie2~]#serviceNetworkManagerstop[root@jie3~]#chkconfig--delNetworkManager[root@jie3~]#chkconfigNetworkManageroff[root@jie3~]#serviceNetworkManagerstop

4)、时间同步(博主用的是自己的ntp时间服务器)


[root@jie2~]#ntpdate172.16.0.1[root@jie3~]#ntpdate172.16.0.1

三、安装corosync+pacemaker


1)、安装corosync+pacemaker


#节点jie2.com的操作[root@jie2~]#yum-yinstallcorosyncpacemaker[root@jie2~]#yum-y--nogpgcheckinstallcrmsh-1.2.6-4.el6.x86_64.rpmpssh-2.3.1-2.el6.x86_64.rpm#提供crmsh命令接口的软件#节点jie3.com的操作[root@jie3~]#yum-yinstallcorosyncpacemaker[root@jie3~]#yum-y--nogpgcheckinstallcrmsh-1.2.6-4.el6.x86_64.rpmpssh-2.3.1-2.el6.x86_64.rpm

2)、修改配置文件和生成认证文件


配置文件


#节点jie2.com的操作[root@jie2~]#cd/etc/corosync/[root@jie2corosync]#mvcorosync.conf.examplecorosync.conf[root@jie2corosync]#vimcorosync.conf#Pleasereadthecorosync.conf.5manualpagecompatibility:whitetanktotem{#心跳信息传递层version:2#版本secauth:on#认证信息一般onthreads:0#线程interface{#定义心跳信息传递的接口ringnumber:0bindnetaddr:172.16.0.0#绑定的网络地址,写网络地址mcastaddr:226.94.1.1#多播地址mcastport:5405#多播的端口ttl:1#生存周期}}logging{#日志fileline:offto_stderr:no#是否输出在屏幕上to_logfile:yes#定义自己的日志to_syslog:no#是否由syslog记录日志logfile:/var/log/cluster/corosync.log#日志文件的存放路径debug:offtimestamp:on#时间戳是否关闭logger_subsys{subsys:AMFdebug:off}}amf{mode:disabled}service{ver:0name:pacemaker#pacemaker作为corosync的插件进行工作}aisexec{user:rootgroup:root}[root@jie2corosync]#scpcorosync.confjie3:/etc/corosync/##把节点jie2.com的配置文件copy到jie3.com中

认证文件


#节点jie2.com的操作[root@jie2corosync]#corosync-keygenCorosyncClusterEngineAuthenticationkeygenerator.Gathering1024bitsforkeyfrom/dev/random.Presskeysonyourkeyboardtogenerateentropy(bits=152).#遇到这个情况,表示电脑的随机数不够,各位朋友可以不停的随便敲键盘,或者安装软件也可以生成随机数[root@jie2corosync]#scpauthkeyjie3:/etc/corosync/#把认证文件也复制到jie3.com主机上

3)、开启服务和查看集群中的节点信息


#节点jie2.com的操作[root@jie2~]#servicecorosyncstartStartingCorosyncClusterEngine(corosync):[OK][root@jie2~]#crmstatusLastupdated:ThuAug814:43:132013Lastchange:SunSep116:41:182013viacrm_attributeonjie3.comStack:classicopenais(withplugin)CurrentDC:jie3.com-partitionwithquorumVersion:1.1.8-7.el6-394e9062Nodesconfigured,2expectedvotesOnline:[jie2.comjie3.com]#节点jie3.com的操作[root@jie3~]#servicecorosyncstartStartingCorosyncClusterEngine(corosync):[OK][root@jie3~]#crmstatusLastupdated:ThuAug814:43:132013Lastchange:SunSep116:41:182013viacrm_attributeonjie3.comStack:classicopenais(withplugin)CurrentDC:jie3.com-partitionwithquorumVersion:1.1.8-7.el6-394e9062Nodesconfigured,2expectedvotesOnline:[jie2.comjie3.com]


四、编译安装mysql(两个节点的操作过程都是一样)


#节点jie2.com的操作#1)、解压编译安装[root@jie2~]#tarxfmysql-5.5.33.tar.gz[root@jie2~]#yum-ygroupinstall"Developmenttools""ServerPlatformDevelopment"[root@jie2~]#cdmysql-5.5.33[root@jie2mysql-5.5.33]#yum-yinstallcmake[root@jie2mysql-5.5.33]#cmake.-DCMAKE_INSTALL_PREFIX=/usr/local/mysql/-DMYSQL_DATADIR=/mydata/data-DSYSCONFDIR=/etc/-DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_ENGINE=1/-DWITH_BLACKHOLE_STORAGE_ENGINE=1-DWITH_READLINE=1-DWITH_SSL=system/-DWITH_ZLIB=system-DWITH_LIBWRAP=0-DMYSQL_UNIX_ADDR=/tmp/mysql.sock/-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci[root@jie2mysql-5.5.33]#make&&makeinstall#2)、建立配置文件和脚本文件[root@jie2mysql-5.5.33]#cp/usr/local/mysql/support-files/my-large.cnf/etc/my.cnf[root@jie2mysql-5.5.33]#cp/usr/local/mysql/support-files/mysql.server/etc/rc.d/init.d/mysqld[root@jie2mysql-5.5.33]#cd/usr/local/mysql/[root@jie2mysql]#useradd-r-u306mysql[root@jie2mysql]#chown-Rroot:mysql./*#3)、关联系统识别的路径[root@jie2mysql]#echo"PATH=/usr/local/mysql/bin:$PATH">/etc/profile.d/mysqld.sh[root@jie2mysql]#source/etc/profile.d/mysqld.sh[root@jie2mysql]#echo"/usr/local/mysql/lib">/etc/ld.so.conf.d/mysqld.conf[root@jie2mysql]#ldconfig-v|grepmysql[root@jie2mysql]#ln-sv/usr/local/mysql/include//usr/local/mysqld

先别初始化数据库,安装drbd把drbd挂载到目录下,然后初始化数据库把数据库的数据存放到drbd挂载的目录。


五、安装drbd


安装rpm包的drbd软件必须保证找相同内核版本的drbd-kmdl软件


1)、先划分一个分区,此分区做成drbd镜像(RHEL 6.x的重新格式化一个新的分区之后要重启系统)


#节点jie2.com的操作[root@jie2~]#fdisk/dev/sdaCommand(mforhelp):nCommandactioneextendedpprimarypartition(1-4)pPartitionnumber(1-4):3Firstcylinder(7859-15665,default7859):Usingdefaultvalue7859Lastcylinder,+cylindersor+size{K,M,G}(7859-15665,default15665):+5GCommand(mforhelp):w#节点jie3.com的操作[root@jie3~]#fdisk/dev/sdaCommand(mforhelp):nCommandactioneextendedpprimarypartition(1-4)pPartitionnumber(1-4):3Firstcylinder(7859-15665,default7859):Usingdefaultvalue7859Lastcylinder,+cylindersor+size{K,M,G}(7859-15665,default15665):+5GCommand(mforhelp):w

2)、安装drbd和修改配置文件


#1)、安装drbd#节点jie2.com的操作[root@jie2~]#rpm-ivhdrbd-kmdl-2.6.32-358.el6-8.4.3-33.el6.x86_64.rpmwarning:drbd-kmdl-2.6.32-358.el6-8.4.3-33.el6.x86_64.rpm:HeaderV4DSA/SHA1Signature,keyID66534c2b:NOKEYPreparing...#################################[100%][root@jie2~]#rpm-ivhdrbd-8.4.3-33.el6.x86_64.rpmwarning:drbd-8.4.3-33.el6.x86_64.rpm:HeaderV4DSA/SHA1Signature,keyID66534c2b:NOKEYPreparing...##################################[100%]#节点jie3.com的操作[root@jie3~]#rpm-ivhdrbd-kmdl-2.6.32-358.el6-8.4.3-33.el6.x86_64.rpmwarning:drbd-kmdl-2.6.32-358.el6-8.4.3-33.el6.x86_64.rpm:HeaderV4DSA/SHA1Signature,keyID66534c2b:NOKEYPreparing...#################################[100%][root@jie3~]#rpm-ivhdrbd-8.4.3-33.el6.x86_64.rpmwarning:drbd-8.4.3-33.el6.x86_64.rpm:HeaderV4DSA/SHA1Signature,keyID66534c2b:NOKEYPreparing...##################################[100%]#2)、修改drbd的配置文件#节点jie2.com的操作[root@jie2~]#cd/etc/drbd.d/[root@jie2drbd.d]#catglobal_common.conf#全局配置文件global{usage-countno;#minor-countdialog-refreshdisable-ip-verification}common{protocolC;handlers{pri-on-incon-degr"/usr/lib/drbd/notify-pri-on-incon-degr.sh;/usr/lib/drbd/notify-emergency-reboot.sh;echob>/proc/sysrq-trigger;reboot-f";pri-lost-after-sb"/usr/lib/drbd/notify-pri-lost-after-sb.sh;/usr/lib/drbd/notify-emergency-reboot.sh;echob>/proc/sysrq-trigger;reboot-f";local-io-error"/usr/lib/drbd/notify-io-error.sh;/usr/lib/drbd/notify-emergency-shutdown.sh;echoo>/proc/sysrq-trigger;halt-f";#fence-peer"/usr/lib/drbd/crm-fence-peer.sh";#split-brain"/usr/lib/drbd/notify-split-brain.shroot";#out-of-sync"/usr/lib/drbd/notify-out-of-sync.shroot";#before-resync-target"/usr/lib/drbd/snapshot-resync-target-lvm.sh-p15---c16k";#after-resync-target/usr/lib/drbd/unsnapshot-resync-target-lvm.sh;}startup{#wfc-timeout120;#degr-wfc-timeout120;}disk{on-io-errordetach;#fencingresource-only;}net{cram-hmac-alg"sha1";shared-secret"mydrbdlab";}syncer{rate1000M;}}[root@jie2drbd.d]#catmydata.res#资源配置文件resourcemydata{onjie2.com{device/dev/drbd0;disk/dev/sda3;address172.16.22.2:7789;meta-diskinternal;}onjie3.com{device/dev/drbd0;disk/dev/sda3;address172.16.22.3:7789;meta-diskinternal;}}#把配置文件copy到节点jie3.com上面[root@jie2drbd.d]#scpglobal_common.confmydata.resjie3:/etc/drbd.d/

3)、初始化drbd的资源并启动


#节点jie2.com的操作#创建drbd的资源[root@jie2~]#drbdadmcreate-mddrbdWritingmetadata...initializingactivitylogNOTinitializingbitmaplk_bdev_save(/var/lib/drbd/drbd-minor-0.lkbd)failed:NosuchfileordirectoryNewdrbdmetadatablocksuccessfullycreated.#提示已经创建成功lk_bdev_save(/var/lib/drbd/drbd-minor-0.lkbd)failed:Nosuchfileordirectory#启动服务[root@jie2~]#servicedrbdstartStartingDRBDresources:[createres:drbdpreparedisk:drbdadjustdisk:drbdadjustnet:drbd]..........[ok]#节点jie3.com的操作#创建drbd的资源[root@jie3~]#drbdadmcreate-mddrbdWritingmetadata...initializingactivitylogNOTinitializingbitmaplk_bdev_save(/var/lib/drbd/drbd-minor-0.lkbd)failed:NosuchfileordirectoryNewdrbdmetadatablocksuccessfullycreated.#提示已经创建成功lk_bdev_save(/var/lib/drbd/drbd-minor-0.lkbd)failed:Nosuchfileordirectory#启动服务[root@jie3~]#servicedrbdstartStartingDRBDresources:[createres:drbdpreparedisk:drbdadjustdisk:drbdadjustnet:drbd]..........[ok]

4)、设置一个主节点,然后同步drbd的数据(此步骤只需在一个节点上操作)


#设置jie2.com为drbd的主节点[root@jie2~]#drbdadmprimary--forcemydata[root@jie2~]#cat/proc/drbd#查看同步进度version:8.4.3(api:1/proto:86-101)GIT-hash:89a294209144b68adb3ee85a73221f964d3ee515buildbygardner@,2013-05-2704:30:210:cs:SyncSourcero:Primary/Secondaryds:UpToDate/InconsistentCr---n-ns:1897624nr:0dw:0dr:1901216al:0bm:115lo:0pe:3ua:3ap:0ep:1wo:foos:207988[=================>..]sync'ed:90.3%(207988/2103412)Kfinish:0:00:07speed:26,792(27,076)K/sec[root@jie2~]#watch-n1'cat/proc/drbd'此命令可以动态的查看[root@jie2~]#cat/proc/drbdversion:8.4.3(api:1/proto:86-101)GIT-hash:89a294209144b68adb3ee85a73221f964d3ee515buildbygardner@,2013-05-2704:30:210:cs:Connectedro:Primary/Secondaryds:UpToDate/UpToDateCr-----ns:120nr:354dw:435dr:5805al:6bm:9lo:0pe:0ua:0ap:0ep:1wo:foos:0#当两边都为UpToDate时,表示两边已经同步

5)、格式化drdb分区(此步骤在主节点上操作)


[root@jie2~]#mke2fs-text4/dev/drbd0

六、mysql与drbd实现mysql数据的镜像


1)、在drbd的主节点上,挂载drbd的分区,然后初始化数据库


[root@jie2~]#mkdir/mydata#创建用于挂载drbd的目录[root@jie2~]#mount/dev/drbd0/mydata/[root@jie2~]#mkdir/mydata/data[root@jie2~]#chown-Rmysql.mysql/mydata#把文件的属主和属组改成mysql[root@jie2~]#vim/etc/my.cnf#修改mysql的配置文件
datadir=/mydata/data
innodb_file_per_table=1[root@jie2~]#/usr/local/mysql/scripts/mysql_install_db--user=mysql--datadir=/mydata/data/--basedir=/usr/local/mysql#初始化数据库[root@jie2~]#servicemysqldstartStartingMySQL.......[OK]

2)、验证drbd是否镜像


#节点jie2.com的操作#1)、先在drbd的主节点上面创建一个数据库[root@jie2~]#mysqlmysql>showdatabases;
+--------------------+
|Database|
+--------------------+
|information_schema|
|mysql|
|performance_schema|
|test|
+--------------------+4rowsinset(0.00sec)
mysql>createdatabasejie2;QueryOK,1rowaffected(0.01sec)
mysql>showdatabases;
+--------------------+
|Database|
+--------------------+
|information_schema|
|jie2|
|mysql|
|performance_schema|
|test|
+--------------------+5rowsinset(0.00sec)
mysql>/q#2)、停掉mysql服务,卸载drbd挂载的目录[root@jie2~]#servicemysqldstop[root@jie2~]#umount/dev/drbd0#卸载drbd的挂载点[root@jie2~]#drbdadmsecondarymydata#把此节点改为drbd的备用节点
#节点jie3.com的操作#3)、把jie3.com变为drbd的主节点[root@jie3~]#drbdadmprimarymydata#把此节点改为drbd的主节点[root@jie3~]#mkdir/mydata[root@jie3~]#chown-Rmysql.mysql/mydata[root@jie3~]#mount/dev/drdb0/mydata[root@jie3~]#vim/etc/my.cnf
datadir=/mydata/data
innodb_file_per_table=1[root@jie3~]#servicemysqldstart#此节点上不用初始化数据库,直接开启服务即可StartingMySQL.......[OK]
[root@jie3~]#mysqlmysql>showdatabases;#可以看见jie2数据库+--------------------+
|Database|
+--------------------+
|information_schema|
|jie2|
|mysql|
|performance_schema|
|test|
+--------------------+5rowsinset(0.00sec)

七、利用crmsh配置mysql的高可用


需要定义集群资源而mysql、drbd都是集群的资源,由集群管理的资源开机是一定不能够自行启动的。


1)、关闭drbd的服务和关闭mysql的服务


[root@jie2~]#servicemysqldstop[root@jie2~]#servicedrbdstop[root@jie3~]#servicemysqldstop[root@jie3~]#umount/dev/drbd0#之前drbd已经挂载到jie3.com节点上了[root@jie3~]#servicedrdbstop

2)、定义集群资源


定义drbd的资源(提供drbd的资源代理RA由OCF类别中的linbit提供)


[root@jie2~]#crmcrm(live)#configurecrm(live)configure#propertystonith-enabled=falsecrm(live)configure#propertyno-quorum-policy=ignorecrm(live)configure#primitivemysqldrbdocf:linbit:drbdparamsdrbd_resource=mydataopmonitorrole=Masterinterval=10timeout=20opmonitorrole=Slaveinterval=20timeout=20opstarttimeout=240opstoptimeout=100crm(live)configure#verify#可以检查语法

定义drbd的主从资源


crm(live)configure#msms_mysqldrbdmysqldrbdmetamaster-max=1master-node-max=1clone-max=2clone-node-max=1notify=truecrm(live)configure#verify

定义文件系统资源和约束关系


crm(live)configure#primitivemystoreocf:heartbeat:Filesystemparamsdevice="/dev/drbd0"directory="/mydata"fstype="ext4"opmonitorinterval=40timeout=40opstarttimeout=60opstoptimeout=60crm(live)configure#verifycrm(live)configure#colocationmystore_with_ms_mysqldrbdinf:mystorems_mysqldrbd:Mastercrm(live)configure#orderms_mysqldrbd_before_mystoremandatory:ms_mysqldrbd:promotemystore:startcrm(live)configure#verify

定义vip资源、mysql服务的资源约束关系


crm(live)configure#primitivemyvipocf:heartbeat:IPaddrparamsip="172.16.22.100"opmonitorinterval=20timeout=20on-fail=restartcrm(live)configure#primitivemyserverlsb:mysqldopmonitorinterval=20timeout=20on-fail=restartcrm(live)configure#verifycrm(live)configure#colocationmyserver_with_mystoreinf:myservermystorecrm(live)configure#ordermystore_before_myservermandatory:mystore:startmyserver:startcrm(live)configure#verifycrm(live)configure#colocationmyvip_with_myserverinf:myvipmyservercrm(live)configure#ordermyvip_before_myservermandatory:myvipmyservercrm(live)configure#verifycrm(live)configure#commit

查看所有定义资源的信息


crm(live)configure#shownodejie2.com/
attributesstandby="off"nodejie3.com/
attributesstandby="off"primitivemyserverlsb:mysqld/
opmonitorinterval="20"timeout="20"on-fail="restart"primitivemysqldrbdocf:linbit:drbd/
paramsdrbd_resource="mydata"/
opmonitorrole="Master"interval="10"timeout="20"/
opmonitorrole="Slave"interval="20"timeout="20"/
opstarttimeout="240"interval="0"/
opstoptimeout="100"interval="0"primitivemystoreocf:heartbeat:Filesystem/
paramsdevice="/dev/drbd0"directory="/mydata"fstype="ext4"/
opmonitorinterval="40"timeout="40"/
opstarttimeout="60"interval="0"/
opstoptimeout="60"interval="0"primitivemyvipocf:heartbeat:IPaddr/
paramsip="172.16.22.100"/
opmonitorinterval="20"timeout="20"on-fail="restart"/
metatarget-role="Started"msms_mysqldrbdmysqldrbd/
metamaster-max="1"master-node-max="1"clone-max="2"clone-node-max="1"notify="true"colocationmyserver_with_mystoreinf:myservermystore
colocationmystore_with_ms_mysqldrbdinf:mystorems_mysqldrbd:Master
colocationmyvip_with_myserverinf:myvipmyserverorderms_mysqldrbd_before_mystoreinf:ms_mysqldrbd:promotemystore:startordermystore_before_myserverinf:mystore:startmyserver:startordermyvip_before_myserverinf:myvipmyserver
property$id="cib-bootstrap-options"/
dc-version="1.1.8-7.el6-394e906"/
cluster-infrastructure="classicopenais(withplugin)"/
expected-quorum-votes="2"/
stonith-enabled="false"/no-quorum-policy="ignore"

查看资源运行的状态运行在jie3.com上


[root@jie2~]#crmstatusLastupdated:ThuAug817:55:302013Lastchange:SunSep116:41:182013viacrm_attributeonjie3.comStack:classicopenais(withplugin)CurrentDC:jie3.com-partitionwithquorumVersion:1.1.8-7.el6-394e9062Nodesconfigured,2expectedvotes5Resourcesconfigured.Online:[jie2.comjie3.com]Master/SlaveSet:ms_mysqldrbd[mysqldrbd]Masters:[jie3.com]Slaves:[jie2.com]
mystore(ocf::heartbeat:Filesystem):Startedjie3.com
myvip(ocf::heartbeat:IPaddr):Startedjie3.com
myserver(lsb:mysqld):Startedjie3.com

切换节点,看资源是否转移


[root@jie3~]#crmnodestandbyjie3.com#把此节点设置为备用节点[root@jie3~]#crmstatusLastupdated:MonSep201:45:072013Lastchange:MonSep201:44:592013viacrm_attributeonjie3.comStack:classicopenais(withplugin)CurrentDC:jie3.com-partitionwithquorumVersion:1.1.8-7.el6-394e9062Nodesconfigured,2expectedvotes5Resourcesconfigured.Nodejie3.com:standbyOnline:[jie2.com]Master/SlaveSet:ms_mysqldrbd[mysqldrbd]Masters:[jie2.com]#资源已然转到jie2.com上面
Stopped:[mysqldrbd:1]
mystore(ocf::heartbeat:Filesystem):Startedjie2.com
myvip(ocf::heartbeat:IPaddr):Startedjie2.com
myserver(lsb:mysqld):Startedjie2.com

由于定义了drbd的资源约束,Masters运行在那个节点,则此节点不可能成为drbd的辅助节点


[root@jie3~]#cat/proc/drbdversion:8.4.3(api:1/proto:86-101)
GIT-hash:89a294209144b68adb3ee85a73221f964d3ee515buildbygardner@,2013-05-2704:30:21
0:cs:Connectedro:Primary/Secondaryds:UpToDate/UpToDateCr-----
ns:426nr:354dw:741dr:6528al:8bm:9lo:0pe:0ua:0ap:0ep:1wo:foos:0[root@jie3~]#drbdadmsecondarymydata0:Statechangefailed:(-12)Deviceisheldopenbysomeone
Command'drbdsetupsecondary0'terminatedwithexitcode11

手动的停掉myvip资源还是会启动(因为定义资源是指定了on-fail=restart)


[root@jie2~]#ifconfig|grepeth0eth0Linkencap:EthernetHWaddr00:0C:29:1F:74:CF
inetaddr:172.16.22.2Bcast:172.16.255.255Mask:255.255.0.0
inet6addr:fe80::20c:29ff:fe1f:74cf/64Scope:Link
UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1
RXpackets:2165062errors:0dropped:0overruns:0frame:0
TXpackets:4109895errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:1000
RXbytes:167895762(160.1MiB)TXbytes:5731508707(5.3GiB)eth0:0Linkencap:EthernetHWaddr00:0C:29:1F:74:CF
inetaddr:172.16.22.100Bcast:172.16.255.255Mask:255.255.0.0
UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1[root@jie2~]#ifconfigeth0:0down[root@jie2~]#ifconfig|grepeth0eth0Linkencap:EthernetHWaddr00:0C:29:1F:74:CF
inetaddr:172.16.22.2Bcast:172.16.255.255Mask:255.255.0.0
inet6addr:fe80::20c:29ff:fe1f:74cf/64Scope:Link
UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1
RXpackets:2165242errors:0dropped:0overruns:0frame:0
TXpackets:4110094errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:1000
RXbytes:167917669(160.1MiB)TXbytes:5731537035(5.3GiB)
[root@jie2~]#crmstatusLastupdated:ThuAug818:29:272013Lastchange:MonSep201:44:592013viacrm_attributeonjie3.comStack:classicopenais(withplugin)CurrentDC:jie3.com-partitionwithquorumVersion:1.1.8-7.el6-394e9062Nodesconfigured,2expectedvotes5Resourcesconfigured.Nodejie3.com:standbyOnline:[jie2.com]Master/SlaveSet:ms_mysqldrbd[mysqldrbd]Masters:[jie2.com]Stopped:[mysqldrbd:1]
mystore(ocf::heartbeat:Filesystem):Startedjie2.com
myvip(ocf::heartbeat:IPaddr):Startedjie2.com
myserver(lsb:mysqld):Startedjie2.comFailedactions:
myvip_monitor_20000(node=jie2.com,call=47,rc=7,status=complete):notrunning
myserver_monitor_20000(node=jie3.com,call=209,rc=7,status=complete):notrunning
[root@jie2~]#ifconfig|grepeth0eth0Linkencap:EthernetHWaddr00:0C:29:1F:74:CF
inetaddr:172.16.22.2Bcast:172.16.255.255Mask:255.255.0.0
inet6addr:fe80::20c:29ff:fe1f:74cf/64Scope:Link
UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1
RXpackets:2165681errors:0dropped:0overruns:0frame:0
TXpackets:4110535errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:1000
RXbytes:168015864(160.2MiB)TXbytes:5731617112(5.3GiB)eth0:1Linkencap:EthernetHWaddr00:0C:29:1F:74:CF
inetaddr:172.16.22.100Bcast:172.16.255.255Mask:255.255.0.0
UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1[root@jie2~]#

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台