[root@web1 ~]# mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
192.168.200.130:/mydata/data/ on /mydata/data type nfs (rw,vers=4,addr=192.168.200.130,clientaddr=192.168.200.132)
[root@web1 ~]# cd /mydata/data/
[root@web1 data]# ls
ibdata1 mysql-bin.000002 mysql-bin.000007 web1.daphne.com.pid
ib_logfile0 mysql-bin.000003 mysql-bin.index web2.daphne.com.err
ib_logfile1 mysql-bin.000004 performance_schema
mysql mysql-bin.000005 test
mysql-bin.000001 mysql-bin.000006 web1.daphne.com.err
7 测试登陆
[root@web1 data]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.37-log MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement
mysql>
8 停止mysql服务 卸载/mydata/data
[root@web2 ~]# service mysqld start
Starting MySQL.. SUCCESS!
4 测试登陆
[root@web2 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.37-log MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
5 停止mysql 卸载/mydata/data
[root@web2 ~]# service mysqld stop
Shutting down MySQL. SUCCESS!
[root@web2 ~]# umount /mydata/data/
六 crm资源配置
1 新建组资源
2 设置组ID名
3 添加VIP资源
4 添加 共享存储资源
5 添加mysql 服务资源
6 资源添加完成
7 启动全部资源
8 查看IP
10 查看资源状态
11 web1 连接测试mysql
12 mysql 授权
mysql> grant all on *.* to 'root'@'192.168.200.%' identified by 'redhat';
mysql> flush privileges;
13 测试集群
[root@bogon ~]# mysql -uroot -predhat -h 192.168.200.10
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.37-log MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
14 模拟故障
1 将web2节点 切换到 standby,资源全部切换到web1上
2 查看web1接口
[root@web1 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:7D:C1:D7
inet addr:192.168.200.132 Bcast:192.168.200.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe7d:c1d7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13573 errors:0 dropped:0 overruns:0 frame:0
TX packets:7765 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:17996747 (17.1 MiB) TX bytes:831831 (812.3 KiB)
eth0:0 Link encap:Ethernet HWaddr 00:0C:29:7D:C1:D7
inet addr:192.168.200.10 Bcast:192.168.200.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth1 Link encap:Ethernet HWaddr 00:0C:29:7D:C1:E1
inet addr:192.168.10.132 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe7d:c1e1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:830 (830.0 b)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
3 远程测试mysql
[root@nfs ~]# mysql -uroot -predhat -h 192.168.200.10
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.37-log MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
高可用mysql集群,演示完毕