mysql router 自动failover测试

[[email protected] 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
起动:

[[email protected] bin]# ./mysqlrouter -c /etc/mysqlrouter/mysqlrouter.ini &
[1] 1203
[[email protected] bin]# Logging to /var/log/mysql-router/mysqlrouter.log
^C
[[email protected] 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
[[email protected] bin]#  mysql -u root -p123 -h 172.18.14.68^CP 7002 -e "show variables like ‘server_id‘";
[[email protected] 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   |
+---------------+-------+
[[email protected] 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

[[email protected] 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   |
+---------------+-------+
[[email protected] 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   |
+---------------+-------+
时间: 2024-10-19 09:01:53

mysql router 自动failover测试的相关文章

MYSQL router 自动均衡负载

配制文件: /etc/mysqlrouter/mysqlrouter.ini [DEFAULT] logging_folder = /var/log/mysql-router plugin_folder = /usr/local/mysql-router/lib/mysqlrouter runtime_folder = /usr/local/mysql-router [logger] # 定义日志等级 level = INFO [routing:balancing] bind_address =

MySQL 主从复制 + MySQL Router 部署测试

4个节点 1.MySQLDB1  192.168.1.41  (MySQL 主节点) 2.MySQLDB2  192.168.1.42  (MySQL从节点) 3.MySQLDB3  192.168.1.43  (MySQL从节点) 4.MySQLRouter  192.168.1.47  (MySQLRouter服务节点) 软件版本说明: 1.操作系统  CentOS6.6_x86_64 2.MySQLServer  5.7.16 3.MySQLRouter  2.0.4 一.部署MySQL主

MySQL高可用方案MHA自动Failover与手动Failover的实践及原理

集群信息 角色                             IP地址                 ServerID      类型 Master                         192.168.244.10   1                 写入 Candicate master          192.168.244.20   2                 读 Slave                           192.168.244.

MHA自动Failover过程解析(updated) 转

允许转载, 转载时请以超链接形式标明文章原始出处和网站信息 http://www.mysqlsystems.com/2012/03/figure-out-process-of-autofailover-on-mha.html MHA自动Failover过程解析(updated) By zhang, on March 31st, 2012 MHA是一位日本MySQL大牛用Perl写的一套MySQL故障切换方案,来保证数据库系统的高可用.近期,在田老师的推动下,开始一步步深入了解这个HA方案,并也计

Redis主从自动failover

Redis主从架构持久化存在一个问题,即前次测试的结论,持久化需要配置在主实例上才能跨越实例保证数据不丢失,这样以来主实例在持久化数据到硬 盘的过程中,势必会造成磁盘的I/O等待,经过实际测试,这个持久化写硬盘的过程给应用程序带来的影响无法忍受:因而在大多数场景下,会考虑把持久化配置 在从实例上,当主实例宕机后,通过手动或者自动的方式将从实例提升为主实例,继续提供服务!当主实例恢复后,先从原从实例上同步数据,同步完成后再恢复到 原始的主从状态!要实现这种的要求,需要有keepalive的配合,一

利用XAG在RAC环境下实现GoldenGate自动Failover

概述 在RAC环境下配置OGG,要想实现RAC节点故障时,OGG能自动的failover到正常节点,要保证两点: 1. OGG的checkpoint,trail,BR文件放置在共享的集群文件系统上,RAC各节点都能访问到 2. 需要有集群软件的来监测OGG进程,以及发生故障时,自动在正常节点重启OGG(failover) Oracle Grid Infrastructure Standalone Agents (XAG)搭配Oracle支持的集群文件系统,可以实现OGG的自动failover,本

linux备份和mysql登陆自动输入密码

1.mysql自动登陆,系统自己输入密码 (1)安装亿需要的软件 [[email protected] ~]# yum install expect-* (2)在脚本中写入命令 #!/usr/bin/expect -f             --使用expect软件set timeout 2                   --输出密码时延时2秒spawn mysql -u root -p           --mysql登陆命令expect "system"         

TFS配置ha及failover测试

在配置完多台dataserver之后,就需要考虑到nameserver的单点故障问题.本文将介绍如何针对tfs的nameserver实现ha,官方推荐采用heartbeat实现,但heartbeat的实现配置同keepalive相比,复杂了许多,因而这里我们采用keepalive来实现namserver的ha和failover. 环境介绍: NS服务器1  -->  192.168.1.225 NS服务器2  -->  192.168.1.226 NS VIP        -->  1

MySQL Study之--MySQL关闭自动commit(autocommit)

MySQL Study之--MySQL关闭自动commit(autocommit)      对于mysql来讲,在事务处理时,默认是在动提交的(autocommit),以下方法可以自动关闭autocommit: 案例分析: 1.在mysql登录环境下修改 [[email protected] soft]# mysql -u root -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your M