1. sysbench准备数据

sysbench /usr/share/sysbench/oltp_read_write.lua \
--mysql-host=192.168.56.111 \
--mysql-user=wanbin \
--mysql-password=mysql \
--mysql-db=sbtest \
--db-driver=mysql \
--tables=10 \
--table-size=500000 \
--report-interval=10 \
--threads=128 \
--time=120 \
prepare prepare/run/cleanup
prepare:准备数据,
run:执行压测,
cleanup:清除数据 sysbench 1.0.15 (using bundled LuaJIT 2.1.0-beta2) Initializing worker threads... Creating table 'sbtest10'...
Creating table 'sbtest6'...
Creating table 'sbtest1'...
Creating table 'sbtest3'...
Creating table 'sbtest2'...
Creating table 'sbtest7'...
Creating table 'sbtest5'...
Creating table 'sbtest8'...
Creating table 'sbtest4'...
Creating table 'sbtest9'...
Inserting 500000 records into 'sbtest10'
Inserting 500000 records into 'sbtest9'
Inserting 500000 records into 'sbtest6'
Inserting 500000 records into 'sbtest5'
Inserting 500000 records into 'sbtest8'
Inserting 500000 records into 'sbtest4'
Inserting 500000 records into 'sbtest7'
Inserting 500000 records into 'sbtest3'
Inserting 500000 records into 'sbtest2'
Inserting 500000 records into 'sbtest1'
Creating a secondary index on 'sbtest5'...
Creating a secondary index on 'sbtest6'...
Creating a secondary index on 'sbtest9'...
Creating a secondary index on 'sbtest10'...
Creating a secondary index on 'sbtest7'...
Creating a secondary index on 'sbtest3'...
Creating a secondary index on 'sbtest8'...
Creating a secondary index on 'sbtest2'...
Creating a secondary index on 'sbtest4'...
Creating a secondary index on 'sbtest1'...

2. sysbench开始压测

sysbench /usr/share/sysbench/oltp_read_write.lua \
--mysql-host=192.168.56.111 \
--mysql-user=wanbin \
--mysql-password=mysql \
--mysql-db=sbtest \
--db-driver=mysql \
--tables=10 \
--table-size=500000 \
--report-interval=10 \
--threads=128 \
--time=120 \
run

3. master模拟意外宕机

# ps -ef|grep mysqld
avahi 741 1 0 08:50 ? 00:00:00 avahi-daemon: running [mysqldb1.local]
mysql 4741 4228 2 11:03 pts/3 00:06:30 mysqld --defaults-file=/etc/my3306.cnf
root 8346 8288 0 15:34 pts/0 00:00:00 grep --color=auto mysqld # kill -9 4741

4. mysqldb2 上观察mha状态

# tail -f /var/log/masterha/app1/manager.log

