zoukankan      html  css  js  c++  java
  • MHA手动切换 原创4 (非交互式切换)

    非交互式切换:不输 YES 或者 NO



    [root@monitor app1]# masterha_master_switch --conf=/etc/masterha/app1.conf --master_state=alive --new_master_host=slave1 --orig_master_is_new_slave --interactive=0; Mon May 16 14:51:44 2016 - [info] MHA::MasterRotate version 0.56. Mon May 16 14:51:44 2016 - [info] Starting online master switch.. Mon May 16 14:51:44 2016 - [info] Mon May 16 14:51:44 2016 - [info] * Phase 1: Configuration Check Phase.. Mon May 16 14:51:44 2016 - [info] Mon May 16 14:51:44 2016 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping. Mon May 16 14:51:44 2016 - [info] Reading application default configuration from /etc/masterha/app1.conf.. Mon May 16 14:51:44 2016 - [info] Reading server configuration from /etc/masterha/app1.conf.. Mon May 16 14:51:44 2016 - [debug] Connecting to servers.. Mon May 16 14:51:45 2016 - [debug] Connected to: server1(10.24.220.232:3306), user=root Mon May 16 14:51:45 2016 - [debug] Number of slave worker threads on host server1(10.24.220.232:3306): 0 Mon May 16 14:51:45 2016 - [debug] Connected to: slave1(10.24.220.70:3306), user=root Mon May 16 14:51:45 2016 - [debug] Number of slave worker threads on host slave1(10.24.220.70:3306): 0 Mon May 16 14:51:45 2016 - [debug] Connected to: slave2(10.169.214.33:3306), user=root Mon May 16 14:51:45 2016 - [debug] Number of slave worker threads on host slave2(10.169.214.33:3306): 0 Mon May 16 14:51:45 2016 - [debug] Comparing MySQL versions.. Mon May 16 14:51:45 2016 - [debug] Comparing MySQL versions done. Mon May 16 14:51:45 2016 - [debug] Connecting to servers done. Mon May 16 14:51:45 2016 - [info] Multi-master configuration is detected. Current primary(writable) master is server1(10.24.220.232:3306) Mon May 16 14:51:45 2016 - [info] Master configurations are as below: Master slave1(10.24.220.70:3306), replicating from 10.24.220.232(10.24.220.232:3306), read-only Master server1(10.24.220.232:3306), replicating from slave1(10.24.220.70:3306) Mon May 16 14:51:45 2016 - [info] GTID failover mode = 1 Mon May 16 14:51:45 2016 - [info] Current Alive Master: server1(10.24.220.232:3306) Mon May 16 14:51:45 2016 - [info] Alive Slaves: Mon May 16 14:51:45 2016 - [info] slave1(10.24.220.70:3306) Version=5.7.11-log (oldest major version between slaves) log-bin:enabled Mon May 16 14:51:45 2016 - [info] GTID ON Mon May 16 14:51:45 2016 - [debug] Relay log info repository: FILE Mon May 16 14:51:45 2016 - [info] Replicating from 10.24.220.232(10.24.220.232:3306) Mon May 16 14:51:45 2016 - [info] Primary candidate for the new Master (candidate_master is set) Mon May 16 14:51:45 2016 - [info] slave2(10.169.214.33:3306) Version=5.7.11-log (oldest major version between slaves) log-bin:enabled Mon May 16 14:51:45 2016 - [info] GTID ON Mon May 16 14:51:45 2016 - [debug] Relay log info repository: FILE Mon May 16 14:51:45 2016 - [info] Replicating from 10.24.220.232(10.24.220.232:3306) Mon May 16 14:51:45 2016 - [info] Not candidate for the new Master (no_master is set) Mon May 16 14:51:45 2016 - [info] Executing FLUSH NO_WRITE_TO_BINLOG TABLES. This may take long time.. Mon May 16 14:51:45 2016 - [info] ok. Mon May 16 14:51:45 2016 - [info] Checking MHA is not monitoring or doing failover.. Mon May 16 14:51:45 2016 - [info] Checking replication health on slave1.. Mon May 16 14:51:45 2016 - [info] ok. Mon May 16 14:51:45 2016 - [info] Checking replication health on slave2.. Mon May 16 14:51:45 2016 - [info] ok. Mon May 16 14:51:45 2016 - [info] slave1 can be new master. Mon May 16 14:51:45 2016 - [info] From: server1(10.24.220.232:3306) (current master) +--slave1(10.24.220.70:3306) +--slave2(10.169.214.33:3306) To: slave1(10.24.220.70:3306) (new master) +--slave2(10.169.214.33:3306) +--server1(10.24.220.232:3306) Mon May 16 14:51:45 2016 - [info] Checking whether slave1(10.24.220.70:3306) is ok for the new master.. Mon May 16 14:51:45 2016 - [info] ok. Mon May 16 14:51:45 2016 - [info] ** Phase 1: Configuration Check Phase completed. Mon May 16 14:51:45 2016 - [info] Mon May 16 14:51:45 2016 - [debug] Disconnected from server1(10.24.220.232:3306) Mon May 16 14:51:45 2016 - [info] * Phase 2: Rejecting updates Phase.. Mon May 16 14:51:45 2016 - [info] Mon May 16 14:51:45 2016 - [warning] master_ip_online_change_script is not defined. Skipping disabling writes on the current master. Mon May 16 14:51:45 2016 - [info] Locking all tables on the orig master to reject updates from everybody (including root): Mon May 16 14:51:45 2016 - [info] Executing FLUSH TABLES WITH READ LOCK.. Mon May 16 14:51:45 2016 - [info] ok. Mon May 16 14:51:45 2016 - [info] Orig master binlog:pos is log.000003:194. Mon May 16 14:51:45 2016 - [debug] Fetching current slave status.. Mon May 16 14:51:45 2016 - [debug] Fetching current slave status done. Mon May 16 14:51:45 2016 - [info] Waiting to execute all relay logs on slave1(10.24.220.70:3306).. Mon May 16 14:51:45 2016 - [info] master_pos_wait(log.000003:194) completed on slave1(10.24.220.70:3306). Executed 0 events. Mon May 16 14:51:45 2016 - [info] done. Mon May 16 14:51:45 2016 - [debug] Stopping SQL thread on slave1(10.24.220.70:3306).. Mon May 16 14:51:45 2016 - [debug] done. Mon May 16 14:51:45 2016 - [info] Getting new master's binlog name and position.. Mon May 16 14:51:45 2016 - [info] log.000003:194 Mon May 16 14:51:45 2016 - [info] All other slaves should start replication from here. Statement should be: CHANGE MASTER TO MASTER_HOST='slave1 or 10.24.220.70', MASTER_PORT=3306, MASTER_AUTO_POSITION=1, MASTER_USER='repl', MASTER_PASSWORD='xxx'; Mon May 16 14:51:45 2016 - [info] Setting read_only=0 on slave1(10.24.220.70:3306).. Mon May 16 14:51:45 2016 - [info] ok. Mon May 16 14:51:45 2016 - [info] Mon May 16 14:51:45 2016 - [info] * Switching slaves in parallel.. Mon May 16 14:51:45 2016 - [info] Mon May 16 14:51:45 2016 - [info] -- Slave switch on host slave2(10.169.214.33:3306) started, pid: 8045 Mon May 16 14:51:45 2016 - [info] Mon May 16 14:51:46 2016 - [info] Log messages from slave2 ... Mon May 16 14:51:46 2016 - [info] Mon May 16 14:51:45 2016 - [info] Waiting to execute all relay logs on slave2(10.169.214.33:3306).. Mon May 16 14:51:45 2016 - [info] master_pos_wait(log.000003:194) completed on slave2(10.169.214.33:3306). Executed 0 events. Mon May 16 14:51:45 2016 - [info] done. Mon May 16 14:51:45 2016 - [debug] Stopping SQL thread on slave2(10.169.214.33:3306).. Mon May 16 14:51:45 2016 - [debug] done. Mon May 16 14:51:45 2016 - [info] Resetting slave slave2(10.169.214.33:3306) and starting replication from the new master slave1(10.24.220.70:3306).. Mon May 16 14:51:45 2016 - [debug] Stopping slave IO/SQL thread on slave2(10.169.214.33:3306).. Mon May 16 14:51:45 2016 - [debug] done. Mon May 16 14:51:45 2016 - [info] Executed CHANGE MASTER. Mon May 16 14:51:45 2016 - [debug] Starting slave IO/SQL thread on slave2(10.169.214.33:3306).. Mon May 16 14:51:46 2016 - [debug] done. Mon May 16 14:51:46 2016 - [info] Slave started. Mon May 16 14:51:46 2016 - [info] End of log messages from slave2 ... Mon May 16 14:51:46 2016 - [info] Mon May 16 14:51:46 2016 - [info] -- Slave switch on host slave2(10.169.214.33:3306) succeeded. Mon May 16 14:51:46 2016 - [info] Unlocking all tables on the orig master: Mon May 16 14:51:46 2016 - [info] Executing UNLOCK TABLES.. Mon May 16 14:51:46 2016 - [info] ok. Mon May 16 14:51:46 2016 - [info] Starting orig master as a new slave.. Mon May 16 14:51:46 2016 - [info] Resetting slave server1(10.24.220.232:3306) and starting replication from the new master slave1(10.24.220.70:3306).. Mon May 16 14:51:46 2016 - [debug] Stopping slave IO/SQL thread on server1(10.24.220.232:3306).. Mon May 16 14:51:46 2016 - [debug] done. Mon May 16 14:51:46 2016 - [info] Executed CHANGE MASTER. Mon May 16 14:51:46 2016 - [debug] Starting slave IO/SQL thread on server1(10.24.220.232:3306).. Mon May 16 14:51:47 2016 - [debug] done. Mon May 16 14:51:47 2016 - [info] Slave started. Mon May 16 14:51:47 2016 - [debug] ok. Mon May 16 14:51:47 2016 - [info] All new slave servers switched successfully. Mon May 16 14:51:47 2016 - [info] Mon May 16 14:51:47 2016 - [info] * Phase 5: New master cleanup phase.. Mon May 16 14:51:47 2016 - [info] Mon May 16 14:51:47 2016 - [debug] Clearing slave info.. Mon May 16 14:51:47 2016 - [debug] Stopping slave IO/SQL thread on slave1(10.24.220.70:3306).. Mon May 16 14:51:47 2016 - [debug] done. Mon May 16 14:51:47 2016 - [debug] SHOW SLAVE STATUS shows new master does not replicate from anywhere. OK. Mon May 16 14:51:47 2016 - [info] slave1: Resetting slave info succeeded. Mon May 16 14:51:47 2016 - [info] Switching master to slave1(10.24.220.70:3306) completed successfully. Mon May 16 14:51:47 2016 - [debug] Disconnected from server1(10.24.220.232:3306) Mon May 16 14:51:47 2016 - [debug] Disconnected from slave1(10.24.220.70:3306) Mon May 16 14:51:47 2016 - [debug] Disconnected from slave2(10.169.214.33:3306) [root@monitor app1]#
  • 相关阅读:
    基于ZKEACMS的.Net Core多租户CMS建站系统
    使用PowerShell自动部署ASP.NetCore程序到IIS
    在Linux安装ASP.Net Core的运行时(Runtime)
    ASP .Net Core 2.0 修改默认端口
    .Net Core内存回收模式及性能测试对比
    .Net Core配置与自动更新
    Razor TagHelper实现Markdown转HTML
    用Docker自动构建纸壳CMS
    纸壳CMS 2.3,正式加入商城功能
    Linux使用私钥公钥(Public key)登录
  • 原文地址:https://www.cnblogs.com/zengkefu/p/5498093.html
Copyright © 2011-2022 走看看