[Email protected] bin]# cat/etc/mysqlrouter/Mysqlrouter.ini[default]
#mkdir-P/var/log/mysql-routerlogging_folder= /var/log/mysql-router plugin_folder =/usr/local/mysql-router/lib/ mysqlrouterruntime_folder=/usr/local/mysql-router[logger]# defining log levels Level=info# a highly available label [Routing:failover]bind_address=0.0.0.0Bind_port=7001max_connections=1024x768# There are two types of support: Read-write and read-only# Read-write: For high availability, for readable writable # read-only: For load balancing, read-only mode= read-write# the address actually forwarded # The first socket will always use the first if it is available # if the first socket fails to connect, it will connect to the second socketdestinations=10.24.220.70:3306,10.169.214.33:3306
Starting:
[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.logcat:Logging:No such file or directorycat:to:No such file or directory .- to- - A: -: GenevaINFO [7f2cb44a4700] [routing:failover] listening on0.0.0.0:7001; read-Write .- to- - A: -: atINFO [7f13125a2700] [routing:failover] listening on0.0.0.0:7001; read-Write .- to- - A: -: atINFO [7f2816b4a700] [routing:failover] listening on0.0.0.0:7001; read-Write .- to- - A: at:WuyiINFO [7fec2b5f4700] [routing:failover] listening on0.0.0.0:7001; read-Write .- to- - A: -:GenevaINFO [7ff971019700] [routing:failover] listening on0.0.0.0:7001; read-write[[email protected] bin]# MySQL-U root-p123-h172.18.14.68^cp7002-E"Show variables like ' server_id '";
[Email protected] bin]# mysql-u root-p-H10.169.216.172-P7001-E"Show variables like ' server_id '"; Enter Password:+---------------+-------+| variable_name | Value |+---------------+-------+| server_id |101|+---------------+-------+[[email protected] bin]# MySQL-U root-p-H10.169.216.172-P7001-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-H10.169.216.172-P7001-E"Show variables like ' server_id '"; Enter Password:+---------------+-------+| variable_name | Value |+---------------+-------+| server_id |102|+---------------+-------+[[email protected] bin]# MySQL-U root-p-H10.169.216.172-P7001-E"Show variables like ' server_id '"; Enter Password:+---------------+-------+| variable_name | Value |+---------------+-------+| server_id |102|+---------------+-------+
MySQL Router automatic failover test