mysql_rhcs配置
mysql==cluster
<?xml version="1.0"?>
<cluster config_version="43" name="web-cluster1">
<clusternodes>
<clusternode name="web01-clu" nodeid="1">
<fence>
<method name="Method">
<device name="web01-fence"/>
</method>
</fence>
</clusternode>
<clusternode name="web02-clu" nodeid="2">
<fence>
<method name="Method">
<device name="web02-fence"/>
</method>
</fence>
</clusternode>
</clusternodes>
<cman expected_votes="1" transport="udpu" two_node="1"/>
<rm>
<failoverdomains>
<failoverdomain name="faildomain1" nofailback="1" ordered="1">
<failoverdomainnode name="web01-clu"/>
<failoverdomainnode name="web02-clu"/>
</failoverdomain>
</failoverdomains>
<resources>
<ip address="172.68.63.23/24" monitor_link="0" sleeptime="10"/>
<ip address="172.68.63.24/24" monitor_link="0" sleeptime="10"/>
<lvm lv_name="LogVol01" name="ha-lvm-mysql" vg_name="vg01"/>
<lvm lv_name="LogVol01" name="ha-lvm-webapps" vg_name="vg02"/>
<ip address="172.68.63.25/24" sleeptime="10"/>
<lvm lv_name="LogVol01" name="ha-lvm-ftp" vg_name="vg03"/>
<fs device="/dev/mapper/vg03-LogVol01" force_unmount="1" fsid="55876" fstype="ext4" mountpoint="/ftp" name="fs-ftp"/>
<fs device="/dev/mapper/vg01-LogVol01" force_unmount="1" fsid="17708" fstype="ext4" mountpoint="/mysql" name="fs-mysql"/>
<fs device="/dev/mapper/vg02-LogVol01" force_unmount="1" fsid="25073" fstype="ext4" mountpoint="/webapps" name="fs-webapps"/>
<script file="/etc/rhcs_mysql.sh" name="mysql_scripts1"/>
</resources>
<service domain="faildomain1" name="sg-webapps" recovery="relocate">
<lvm ref="ha-lvm-webapps">
<fs ref="fs-webapps">
<ip ref="172.68.63.23/24"/>
</fs>
</lvm>
</service>
<service domain="faildomain1" name="sg-ftp" recovery="relocate">
<lvm ref="ha-lvm-ftp">
<fs ref="fs-ftp">
<ip ref="172.68.63.24/24"/>
</fs>
</lvm>
</service>
<service domain="faildomain1" name="sg-mysql" recovery="relocate">
<lvm ref="ha-lvm-mysql">
<fs ref="fs-mysql">
<ip ref="172.68.63.25/24">
<script ref="mysql_scripts1"/>
</ip>
</fs>
</lvm>
</service>
</rm>
<fencedevices>
<fencedevice agent="fence_idrac" ipaddr="172.68.64.195" login="root" name="web01-fence" passwd="calvin"/>
<fencedevice agent="fence_idrac" ipaddr="172.68.64.196" login="root" name="web02-fence" passwd="calvin"/>
</fencedevices>
<fence_daemon post_fail_delay="3"/>
</cluster>
=====
rhcs_mysql.sh
#!/bin/bash
MYSQL_HOME=/mysql/mysql-advanced-5.6.26
function start() {
su - mysql -c "
$MYSQL_HOME/bin/mysqld_safe &
"
}
function stop() {
su - mysql -c "
$MYSQL_HOME/bin/mysqladmin -uroot -p'Mysql_admin_25' shutdown
"
}
function status() {
chk_mysqld=`ps -ef| grep mysqld |grep -v grep | wc -l`
if [ $chk_mysqld -lt 2 ];then
echo "The MySQL database is not runing"
exit 1
else
echo "The MySQL database is runing"
return 0
fi
}
case "$1" in
"start")
echo "Startting MySQL Database ..."
start
;;
"stop")
echo "Stopping MySQL Database ..."
stop
;;
"status")
status
;;
*)
echo "Usage : `basename $0` {start | stop | status}"
exit 0
;;
esac