MySQL Cluster三机集群+HA高可用+负载均衡配置手册(8)

ldirectord状态检查
[root@db1 ~]# ldirectord ldirectord.cf status
ldirectord for /etc/ha.d/ldirectord.cf is running with pid: 6203
[root@db2 ~]# ldirectord ldirectord.cf status
ldirectord is stopped for /etc/ha.d/ldirectord.cf
heartbeat状态检查
[root@db1 log]# service heartbeat status
heartbeat OK [pid 5750 et al] is running on db1.test.com [db1.test.com]...
[root@db2 log]# service heartbeat status
heartbeat OK [pid 5796 et al] is running on db2.test.com [db2.test.com]...

----错误问题解决
[root@db1 init.d]# ./ldirectord status
ldirectord stale pid file /var/run/ldirectord.ldirectord.pid for /etc/ha.d/ldirectord.cf
ldirectord is stopped for /etc/ha.d/ldirectord.cf
此问题已经解决了,是因为缺少包造成的。缺少perl-DBI-mysql、perl-DBD-mysql

虚拟IP状态检查
[root@db2 log]# ip addr sh eth0
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 90:e2:ba:01:fe:24 brd ff:ff:ff:ff:ff:ff
    inet 172.16.1.75/24 brd 172.16.1.255 scope global eth0
    inet 172.16.1.73/24 brd 172.16.1.255 scope global secondary eth0:0
    inet6 fe80::92e2:baff:fe01:fe24/64 scope link
      valid_lft forever preferred_lft forever
[root@db1 log]# ip addr sh eth0
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 90:e2:ba:01:fa:fa brd ff:ff:ff:ff:ff:ff
    inet 172.16.1.74/24 brd 172.16.1.255 scope global eth0
    inet6 fe80::92e2:baff:fe01:fafa/64 scope link
      valid_lft forever preferred_lft forever
     
IPVS状态检查
[root@db2 log]# ipvsadm -L -n
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port          Forward Weight ActiveConn InActConn
TCP  172.16.1.73:3306 wrr
  -> 172.16.1.74:3306            Route  1      0          0       
  -> 172.16.1.75:3306            Local  0      0          0       

[root@db1 log]# ipvsadm -L -n
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port          Forward Weight ActiveConn InActConn

db1上执行./LVSSyncDaemonSwap master status
[root@db1 resource.d]# ./LVSSyncDaemonSwap master status
master running
(ipvs_syncmaster pid: 4043)

db1上执行./LVSSyncDaemonSwap master status
[root@db2 ha.d]# resource.d/LVSSyncDaemonSwap master status
master stopped

[root@db2 log]# mysql -u ldirectord -p -h 172.16.1.73
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 492
Server version: 5.5.31-ndb-7.2.13-cluster-gpl MySQL Cluster Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database          |
+--------------------+
| information_schema |
| ldirectordb    |
| test              |
+--------------------+
3 rows in set (0.00 sec)

mysql> use ldirectordb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from ldirectordtest;
+--------+
| Status |
+--------+
|      1 |
+--------+
1 row in set (0.00 sec)

mysql>

[root@db1 log]# mysql -u ldirectord -p -h 172.16.1.73
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 492
Server version: 5.5.31-ndb-7.2.13-cluster-gpl MySQL Cluster Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database          |
+--------------------+
| information_schema |
| ldirectordb    |
| test              |
+--------------------+
3 rows in set (0.00 sec)

mysql> use ldirectordb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from ldirectordtest;
+--------+
| Status |
+--------+
|      1 |
+--------+
1 row in set (0.00 sec)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/e6d08f24de9c8aafe351cad59d812345.html