国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

MHA實現mysql5.6主從切換安裝配置教程

2024-07-24 12:39:25
字體:
來源:轉載
供稿:網友

下面給各位介紹一下MHA實現mysql5.6主從切換安裝配置教程,希望此教程能幫助到大家.

基于這里的master/slave復制,我們這里介紹下MHA軟件的安裝與測試.

一、安裝MHA軟件:

  1. yum -y install perl-DBD-MySQL perl-Config-Tiny perl-Log-Dispatch perl-Parallel-ForkManager 
  2.  
  3. wget http://mysql-master-ha.googlecode.com/files/mha4mysql-node-0.52-0.noarch.rpm 
  4. wget https://mysql-master-ha.googlecode.com/files/mha4mysql-manager-0.52-0.noarch.rpm 
  5. wget https://mysql-master-ha.googlecode.com/files/mha4mysql-manager-0.52.tar.gz 

rpm包安裝:

  1. rpm -ivh mha4mysql-manager-0.52-0.noarch.rpm 
  2. rpm -ivh mha4mysql-node-0.52-0.noarch.rpm 

源碼包安裝(我這里采用源碼包安裝,manager安裝在slave上):

  1. tar zxvf mha4mysql-manager-0.52.tar.gz 
  2. cd mha4mysql-manager-0.52 
  3. perl Makefile.PL 
  4. make 
  5. make install 

二、配置基本環境:

1、配置master和slave之間可以ssh無密碼登陸(這里略)

2、保證mha manager能登陸主從服務器的mysql

  1. --10.1.1.231上執行: 
  2.  
  3. grant all privileges on *.* to 'root'@'10.1.1.234' identified by 'rootpasswd'
  4. flush privileges
  5.  
  6. --10.1.1.234上執行: 
  7.  
  8. grant all privileges on *.* to 'root'@'10.1.1.231' identified by 'rootpasswd'
  9. flush privileges

