设为首页 加入收藏

TOP

MHA安装配置(十二)
2015-11-21 01:45:21 来源: 作者: 【 】 浏览:9
Tags:MHA 安装 配置
a new master. mysql-mha01(192.168.8.6:3306): OK: Applying all logs succeeded. mysql-mha03(192.168.8.8:3306): This host has the latest relay log events. Generating relay diff files from the latest slave succeeded. mysql-mha03(192.168.8.8:3306): OK: Applying all logs succeeded. Slave started, replicating from mysql-mha01(192.168.8.6:3306) mysql-mha01(192.168.8.6:3306): Resetting slave info succeeded. Master failover to mysql-mha01(192.168.8.6:3306) completed successfully.
发现MHA已经成功将主节点配置到mysql-mha01上。切换后manager节点自动关闭。
[root@mysql-mha03 ~]# ps -ef|grep -i master
root       6414   3295  0 15:00 pts/1    00:00:00 grep -i master
登录到mysql-mha03节点查看
mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.8.6
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 20
              Master_Log_File: mysql-bin.000014
          Read_Master_Log_Pos: 107
               Relay_Log_File: mysql-mha03-relay-bin.000002
                Relay_Log_Pos: 253
        Relay_Master_Log_File: mysql-bin.000014
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 107
              Relay_Log_Space: 415
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 1
1 row in set (0.00 sec)
host已经改变成功。MHA配置成功。

5.2 主动切换

mha可以实现master的主动切换,可以让我们方便的维护集群环境。如我们可以将master切换到别的节点,维护原master节点。 需要将启动的manager节点关闭掉,否则会报错。
[root@mysql-mha03 ~]# masterha_stop --conf=/etc/MHA/MHAmanager.conf 
Stopped MHAmanager successfully.
[1]+  Exit 1                  nohup masterha_manager --conf=/etc/MHA/MHAmanager.conf


我们主动切换master节点,原master节点成为slave节点
[root@mysql-mha03 ~]# masterha_master_switch --master_state=alive --conf=/etc/MHA/MHAmanager.conf
查看输出
Thu Jul 23 15:29:38 2015 - [info] MHA::MasterRotate version 0.56.
Thu Jul 23 15:29:38 2015 - [info] Starting online master switch..
Thu Jul 23 15:29:38 2015 - [info] 
Thu Jul 23 15:29:38 2015 - [info] * Phase 1: Configuration Check Phase..
Thu Jul 23 15:29:38 2015 - [info] 
Thu Jul 23 15:29:38 2015 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Thu Jul 23 15:29:38 2015 - [info] Reading application default configuration from /etc/MHA/MHAmanager.conf..
Thu Jul 23 15:29:38 2015 - [info] Reading server configuration from /etc/MHA/MHAmanager.conf..
Thu Jul 23 15:29:39 2015 - [info] GTID failover mode = 0
Thu Jul 23 15:29:39 2015 - [info] Current Alive Master: mysql-mha01(192.168.8.6:3306)
Thu Jul 23 15:29:39 2015 - [info] Alive Slaves:
Thu Jul 23 15:29:39 2015 - [info]   mysql-mha02(192.168.8.7:3306)  Version=5.5.43-log (oldest major version between slaves) log-bin:enabled
Thu Jul 23 15:29:39 2015 - [info]     Replicating from 192.168.8.6(192.168.8.6:3306)
Thu Jul 23 15:29:39 2015 - [info]   mysql-mha03(192.168.8.8:3306)  Version=5.5.43-log (oldest major versio
首页 上一页 9 10 11 12 13 下一页 尾页 12/13/13
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇PerformanceTuningguide翻译||前言 下一篇PowerDesignerGraphicalSynonym(..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: