8, Heartbeat+iscsi+mysql realize dual machine high availability
Migration of virtual addresses
iSCSI provides storage sharing
(MySQL is application also can be FTP web, etc. )
650) this.width=650; "src=" Http://note.youdao.com/yws/res/21276/0B9FB083AE2248FEA35605DB7AC09BB7 "alt=" Qq20150730161150.png "/>
on the iSCSI server: 10.0.2.220
There are two disks required. /dev/sdb are used for sharing.
(1) Installing iSCSI server-side software
# yum Install scsi-target-utils
(2) Setting up the configuration file for iSCSI sharing
# vim/etc/tgt/targets.conf
<target iqn.2015-07-30.sxjy.com:mysql>
BACKING-STORE/DEV/SDB1
incominguser Admin aixocm
initiator-address 10.0.5.100--"10.0.199.4
initiator-address 10.0.5.101--"10.0.199.3
Write-cache on
MaxConnections 2
</target>
# service TGTD start
# tgt-admin-show
(3) Client Mount settings
Two clients: (Must have MySQL installed) 10.0.199.3/4
Use two MySQL real servers as clients
Installing the Client software
# yum Install iscsi-initiator-utils
Configuring Client Authentication
# vim/etc/iscsi/iscsid.conf
Node.session.auth.authmethod = CHAP
node.session.auth.username = Admin
Node.session.auth.password = The user name and password used to scan the server's iSCSI share when aixocm \ \ \
node.session.auth.username_in = Admin
node.session.auth.password_in = aixocm Verify user name and password on Mount
# service iSCSI Restart
Scan the server for iSCSI shares
# iscsiadm-m discovery-t sendtargets-p 10.0.2.220
Mount iSCSI shared disks
# iscsiadm-m Node-t iqn.2015-07-30.sxjy.com:mysql-p 10.0.2.220-l
because the two clients share the same disk, when the shared disk is mounted on the primary real server, from the real server
is not mounted, it will heartbeat when the main real server is dropped or down take over and then mount the shared disk (heartbeat function)
(offload iSCSI shared disks)
(# iscsiadm-m node-t iqn.2015-07-30.sxjy.com:mysql-p 10.0.2.220-u)
Installing Heartbeat
identical to the configuration of the dispatch server above. Except for a configuration file that is not the same.
(3) Configuring the Haresource resource configuration file
# Vim Haresources
Server1 ipaddr::10.0.5.200/32/eth0:0 FILESYSTEM::/DEV/SDB/::/DATABASE/MYDATA::EXT4 mysqld
#service Heartbeat Start
#lsof-i:3306 found that MySQL is turned on. (not manually turned on)
Validation Experiment:
on the primary real server: # server Heartbeat start
mount the shared disk and view it on the master-slave real-World server # df-h from the real server and not mounted
It will take over the heartbeat when the primary real server is dropped or down, and then mount the shared disk .
on the primary real server: # service heartbeat stop found df-h automatically mounts the disk successfully from the real server.
This article is from the "Zhanglulu" blog, make sure to keep this source http://zhanglulu913.blog.51cto.com/10592685/1688967
Heartbeat+iscsi+mysql for dual-machine high availability