Mon Oct 29 15:34:40 2018 - [warning] Got error on MySQL select ping: 2013 (Lost connection to MySQL server during query)
Mon Oct 29 15:34:40 2018 - [info] Executing secondary network check script: /usr/local/bin/masterha_secondary_check -s mysqldb2 -s mysqldb1 --user=root --master_host=192.168.56.100 --master_ip=192.168.56.100 --master_port=3306 --master_user=mha_rep --master_password=123456 --ping_type=SELECT
Mon Oct 29 15:34:40 2018 - [info] Executing SSH check script: exit 0
Mon Oct 29 15:34:40 2018 - [warning] Got error on MySQL connect: 2003 (Can't connect to MySQL server on '192.168.56.100' (111))
Mon Oct 29 15:34:40 2018 - [warning] Connection failed 2 time(s)..
Mon Oct 29 15:34:41 2018 - [warning] Got error on MySQL connect: 2003 (Can't connect to MySQL server on '192.168.56.100' (111))
Mon Oct 29 15:34:41 2018 - [warning] Connection failed 3 time(s)..
Mon Oct 29 15:34:42 2018 - [warning] Got error on MySQL connect: 2003 (Can't connect to MySQL server on '192.168.56.100' (111))
Mon Oct 29 15:34:42 2018 - [warning] Connection failed 4 time(s)..
Mon Oct 29 15:34:45 2018 - [warning] HealthCheck: Got timeout on checking SSH connection to 192.168.56.100! at /usr/local/share/perl5/MHA/HealthCheck.pm line 342.
Monitoring server mysqldb2 is reachable, Master is not reachable from mysqldb2. OK.
Monitoring server mysqldb1 is reachable, Master is not reachable from mysqldb1. OK.
Mon Oct 29 15:34:53 2018 - [info] Master is not reachable from all other monitoring servers. Failover should start.
Mon Oct 29 15:34:53 2018 - [warning] Master is not reachable from health checker!
Mon Oct 29 15:34:53 2018 - [warning] Master 192.168.56.100(192.168.56.100:3306) is not reachable!
Mon Oct 29 15:34:53 2018 - [warning] SSH is NOT reachable.
Mon Oct 29 15:34:53 2018 - [info] Connecting to a master server failed. Reading configuration file /etc/masterha_default.cnf and /etc/masterha/app1.cnf again, and trying to connect to all servers to check server status..
Mon Oct 29 15:34:53 2018 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Mon Oct 29 15:34:53 2018 - [info] Reading application default configuration from /etc/masterha/app1.cnf..
Mon Oct 29 15:34:53 2018 - [info] Reading server configuration from /etc/masterha/app1.cnf..
Mon Oct 29 15:34:55 2018 - [info] GTID failover mode = 1
Mon Oct 29 15:34:55 2018 - [info] Dead Servers:
Mon Oct 29 15:34:55 2018 - [info] 192.168.56.100(192.168.56.100:3306)
Mon Oct 29 15:34:55 2018 - [info] Alive Servers:
Mon Oct 29 15:34:55 2018 - [info] 192.168.56.200(192.168.56.200:3306)
Mon Oct 29 15:34:55 2018 - [info] 192.168.56.210(192.168.56.210:3306)
Mon Oct 29 15:34:55 2018 - [info] Alive Slaves:
Mon Oct 29 15:34:55 2018 - [info] 192.168.56.200(192.168.56.200:3306) Version=5.7.23-log (oldest major version between slaves) log-bin:enabled
Mon Oct 29 15:34:55 2018 - [info] GTID ON
Mon Oct 29 15:34:55 2018 - [info] Replicating from 192.168.56.100(192.168.56.100:3306)
Mon Oct 29 15:34:55 2018 - [info] Primary candidate for the new Master (candidate_master is set)
Mon Oct 29 15:34:55 2018 - [info] 192.168.56.210(192.168.56.210:3306) Version=5.7.23-log (oldest major version between slaves) log-bin:enabled
Mon Oct 29 15:34:55 2018 - [info] GTID ON
Mon Oct 29 15:34:55 2018 - [info] Replicating from 192.168.56.100(192.168.56.100:3306)
Mon Oct 29 15:34:55 2018 - [info] Not candidate for the new Master (no_master is set)
Mon Oct 29 15:34:55 2018 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Mon Oct 29 15:34:55 2018 - [info] Reading application default configuration from /etc/masterha/app1.cnf..
Mon Oct 29 15:34:55 2018 - [info] Reading server configuration from /etc/masterha/app1.cnf..
Mon Oct 29 15:34:55 2018 - [info] Checking slave configurations..
Mon Oct 29 15:34:55 2018 - [info] Checking replication filtering settings..
Mon Oct 29 15:34:55 2018 - [info] Replication filtering check ok.
Mon Oct 29 15:34:55 2018 - [info] Master is down!
Mon Oct 29 15:34:55 2018 - [info] Terminating monitoring script.
Mon Oct 29 15:34:55 2018 - [info] Got exit code 20 (Master dead).
Mon Oct 29 15:34:55 2018 - [info] MHA::MasterFailover version 0.57.
Mon Oct 29 15:34:55 2018 - [info] Starting master failover.
Mon Oct 29 15:34:55 2018 - [info]
Mon Oct 29 15:34:55 2018 - [info] * Phase 1: Configuration Check Phase..
Mon Oct 29 15:34:55 2018 - [info]
Mon Oct 29 15:34:56 2018 - [info] GTID failover mode = 1
Mon Oct 29 15:34:56 2018 - [info] Dead Servers:
Mon Oct 29 15:34:56 2018 - [info] 192.168.56.100(192.168.56.100:3306)
Mon Oct 29 15:34:56 2018 - [info] Checking master reachability via MySQL(double check)...
Mon Oct 29 15:34:56 2018 - [info] ok.
Mon Oct 29 15:34:56 2018 - [info] Alive Servers:
Mon Oct 29 15:34:56 2018 - [info] 192.168.56.200(192.168.56.200:3306)
Mon Oct 29 15:34:56 2018 - [info] 192.168.56.210(192.168.56.210:3306)
Mon Oct 29 15:34:56 2018 - [info] Alive Slaves:
Mon Oct 29 15:34:56 2018 - [info] 192.168.56.200(192.168.56.200:3306) Version=5.7.23-log (oldest major version between slaves) log-bin:enabled
Mon Oct 29 15:34:56 2018 - [info] GTID ON
Mon Oct 29 15:34:56 2018 - [info] Replicating from 192.168.56.100(192.168.56.100:3306)
Mon Oct 29 15:34:56 2018 - [info] Primary candidate for the new Master (candidate_master is set)
Mon Oct 29 15:34:56 2018 - [info] 192.168.56.210(192.168.56.210:3306) Version=5.7.23-log (oldest major version between slaves) log-bin:enabled
Mon Oct 29 15:34:56 2018 - [info] GTID ON
Mon Oct 29 15:34:56 2018 - [info] Replicating from 192.168.56.100(192.168.56.100:3306)
Mon Oct 29 15:34:56 2018 - [info] Not candidate for the new Master (no_master is set)
Mon Oct 29 15:34:56 2018 - [error][/usr/local/share/perl5/MHA/MasterFailover.pm, ln309] Last failover was done at 2018/10/29 10:09:03. Current time is too early to do failover again. If you want to do failover, manually remove /var/log/masterha/app1/app1.failover.complete and run this script again.
Mon Oct 29 15:34:56 2018 - [error][/usr/local/share/perl5/MHA/ManagerUtil.pm, ln177] Got ERROR: at /usr/local/bin/masterha_manager line 65.

可以看到自动切换失败,需要删除/var/log/masterha/app1/app1.failover.complete

rm -rf /var/log/masterha/app1/app1.failover.complete

5. 手工failover切换master

# masterha_master_switch --conf=/etc/masterha/app1.cnf --dead_master_host=192.168.56.100 --master_state=dead --new_master_host=192.168.56.200 --ignore_last_failover

--ignore_last_failover:在缺省情况下,如果MHA检测到连续发生宕机,且两次宕机间隔不足8小时的话,
则不会进行Failover,之所以这样限制是为了避免ping-pong效应。
该参数代表忽略上次MHA触发切换产生的文件,默认情况下,MHA发生切换后会在日志目录,
也就是 /var/log/masterha/app1产生app1.failover.complete文件,
下次再次切换的时候如果发现该目录下存在该文件将不允许触发切换,除非在第一次切换后收到删除该文件 # masterha_master_switch --conf=/etc/masterha/app1.cnf --dead_master_host=192.168.56.100 --master_state=dead --new_master_host=192.168.56.200 --ignore_last_failover
--dead_master_ip=<dead_master_ip> is not set. Using 192.168.56.100.
--dead_master_port=<dead_master_port> is not set. Using 3306.
Mon Oct 29 15:49:04 2018 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Mon Oct 29 15:49:04 2018 - [info] Reading application default configuration from /etc/masterha/app1.cnf..
Mon Oct 29 15:49:04 2018 - [info] Reading server configuration from /etc/masterha/app1.cnf..
Mon Oct 29 15:49:04 2018 - [info] MHA::MasterFailover version 0.57.
Mon Oct 29 15:49:04 2018 - [info] Starting master failover.
Mon Oct 29 15:49:04 2018 - [info]
Mon Oct 29 15:49:04 2018 - [info] * Phase 1: Configuration Check Phase..
Mon Oct 29 15:49:04 2018 - [info]
Mon Oct 29 15:49:05 2018 - [info] GTID failover mode = 1
Mon Oct 29 15:49:05 2018 - [info] Dead Servers:
Mon Oct 29 15:49:05 2018 - [info] 192.168.56.100(192.168.56.100:3306)
Mon Oct 29 15:49:05 2018 - [info] Checking master reachability via MySQL(double check)...
Mon Oct 29 15:49:05 2018 - [info] ok.
Mon Oct 29 15:49:05 2018 - [info] Alive Servers:
Mon Oct 29 15:49:05 2018 - [info] 192.168.56.200(192.168.56.200:3306)
Mon Oct 29 15:49:05 2018 - [info] 192.168.56.210(192.168.56.210:3306)
Mon Oct 29 15:49:05 2018 - [info] Alive Slaves:
Mon Oct 29 15:49:05 2018 - [info] 192.168.56.200(192.168.56.200:3306) Version=5.7.23-log (oldest major version between slaves) log-bin:enabled
Mon Oct 29 15:49:05 2018 - [info] GTID ON
Mon Oct 29 15:49:05 2018 - [info] Replicating from 192.168.56.100(192.168.56.100:3306)
Mon Oct 29 15:49:05 2018 - [info] Primary candidate for the new Master (candidate_master is set)
Mon Oct 29 15:49:05 2018 - [info] 192.168.56.210(192.168.56.210:3306) Version=5.7.23-log (oldest major version between slaves) log-bin:enabled
Mon Oct 29 15:49:05 2018 - [info] GTID ON
Mon Oct 29 15:49:05 2018 - [info] Replicating from 192.168.56.100(192.168.56.100:3306)
Mon Oct 29 15:49:05 2018 - [info] Not candidate for the new Master (no_master is set)
Master 192.168.56.100(192.168.56.100:3306) is dead. Proceed? (yes/NO): yes
Mon Oct 29 15:49:06 2018 - [info] Starting GTID based failover.
Mon Oct 29 15:49:06 2018 - [info]
Mon Oct 29 15:49:06 2018 - [info] ** Phase 1: Configuration Check Phase completed.
Mon Oct 29 15:49:06 2018 - [info]
Mon Oct 29 15:49:06 2018 - [info] * Phase 2: Dead Master Shutdown Phase..
Mon Oct 29 15:49:06 2018 - [info]
Mon Oct 29 15:49:07 2018 - [info] HealthCheck: SSH to 192.168.56.100 is reachable.
Mon Oct 29 15:49:07 2018 - [info] Forcing shutdown so that applications never connect to the current master..
Mon Oct 29 15:49:07 2018 - [info] Executing master IP deactivation script:
Mon Oct 29 15:49:07 2018 - [info] /usr/local/bin/master_ip_failover --orig_master_host=192.168.56.100 --orig_master_ip=192.168.56.100 --orig_master_port=3306 --command=stopssh --ssh_user=root IN SCRIPT TEST====/sbin/ifconfig eth0:0 down==/sbin/ifconfig eth0:0 192.168.56.111/24 up=== Disabling the VIP on old master: 192.168.56.100
Mon Oct 29 15:49:08 2018 - [info] done.
Mon Oct 29 15:49:08 2018 - [warning] shutdown_script is not set. Skipping explicit shutting down of the dead master.
Mon Oct 29 15:49:08 2018 - [info] * Phase 2: Dead Master Shutdown Phase completed.
Mon Oct 29 15:49:08 2018 - [info]
Mon Oct 29 15:49:08 2018 - [info] * Phase 3: Master Recovery Phase..
Mon Oct 29 15:49:08 2018 - [info]
Mon Oct 29 15:49:08 2018 - [info] * Phase 3.1: Getting Latest Slaves Phase..
Mon Oct 29 15:49:08 2018 - [info]
Mon Oct 29 15:49:08 2018 - [info] The latest binary log file/position on all slaves is my3306_binlog.000027:860190114
Mon Oct 29 15:49:08 2018 - [info] Retrieved Gtid Set: 7390a401-b705-11e8-9ed9-080027b0b461:140923-149275
Mon Oct 29 15:49:08 2018 - [info] Latest slaves (Slaves that received relay log files to the latest):
Mon Oct 29 15:49:08 2018 - [info] 192.168.56.200(192.168.56.200:3306) Version=5.7.23-log (oldest major version between slaves) log-bin:enabled
Mon Oct 29 15:49:08 2018 - [info] GTID ON
Mon Oct 29 15:49:08 2018 - [info] Replicating from 192.168.56.100(192.168.56.100:3306)
Mon Oct 29 15:49:08 2018 - [info] Primary candidate for the new Master (candidate_master is set)
Mon Oct 29 15:49:08 2018 - [info] 192.168.56.210(192.168.56.210:3306) Version=5.7.23-log (oldest major version between slaves) log-bin:enabled
Mon Oct 29 15:49:08 2018 - [info] GTID ON
Mon Oct 29 15:49:08 2018 - [info] Replicating from 192.168.56.100(192.168.56.100:3306)
Mon Oct 29 15:49:08 2018 - [info] Not candidate for the new Master (no_master is set)
Mon Oct 29 15:49:08 2018 - [info] The oldest binary log file/position on all slaves is my3306_binlog.000027:860190114
Mon Oct 29 15:49:08 2018 - [info] Retrieved Gtid Set: 7390a401-b705-11e8-9ed9-080027b0b461:140923-149275
Mon Oct 29 15:49:08 2018 - [info] Oldest slaves:
Mon Oct 29 15:49:08 2018 - [info] 192.168.56.200(192.168.56.200:3306) Version=5.7.23-log (oldest major version between slaves) log-bin:enabled
Mon Oct 29 15:49:08 2018 - [info] GTID ON
Mon Oct 29 15:49:08 2018 - [info] Replicating from 192.168.56.100(192.168.56.100:3306)
Mon Oct 29 15:49:08 2018 - [info] Primary candidate for the new Master (candidate_master is set)
Mon Oct 29 15:49:08 2018 - [info] 192.168.56.210(192.168.56.210:3306) Version=5.7.23-log (oldest major version between slaves) log-bin:enabled
Mon Oct 29 15:49:08 2018 - [info] GTID ON
Mon Oct 29 15:49:08 2018 - [info] Replicating from 192.168.56.100(192.168.56.100:3306)
Mon Oct 29 15:49:08 2018 - [info] Not candidate for the new Master (no_master is set)
Mon Oct 29 15:49:08 2018 - [info]
Mon Oct 29 15:49:08 2018 - [info] * Phase 3.3: Determining New Master Phase..
Mon Oct 29 15:49:08 2018 - [info]
Mon Oct 29 15:49:08 2018 - [info] 192.168.56.200 can be new master.
Mon Oct 29 15:49:08 2018 - [info] New master is 192.168.56.200(192.168.56.200:3306)
Mon Oct 29 15:49:08 2018 - [info] Starting master failover..
Mon Oct 29 15:49:08 2018 - [info]
From:
192.168.56.100(192.168.56.100:3306) (current master)
+--192.168.56.200(192.168.56.200:3306)
+--192.168.56.210(192.168.56.210:3306) To:
192.168.56.200(192.168.56.200:3306) (new master)
+--192.168.56.210(192.168.56.210:3306) Starting master switch from 192.168.56.100(192.168.56.100:3306) to 192.168.56.200(192.168.56.200:3306)? (yes/NO): yes
Mon Oct 29 15:49:09 2018 - [info] New master decided manually is 192.168.56.200(192.168.56.200:3306)
Mon Oct 29 15:49:09 2018 - [info]
Mon Oct 29 15:49:09 2018 - [info] * Phase 3.3: New Master Recovery Phase..
Mon Oct 29 15:49:09 2018 - [info]
Mon Oct 29 15:49:09 2018 - [info] Waiting all logs to be applied..
Mon Oct 29 15:49:09 2018 - [info] done.
Mon Oct 29 15:49:09 2018 - [info] Getting new master's binlog name and position..
Mon Oct 29 15:49:09 2018 - [info] my3306_binlog.000016:965341200
Mon Oct 29 15:49:09 2018 - [info] All other slaves should start replication from here. Statement should be: CHANGE MASTER TO MASTER_HOST='192.168.56.200', MASTER_PORT=3306, MASTER_AUTO_POSITION=1, MASTER_USER='repl', MASTER_PASSWORD='xxx';
Mon Oct 29 15:49:09 2018 - [info] Master Recovery succeeded. File:Pos:Exec_Gtid_Set: my3306_binlog.000016, 965341200, 7390a401-b705-11e8-9ed9-080027b0b461:1-149275,
a4774e9e-bba9-11e8-bf3e-08002712513f:1-2
Mon Oct 29 15:49:09 2018 - [info] Executing master IP activate script:
Mon Oct 29 15:49:09 2018 - [info] /usr/local/bin/master_ip_failover --command=start --ssh_user=root --orig_master_host=192.168.56.100 --orig_master_ip=192.168.56.100 --orig_master_port=3306 --new_master_host=192.168.56.200 --new_master_ip=192.168.56.200 --new_master_port=3306 --new_master_user='mha_rep' --new_master_password=xxx
Unknown option: new_master_user
Unknown option: new_master_password IN SCRIPT TEST====/sbin/ifconfig eth0:0 down==/sbin/ifconfig eth0:0 192.168.56.111/24 up=== Enabling the VIP - 192.168.56.111/24 on the new master - 192.168.56.200
bash: /usr/bin/arping: No such file or directory
Mon Oct 29 15:49:10 2018 - [info] OK.
Mon Oct 29 15:49:10 2018 - [info] Setting read_only=0 on 192.168.56.200(192.168.56.200:3306)..
Mon Oct 29 15:49:10 2018 - [info] ok.
Mon Oct 29 15:49:10 2018 - [info] ** Finished master recovery successfully.
Mon Oct 29 15:49:10 2018 - [info] * Phase 3: Master Recovery Phase completed.
Mon Oct 29 15:49:10 2018 - [info]
Mon Oct 29 15:49:10 2018 - [info] * Phase 4: Slaves Recovery Phase..
Mon Oct 29 15:49:10 2018 - [info]
Mon Oct 29 15:49:10 2018 - [info]
Mon Oct 29 15:49:10 2018 - [info] * Phase 4.1: Starting Slaves in parallel..
Mon Oct 29 15:49:10 2018 - [info]
Mon Oct 29 15:49:10 2018 - [info] -- Slave recovery on host 192.168.56.210(192.168.56.210:3306) started, pid: 16740. Check tmp log /var/log/masterha/app1/192.168.56.210_3306_20181029154904.log if it takes time..
Mon Oct 29 15:49:12 2018 - [info]
Mon Oct 29 15:49:12 2018 - [info] Log messages from 192.168.56.210 ...
Mon Oct 29 15:49:12 2018 - [info]
Mon Oct 29 15:49:10 2018 - [info] Resetting slave 192.168.56.210(192.168.56.210:3306) and starting replication from the new master 192.168.56.200(192.168.56.200:3306)..
Mon Oct 29 15:49:10 2018 - [info] Executed CHANGE MASTER.
Mon Oct 29 15:49:11 2018 - [info] Slave started.
Mon Oct 29 15:49:11 2018 - [info] gtid_wait(7390a401-b705-11e8-9ed9-080027b0b461:1-149275,
a4774e9e-bba9-11e8-bf3e-08002712513f:1-2) completed on 192.168.56.210(192.168.56.210:3306). Executed 0 events.
Mon Oct 29 15:49:12 2018 - [info] End of log messages from 192.168.56.210.
Mon Oct 29 15:49:12 2018 - [info] -- Slave on host 192.168.56.210(192.168.56.210:3306) started.
Mon Oct 29 15:49:12 2018 - [info] All new slave servers recovered successfully.
Mon Oct 29 15:49:12 2018 - [info]
Mon Oct 29 15:49:12 2018 - [info] * Phase 5: New master cleanup phase..
Mon Oct 29 15:49:12 2018 - [info]
Mon Oct 29 15:49:12 2018 - [info] Resetting slave info on the new master..
Mon Oct 29 15:49:13 2018 - [info] 192.168.56.200: Resetting slave info succeeded.
Mon Oct 29 15:49:13 2018 - [info] Master failover to 192.168.56.200(192.168.56.200:3306) completed successfully.
Mon Oct 29 15:49:13 2018 - [info] ----- Failover Report ----- app1: MySQL Master failover 192.168.56.100(192.168.56.100:3306) to 192.168.56.200(192.168.56.200:3306) succeeded Master 192.168.56.100(192.168.56.100:3306) is down! Check MHA Manager logs at mysqldb2 for details. Started manual(interactive) failover.
Invalidated master IP address on 192.168.56.100(192.168.56.100:3306)
Selected 192.168.56.200(192.168.56.200:3306) as a new master.
192.168.56.200(192.168.56.200:3306): OK: Applying all logs succeeded.
192.168.56.200(192.168.56.200:3306): OK: Activated master IP address.
192.168.56.210(192.168.56.210:3306): OK: Slave started, replicating from 192.168.56.200(192.168.56.200:3306)
192.168.56.200(192.168.56.200:3306): Resetting slave info succeeded.
Master failover to 192.168.56.200(192.168.56.200:3306) completed successfully.

6. 原mysqldb1手工加入集群

mysql> CHANGE MASTER TO MASTER_HOST='192.168.56.200', \
MASTER_PORT=3306, \
MASTER_AUTO_POSITION=1, \
MASTER_USER='repl', \
MASTER_PASSWORD='wanbin'; mysql> start slave;

7. 手工在线切换

masterha_master_switch --conf=/etc/masterha/app1.cnf --master_state=alive --new_master_host=192.168.56.100 --orig_master_is_new_slave

利用sysbench工具测试MHA的更多相关文章

  1. sysbench压力测试工具简介和使用(二)

    sysbench压力测试工具使用: 2.1    测试数据库服务器的硬件配置信息如下: CPU:      24核心线程数,Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00G ...

  2. sysbench压力测试工具简介和使用(一)

    sysbench压力测试工具安装和参数介绍 一.sysbench压力测试工具简介: sysbench是一个开源的.模块化的.跨平台的多线程性能测试工具,可以用来进行CPU.内存.磁盘I/O.线程.数据 ...

  3. sysbench压力测试工具安装和参数介绍

    一.sysbench压力测试工具简介: sysbench是一个开源的.模块化的.跨平台的多线程性能测试工具,可以用来进行CPU.内存.磁盘I/O.线程.数据库的性能测试.目前支持的数据库有MySQL. ...

  4. sysbench 压力测试工具

    一.sysbench压力测试工具简介: sysbench是一个开源的.模块化的.跨平台的多线程性能测试工具,可以用来进行CPU.内存.磁盘I/O.线程.数据库的性能测试.目前支持的数据库有MySQL. ...

  5. show processlist,sysbench压力测试工具

    processlist.sh 记录数据库的状态 #!/bin/bash while true do mysql -uroot -pwangxiaohu -e 'show processlist\G'| ...

  6. 【转帖】sysbench压力测试工具简介

    sysbench压力测试工具简介 https://www.cnblogs.com/pdlife/p/6698957.html 一.sysbench压力测试工具简介: sysbench是一个开源的.模块 ...

  7. sysbench压力测试工具简介

    一.sysbench压力测试工具简介: sysbench是一个开源的.模块化的.跨平台的多线程性能测试工具,可以用来进行CPU.内存.磁盘I/O.线程.数据库的性能测试.目前支持的数据库有MySQL. ...

  8. sysbench压力测试工具安装及使用

    使用sysbench指定连接的时候不需要写上mysql-socket参数 如果自己使用sysbench来测试mysql性能的话,建议使用源码编译比较好,版本为0.4版本. 步骤是: .yum inst ...

  9. 用systemtap对sysbench IO测试结果的分析1

    http://www.actionsky.com/docs/archives/171  2016年5月6日  黄炎 近期在一些简单的sysbench IO测试中, 遇到了一些不合常识的测试结果. 从结 ...

随机推荐

  1. Git 深度学习填坑之旅一(git安装和配置、基本命令)

    前戏 最近不管是工作还是ctf比赛,接触与使用git变得越来越多,git半吊子水平的我已经不能支撑日常工作了.碰巧自己公司项目刚上线,现在能挤出一点时间来挖一下这个坑... 为什么使用Git 1.后悔 ...

  2. 微信小程序采坑之上拉触底加载更多和下拉刷新

    小程序中加载更多数据一般都是触底刷新 有自带的函数: onReachBottom: function (){} 但是在使用时触发完全没有反应,后来尝试给外层加了一个高度,解决问题 仔细想想也是,没有设 ...

  3. Sanic框架

    Sanic框架 1. 入门 Sanic 是一款类似Flask的Web服务器,它运行在Python 3.5+上. 除了与Flask功能类似之外,它还支持异步请求处理,这意味着你可以使用Python3.5 ...

  4. Luogu P3166 [CQOI2014]数三角形 组合数学

    好题鸭.. 不好直接求三角形个数,那就用全集-补集,转化为求三点共线的数量. 具体求法是求出水平共线数量与竖直共线数量和斜线共线数量. 用排列组合的知识可知为水平和竖直的为$C_n^3$​与$C_m^ ...

  5. BZOJ-3555:企鹅QQ(字符串哈希)

    PenguinQQ是中国最大.最具影响力的SNS(Social Networking Services)网站,以实名制为基础,为用户提供日志.群.即时通讯.相册.集市等丰富强大的互联网功能体验,满足用 ...

  6. Codeforces Round #527-B. Teams Forming(贪心)

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  7. Mac OS X

    Mac OS X 除了微软自家的Windows平台, .NET Core针对Mac OS以及各种Linux(RHEL.Ubuntu.Debian.Fedora.CentOS和SUSE等)都提供了很好的 ...

  8. 爬虫(Xpath)——爬tieba.baidu.com

    工具:python3 核心知识点: 1)lxml包不能用pip下载,因为里面有其他语言编写的文件 2)urlopen返回的请求是html文件,要使用 content = etree.HTML(html ...

  9. 简单记录下SpringCloud的微服务架构和一些概念

    一.微服务的注册与发现——Eureka 和许多分布式设计一样,分布式的应用一般都会有一个服务中心,用于记录各个机器的信息.微服务架构也一样,我们把一个大的应用解耦成这么多个那么多个服务,那么在想要调用 ...

  10. js控制语句

    1 条件判断语句 条件语句用于基于不同的条件来执行不同的动作. 1.1if 语句 if (condition){    当条件为 true 时执行的代码} 1.2if...else 语句 if (co ...