mycat中间件读写分离配置(3)
时间:2016-10-30 22:22 来源:潇湘夜雨 作者:华嵩阳 点击:次
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1702/rpcbind
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 2496/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1957/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1779/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2241/master
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 2821/sshd
tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN 8217/sshd
tcp 0 0 :::33116 :::* LISTEN 25022/java
tcp 0 0 :::1984 :::* LISTEN 25022/java
tcp 0 0 :::3306 :::* LISTEN 25022/java
tcp 0 0 :::9066 :::* LISTEN 25022/java
tcp 0 0 :::111 :::* LISTEN 1702/rpcbind
tcp 0 0 :::35314 :::* LISTEN 25022/java
tcp 0 0 :::22 :::* LISTEN 1957/sshd
tcp 0 0 ::1:631 :::* LISTEN 1779/cupsd
tcp 0 0 :::41944 :::* LISTEN 1724/rpc.statd
tcp 0 0 ::1:25 :::* LISTEN 2241/master
tcp 0 0 ::1:6010 :::* LISTEN 2821/sshd
tcp 0 0 ::1:6011 :::* LISTEN 8217/sshd
端口3306和9066处于listen状态说明mycat启动成功
登录mycat管理后台:
[root@node3 local]# mysql -u test -h 127.0.0.1 -p -P 9066
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.8-mycat-1.5.1-RELEASE-20160929233042 MyCat Server (monitor)
Copyright (c) 2000, 2016, 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> show @@heartbeat; #查看心跳信息,RE_CODE=1表示在线,-1表示连接错误
+--------+-------+----------------+------+---------+-------+--------+---------+--------------+---------------------+-------+
| NAME | TYPE | HOST | PORT | RS_CODE | RETRY | STATUS | TIMEOUT | EXECUTE_TIME | LAST_ACTIVE_TIME | STOP |
+--------+-------+----------------+------+---------+-------+--------+---------+--------------+---------------------+-------+
| master | mysql | 172.18.109.235 | 3306 | 1 | 0 | idle | 0 | 24,23,23 | 2016-10-28 09:52:51 | false |
| slave1 | mysql | 172.18.109.236 | 3306 | 1 | 0 | idle | 0 | 22,24,24 | 2016-10-28 09:52:51 | false |
| slave2 | mysql | 172.18.109.237 | 3306 | 1 | 0 | idle | 0 | 22,23,23 | 2016-10-28 09:52:51 | false |
+--------+-------+----------------+------+---------+-------+--------+---------+--------------+---------------------+-------+
3 rows in set (0.00 sec)
mysql> show @@datasource; #数据库源
+----------+--------+-------+----------------+------+------+--------+------+------+---------+
| DATANODE | NAME | TYPE | HOST | PORT | W/R | ACTIVE | IDLE | SIZE | EXECUTE |
+----------+--------+-------+----------------+------+------+--------+------+------+---------+
| dn2 | master | mysql | 172.18.109.235 | 3306 | W | 0 | 8 | 1000 | 499 |
| dn2 | slave1 | mysql | 172.18.109.236 | 3306 | R | 0 | 8 | 1000 | 499 |
| dn2 | slave2 | mysql | 172.18.109.237 | 3306 | R | 0 | 8 | 1000 | 487 |
| dn1 | master | mysql | 172.18.109.235 | 3306 | W | 0 | 8 | 1000 | 499 |
| dn1 | slave1 | mysql | 172.18.109.236 | 3306 | R | 0 | 8 | 1000 | 499 |
| dn1 | slave2 | mysql | 172.18.109.237 | 3306 | R | 0 | 8 | 1000 | 487 |
+----------+--------+-------+----------------+------+------+--------+------+------+---------+
6 rows in set (0.01 sec)
mysql> show @@database; #当前逻辑数据库
+----------+
| DATABASE |
+----------+
| phpcmsv9 |
| testdb |
+----------+
2 rows in set (0.00 sec)
mysql> show @@datanode; #当前逻辑库节点
+------+---------------------+-------+-------+--------+------+------+---------+------------+----------+---------+---------------+ (责任编辑:liangzh) |