三、修改mha的manager配置文件:

  1. [root@localhost mha4mysql-manager-0.52]#mkdir /etc/masterha 
  2. [root@localhost mha4mysql-manager-0.52]#mkdir -p /masterha/app1 
  3. [root@localhost mha4mysql-manager-0.52]#cp samples/conf/* /etc/masterha/ 
  4. [root@localhost mha4mysql-manager-0.52]#cat /etc/masterha/app1.cnf   
  5. [root@localhost mha4mysql-manager-0.52]#mkdir /etc/masterha 
  6. [root@localhost mha4mysql-manager-0.52]#mkdir -p /masterha/app1 
  7. [root@localhost mha4mysql-manager-0.52]#cp samples/conf/* /etc/masterha/ 
  8. [root@localhost mha4mysql-manager-0.52]#cat /etc/masterha/app1.cnf 
  9.  
  10. [server default
  11. manager_workdir=/masterha/app1/ 
  12. manager_log=/masterha/app1/manager.log 
  13. user=root  
  14. password=d3n0v0 
  15. ssh_user=root  
  16. repl_user=jpsync 
  17. repl_password=jpsyncpass2014la 
  18. ping_interval=1  
  19. shutdown_script=""  
  20. #master_ip_failover_script="/usr/local/bin/master_ip_failover"  
  21. master_ip_online_change_script=""  
  22. report_script="" 
  23.  
  24. [server1] 
  25. hostname=10.1.1.231 
  26. port=63306 
  27. master_binlog_dir="/state/partition1/mysql/data"  
  28. candidate_master=1 
  29. --Vevb.com 
  30. [server2] 
  31. hostname=10.1.1.234 
  32. port=63306 
  33. master_binlog_dir="/state/partition1/mysql/data"  
  34. candidate_master=1 

四、檢測配置:檢查ssh:

  1. [root@localhost masterha]# masterha_check_ssh  --conf=/etc/masterha/app1.cnf   
  2. Fri Sep 12 15:23:25 2014 - [info] Reading default configuratoins from /etc/masterha_default.cnf.. 
  3. Fri Sep 12 15:23:25 2014 - [info] Reading application default configurations from /etc/masterha/app1.cnf.. 
  4. Fri Sep 12 15:23:25 2014 - [info] Reading server configurations from /etc/masterha/app1.cnf.. 
  5. Fri Sep 12 15:23:25 2014 - [info] Starting SSH connection tests.. 
  6. Fri Sep 12 15:23:32 2014 - [debug]  
  7. Fri Sep 12 15:23:25 2014 - [debug]  Connecting via SSH from root@10.1.1.231(10.1.1.231) to root@10.1.1.234(10.1.1.234).. 
  8. Warning: untrusted X11 forwarding setup failed: xauth key data not generated 
  9. Warning: No xauth data; using fake authentication data for X11 forwarding. 
  10. Fri Sep 12 15:23:32 2014 - [debug]   ok. 
  11. Fri Sep 12 15:23:38 2014 - [debug]  
  12. Fri Sep 12 15:23:26 2014 - [debug]  Connecting via SSH from root@10.1.1.234(10.1.1.234) to root@10.1.1.231(10.1.1.231).. 
  13. Warning: untrusted X11 forwarding setup failed: xauth key data not generated 
  14. Warning: No xauth data; using fake authentication data for X11 forwarding. 
  15. Warning: untrusted X11 forwarding setup failed: xauth key data not generated 
  16. Warning: No xauth data; using fake authentication data for X11 forwarding. 
  17. Fri Sep 12 15:23:38 2014 - [debug]   ok. 
  18. Fri Sep 12 15:23:38 2014 - [info] All SSH connection tests passed successfully. 

檢查mha啟動狀態:

  1. [root@localhost masterha]# masterha_check_status  --conf=/etc/masterha/app1.cnf  
  2. app1 (pid:11444) is running(0:PING_OK), master:10.1.1.231 

檢查主從復制狀態:

  1. [root@compute-0-52 masterha]# masterha_check_repl  --conf=/etc/masterha/app1.cnf  
  2. Fri Sep 12 16:15:12 2014 - [info] Reading default configuratoins from /etc/masterha_default.cnf.. 
  3. Fri Sep 12 16:15:12 2014 - [info] Reading application default configurations from /etc/masterha/app1.cnf.. 
  4. Fri Sep 12 16:15:12 2014 - [info] Reading server configurations from /etc/masterha/app1.cnf.. 
  5. Fri Sep 12 16:15:12 2014 - [info] MHA::MasterMonitor version 0.52. 
  6. Fri Sep 12 16:15:12 2014 - [info] Dead Servers: 
  7. Fri Sep 12 16:15:12 2014 - [info] Alive Servers: 
  8. Fri Sep 12 16:15:12 2014 - [info]   10.1.1.231(10.1.1.231:3306) 
  9. Fri Sep 12 16:15:12 2014 - [info]   10.1.1.234(10.1.1.234:3306) 
  10. Fri Sep 12 16:15:12 2014 - [info] Alive Slaves: 
  11. Fri Sep 12 16:15:12 2014 - [info]   10.1.1.234(10.1.1.234:3306)  Version=5.6.13-log (oldest major version between slaves) log-bin:enabled 
  12. Fri Sep 12 16:15:12 2014 - [info]     Replicating from 10.1.1.231(10.1.1.231:3306) 
  13. Fri Sep 12 16:15:12 2014 - [info]     Primary candidate for the new Master (candidate_master is set
  14. Fri Sep 12 16:15:12 2014 - [info] Current Alive Master: 10.1.1.231(10.1.1.231:3306) 
  15. Fri Sep 12 16:15:12 2014 - [info] Checking slave configurations.. 
  16. Fri Sep 12 16:15:12 2014 - <div class="warning shortcodestyle"></div>  relay_log_purge=0 is not set on slave 10.1.1.234(10.1.1.234:3306). 
  17. Fri Sep 12 16:15:12 2014 - [info] Checking replication filtering settings.. 
  18. Fri Sep 12 16:15:12 2014 - [info]  binlog_do_db= denovo_ng, binlog_ignore_db= information_schema,mysql,test 
  19. Fri Sep 12 16:15:12 2014 - [info]  Replication filtering check ok. 
  20. Fri Sep 12 16:15:12 2014 - [info] Starting SSH connection tests.. 
  21. Fri Sep 12 16:15:25 2014 - [info] All SSH connection tests passed successfully. 
  22. Fri Sep 12 16:15:25 2014 - [info] Checking MHA Node version.. 
  23. Fri Sep 12 16:15:32 2014 - [info]  Version check ok. 
  24. Fri Sep 12 16:15:32 2014 - [info] Checking SSH publickey authentication and checking recovery script configurations on the current master.. 
  25. Fri Sep 12 16:15:38 2014 - [info]   Executing command: save_binary_logs --command=test --start_file=mysql-master-bin.000004 --start_pos=4 --binlog_dir=/state/partition1/mysql/data --output_file=/var/tmp/save_binary_logs_test --manager_version=0.52  
  26. Fri Sep 12 16:15:38 2014 - [info]   Connecting to root@10.1.1.231(10.1.1.231)..  
  27. Warning: untrusted X11 forwarding setup failed: xauth key data not generated 
  28. Warning: No xauth data; using fake authentication data for X11 forwarding. 
  29.   Creating /var/tmp if not exists..    ok. 
  30.   Checking output directory is accessible or not.. 
  31.    ok. 
  32.   Binlog found at /state/partition1/mysql/data, up to mysql-master-bin.000004 
  33. Fri Sep 12 16:15:45 2014 - [info] Master setting check done. 
  34. Fri Sep 12 16:15:45 2014 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers.. 
  35. Fri Sep 12 16:15:45 2014 - [info]   Executing command : apply_diff_relay_logs --command=test --slave_user=root --slave_host=10.1.1.234 --slave_ip=10.1.1.234 --slave_port=63306 --workdir=/var/tmp --target_version=5.6.13-log --manager_version=0.52 --relay_log_info=/state/partition1/mysql/data/relay-log.info  --slave_pass=xxx 
  36. Fri Sep 12 16:15:45 2014 - [info]   Connecting to root@10.1.1.234(10.1.1.234)..  
  37. Warning: untrusted X11 forwarding setup failed: xauth key data not generated 
  38. Warning: No xauth data; using fake authentication data for X11 forwarding. 
  39.   Checking slave recovery environment settings.. 
  40.     Opening /state/partition1/mysql/data/relay-log.info ... ok. 
  41.     Relay log found at /state/partition1/mysql/data, up to compute-0-52-relay-bin.000007 
  42.     Temporary relay log file is /state/partition1/mysql/data/compute-0-52-relay-bin.000007 
  43.     Testing mysql connection and privileges..Warning: Using a password on the command line interface can be insecure. 
  44. mysql: Unknown OS character set 'ISO-8859-15'
  45. mysql: Switching to the default character set 'latin1'
  46.  done. 
  47.     Testing mysqlbinlog output.. done. 
  48.     Cleaning up test file(s).. done. 
  49. Fri Sep 12 16:15:51 2014 - [info] Slaves settings check done. 
  50. Fri Sep 12 16:15:51 2014 - [info]  
  51. 10.1.1.231 (current master) 
  52.  +--10.1.1.234 
  53.  
  54. Fri Sep 12 16:15:51 2014 - [info] Checking replication health on 10.1.1.234.. 
  55. Fri Sep 12 16:15:51 2014 - [info]  ok. 
  56. Fri Sep 12 16:15:51 2014 - <div class="warning shortcodestyle"></div> master_ip_failover_script is not defined. 
  57. Fri Sep 12 16:15:51 2014 - <div class="warning shortcodestyle"></div> shutdown_script is not defined. 
  58. Fri Sep 12 16:15:51 2014 - [info] Got exit code 0 (Not master dead). 
  59.  
  60. MySQL Replication Health is OK

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 永寿县| 隆子县| 林口县| 朝阳区| 阿城市| 浮梁县| 宁强县| 新晃| 哈尔滨市| 六枝特区| 买车| 轮台县| 武穴市| 阳江市| 汝州市| 宝丰县| 新源县| 宁陵县| 清苑县| 道真| 璧山县| 双桥区| 武强县| 广水市| 保山市| 商河县| 自贡市| 开封市| 湘潭市| 东丰县| 巩义市| 博野县| 潼南县| 双城市| 凤冈县| 临汾市| 兴山县| 抚顺市| 玛沁县| 滨州市| 内江市|