码迷,mamicode.com
首页 > 数据库 > 详细

mysql router 自动failover测试

时间:2016-05-16 23:10:24      阅读:835      评论:0      收藏:0      [点我收藏+]

标签:

[root@monitor bin]# cat /etc/mysqlrouter/mysqlrouter.ini
[DEFAULT]
#mkdir -p /var/log/mysql-router logging_folder
= /var/log/mysql-router plugin_folder = /usr/local/mysql-router/lib/mysqlrouter runtime_folder = /usr/local/mysql-router [logger] # 定义日志等级 level = INFO # 一个高可用的标签 [routing:failover] bind_address = 0.0.0.0 bind_port = 7001 max_connections = 1024 # 目前就支持两种 : read-write 和 read-only # read-write:用于高可用,用于可读可写 # read-only:用于负载均衡,只读 mode = read-write # 实际转发的地址 # 第一个socket如果可用,就一直会使用第一个 # 如果第一个socket无法连接了,才会连接到第二个socket destinations = 10.24.220.70:3306, 10.169.214.33:3306
起动:


[root@monitor bin]# ./mysqlrouter -c /etc/mysqlrouter/mysqlrouter.ini & [1] 1203 [root@monitor bin]# Logging to /var/log/mysql-router/mysqlrouter.log ^C [root@monitor bin]# cat Logging to /var/log/mysql-router/mysqlrouter.log cat: Logging: No such file or directory cat: to: No such file or directory 2016-05-16 22:13:02 INFO [7f2cb44a4700] [routing:failover] listening on 0.0.0.0:7001; read-write 2016-05-16 22:13:23 INFO [7f13125a2700] [routing:failover] listening on 0.0.0.0:7001; read-write 2016-05-16 22:16:23 INFO [7f2816b4a700] [routing:failover] listening on 0.0.0.0:7001; read-write 2016-05-16 22:23:51 INFO [7fec2b5f4700] [routing:failover] listening on 0.0.0.0:7001; read-write 2016-05-16 22:24:04 INFO [7ff971019700] [routing:failover] listening on 0.0.0.0:7001; read-write [root@monitor bin]# mysql -u root -p123 -h 172.18.14.68^CP 7002 -e "show variables like ‘server_id‘";

 

 

 

[root@monitor bin]# mysql -u root -p -h 10.169.216.172 -P 7001 -e "show variables like ‘server_id‘";          
Enter password: 
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 101   |
+---------------+-------+
[root@monitor bin]# mysql -u root -p -h 10.169.216.172 -P 7001 -e "show variables like ‘server_id‘";
Enter password: 
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 101   |
+---------------+-------+


server1:
service mysq.server stop


[root@monitor bin]# mysql -u root -p -h 10.169.216.172 -P 7001 -e "show variables like ‘server_id‘"; Enter password: +---------------+-------+ | Variable_name | Value | +---------------+-------+ | server_id | 102 | +---------------+-------+ [root@monitor bin]# mysql -u root -p -h 10.169.216.172 -P 7001 -e "show variables like ‘server_id‘"; Enter password: +---------------+-------+ | Variable_name | Value | +---------------+-------+ | server_id | 102 | +---------------+-------+

 

mysql router 自动failover测试

标签:

原文地址:http://www.cnblogs.com/zengkefu/p/5499798.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!