{"id":1370,"date":"2021-05-16T17:29:08","date_gmt":"2021-05-16T09:29:08","guid":{"rendered":"http:\/\/diuut.com\/?p=1370"},"modified":"2021-05-16T17:29:08","modified_gmt":"2021-05-16T09:29:08","slug":"mysql%e5%ae%9e%e7%8e%b0%e9%ab%98%e5%8f%af%e7%94%a8%e6%96%b9%e6%a1%88-mha%e5%ae%89%e8%a3%85%e5%8f%8a%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/diuut.com\/?p=1370","title":{"rendered":"MySQL\u5b9e\u73b0\u9ad8\u53ef\u7528\u65b9\u6848-MHA\u5b89\u88c5\u53ca\u914d\u7f6e"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote\"><p>\u9700\u6c42<\/p><cite>\u4e3b\u4ece\u914d\u7f6e\u4e2d\u5982\u679c\u4e3b\u670d\u52a1\u6545\u969c\u540e\uff0c\u4e3b\u5e93\u914d\u7f6e\u9700\u81ea\u52a8\u5207\u6362\u81f3\u5176\u4e2d\u4e00\u4e2a\u4ece\u5e93\uff0cMHA\u6846\u67b6\u4e3a\u6b64\u5b9e\u73b0\u65b9\u6848\u4e4b\u4e00<\/cite><\/blockquote>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_66_1 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\"><p class=\"ez-toc-title\">\u76ee\u5f55<\/p>\n<\/div><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/diuut.com\/?p=1370\/#MHA%E5%AE%89%E8%A3%85\" title=\"MHA\u5b89\u88c5\">MHA\u5b89\u88c5<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/diuut.com\/?p=1370\/#%E5%89%8D%E7%BD%AE%E7%8E%AF%E5%A2%83\" title=\"\u524d\u7f6e\u73af\u5883\">\u524d\u7f6e\u73af\u5883<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/diuut.com\/?p=1370\/#%E5%AE%89%E8%A3%85aliyun_w_get%E5%AE%89%E8%A3%85%E6%BA%90%E9%85%8D%E7%BD%AE%EF%BC%88%E5%8F%AF%E9%80%89%EF%BC%89\" title=\"\u5b89\u88c5aliyun w get\u5b89\u88c5\u6e90\u914d\u7f6e\uff08\u53ef\u9009\uff09\">\u5b89\u88c5aliyun w get\u5b89\u88c5\u6e90\u914d\u7f6e\uff08\u53ef\u9009\uff09<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/diuut.com\/?p=1370\/#%E4%B8%8B%E8%BD%BDMHA%E8%BD%AF%E4%BB%B6\" title=\"\u4e0b\u8f7dMHA\u8f6f\u4ef6\">\u4e0b\u8f7dMHA\u8f6f\u4ef6<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/diuut.com\/?p=1370\/#%E5%AE%89%E8%A3%85Node%E8%BD%AF%E4%BB%B6%E4%BB%A5%E5%8F%8A%E4%BE%9D%E8%B5%96%E5%8C%85db1db2db3\" title=\"\u5b89\u88c5Node\u8f6f\u4ef6\u4ee5\u53ca\u4f9d\u8d56\u5305(db1,db2,db3)\">\u5b89\u88c5Node\u8f6f\u4ef6\u4ee5\u53ca\u4f9d\u8d56\u5305(db1,db2,db3)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/diuut.com\/?p=1370\/#%E5%AE%89%E8%A3%85Manager%E8%BD%AF%E4%BB%B6%EF%BC%88db3%EF%BC%89\" title=\"\u5b89\u88c5Manager\u8f6f\u4ef6\uff08db3\uff09\">\u5b89\u88c5Manager\u8f6f\u4ef6\uff08db3\uff09<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/diuut.com\/?p=1370\/#%E9%AA%8C%E8%AF%81manager%E7%89%88%E6%9C%ACdb3\" title=\"\u9a8c\u8bc1manager\u7248\u672c(db3)\">\u9a8c\u8bc1manager\u7248\u672c(db3)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/diuut.com\/?p=1370\/#%E9%85%8D%E7%BD%AEssh%E5%85%8D%E5%AF%86db1db2db3\" title=\"\u914d\u7f6essh\u514d\u5bc6(db1,db2,db3)\">\u914d\u7f6essh\u514d\u5bc6(db1,db2,db3)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/diuut.com\/?p=1370\/#%E5%BB%BA%E7%AB%8B%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E7%9B%AE%E5%BD%95db3\" title=\"\u5efa\u7acb\u914d\u7f6e\u6587\u4ef6\u76ee\u5f55(db3)\">\u5efa\u7acb\u914d\u7f6e\u6587\u4ef6\u76ee\u5f55(db3)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/diuut.com\/?p=1370\/#%E5%88%9B%E5%BB%BA%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6db3\" title=\"\u521b\u5efa\u914d\u7f6e\u6587\u4ef6(db3)\">\u521b\u5efa\u914d\u7f6e\u6587\u4ef6(db3)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/diuut.com\/?p=1370\/#%E8%84%9A%E6%9C%AC%E6%B7%BB%E5%8A%A0%E6%89%A7%E8%A1%8C%E6%9D%83%E9%99%90db3\" title=\"\u811a\u672c\u6dfb\u52a0\u6267\u884c\u6743\u9650(db3)\">\u811a\u672c\u6dfb\u52a0\u6267\u884c\u6743\u9650(db3)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/diuut.com\/?p=1370\/#ssh%E5%85%8D%E5%AF%86%E6%A3%80%E6%9F%A5db3\" title=\"ssh\u514d\u5bc6\u68c0\u67e5(db3)\">ssh\u514d\u5bc6\u68c0\u67e5(db3)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/diuut.com\/?p=1370\/#%E5%90%84%E8%8A%82%E7%82%B9%E5%A4%8D%E5%88%B6%E6%83%85%E5%86%B5%E6%A3%80%E6%9F%A5db3\" title=\"\u5404\u8282\u70b9\u590d\u5236\u60c5\u51b5\u68c0\u67e5(db3)\">\u5404\u8282\u70b9\u590d\u5236\u60c5\u51b5\u68c0\u67e5(db3)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/diuut.com\/?p=1370\/#%E6%A3%80%E6%9F%A5manager%E7%9A%84%E7%8A%B6%E6%80%81%EF%BC%88db3%EF%BC%89\" title=\"\u68c0\u67e5manager\u7684\u72b6\u6001\uff08db3\uff09\">\u68c0\u67e5manager\u7684\u72b6\u6001\uff08db3\uff09<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/diuut.com\/?p=1370\/#Master_%E8%8A%82%E7%82%B9%E4%B8%8A%E6%89%8B%E5%8A%A8%E5%BC%80%E5%90%AF%E8%99%9A%E6%8B%9FIPdb3\" title=\"Master \u8282\u70b9\u4e0a\u624b\u52a8\u5f00\u542f\u865a\u62dfIP(db3)\">Master \u8282\u70b9\u4e0a\u624b\u52a8\u5f00\u542f\u865a\u62dfIP(db3)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/diuut.com\/?p=1370\/#%E5%90%AF%E5%8A%A8managerdb3\" title=\"\u542f\u52a8manager(db3)\">\u542f\u52a8manager(db3)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/diuut.com\/?p=1370\/#%E5%86%8D%E6%AC%A1%E6%A3%80%E6%9F%A5manager%E7%8A%B6%E6%80%81db3\" title=\"\u518d\u6b21\u68c0\u67e5manager\u72b6\u6001(db3)\">\u518d\u6b21\u68c0\u67e5manager\u72b6\u6001(db3)<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/diuut.com\/?p=1370\/#%E4%B8%BB%E4%BB%8E%E9%AB%98%E5%8F%AF%E7%94%A8%E5%88%87%E6%8D%A2%E6%B5%8B%E8%AF%95%E5%8F%AF%E9%80%89\" title=\"\u4e3b\u4ece\u9ad8\u53ef\u7528\u5207\u6362\u6d4b\u8bd5(\u53ef\u9009)\">\u4e3b\u4ece\u9ad8\u53ef\u7528\u5207\u6362\u6d4b\u8bd5(\u53ef\u9009)<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/diuut.com\/?p=1370\/#%E7%A1%AE%E8%AE%A4%E5%BD%93%E5%89%8D%E4%B8%BB%E4%BB%8E%E7%8A%B6%E6%80%81\" title=\"\u786e\u8ba4\u5f53\u524d\u4e3b\u4ece\u72b6\u6001\">\u786e\u8ba4\u5f53\u524d\u4e3b\u4ece\u72b6\u6001<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/diuut.com\/?p=1370\/#%E5%B0%86db1%E4%B8%BB%E8%8A%82%E7%82%B9%E7%9A%84mysql%E8%BF%9B%E7%A8%8B%E5%81%9C%E6%8E%89\" title=\"\u5c06db1\u4e3b\u8282\u70b9\u7684mysql\u8fdb\u7a0b\u505c\u6389\">\u5c06db1\u4e3b\u8282\u70b9\u7684mysql\u8fdb\u7a0b\u505c\u6389<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/diuut.com\/?p=1370\/#%E6%A3%80%E6%9F%A5managerlog\" title=\"\u68c0\u67e5manager.log\">\u68c0\u67e5manager.log<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/diuut.com\/?p=1370\/#%E5%86%8D%E6%A3%80%E6%9F%A5etcmhaconfmhacnf%E6%96%87%E4%BB%B6\" title=\"\u518d\u68c0\u67e5\/etc\/mha\/conf\/mha.cnf\u6587\u4ef6\">\u518d\u68c0\u67e5\/etc\/mha\/conf\/mha.cnf\u6587\u4ef6<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/diuut.com\/?p=1370\/#%E6%A3%80%E6%9F%A5MHA%E8%BF%90%E8%A1%8C%E7%8A%B6%E6%80%81\" title=\"\u68c0\u67e5MHA\u8fd0\u884c\u72b6\u6001\">\u68c0\u67e5MHA\u8fd0\u884c\u72b6\u6001<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/diuut.com\/?p=1370\/#%E6%A3%80%E6%9F%A5%E6%96%B0%E4%B8%BB%E8%8A%82%E7%82%B9db2%E7%9A%84slave%E7%8A%B6%E6%80%81\" title=\"\u68c0\u67e5\u65b0\u4e3b\u8282\u70b9db2\u7684slave\u72b6\u6001\">\u68c0\u67e5\u65b0\u4e3b\u8282\u70b9db2\u7684slave\u72b6\u6001<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-25\" href=\"https:\/\/diuut.com\/?p=1370\/#%E6%A3%80%E6%9F%A5db3%E8%8A%82%E7%82%B9%E7%9A%84slave%E7%8A%B6%E6%80%81\" title=\"\u68c0\u67e5db3\u8282\u70b9\u7684slave\u72b6\u6001\">\u68c0\u67e5db3\u8282\u70b9\u7684slave\u72b6\u6001<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-26\" href=\"https:\/\/diuut.com\/?p=1370\/#%E6%89%8B%E5%B7%A5switchover%E6%B5%8B%E8%AF%95_%E5%8F%AF%E9%80%89\" title=\"\u624b\u5de5switchover\u6d4b\u8bd5 (\u53ef\u9009)\">\u624b\u5de5switchover\u6d4b\u8bd5 (\u53ef\u9009)<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-27\" href=\"https:\/\/diuut.com\/?p=1370\/#%E5%81%9C%E6%AD%A2%E5%BD%93%E5%89%8D%E7%9A%84mhadb3\" title=\"\u505c\u6b62\u5f53\u524d\u7684mha(db3)\">\u505c\u6b62\u5f53\u524d\u7684mha(db3)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-28\" href=\"https:\/\/diuut.com\/?p=1370\/#switchover%E5%88%B0%E5%8E%9F%E6%9D%A5%E7%9A%84%E4%B8%BB%E8%8A%82%E7%82%B9db1\" title=\"switchover\u5230\u539f\u6765\u7684\u4e3b\u8282\u70b9db1\">switchover\u5230\u539f\u6765\u7684\u4e3b\u8282\u70b9db1<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-29\" href=\"https:\/\/diuut.com\/?p=1370\/#%E6%A3%80%E6%9F%A5vip%EF%BC%8Cread_only%E5%92%8Cslave_status\" title=\"\u68c0\u67e5vip\uff0cread_only\u548cslave status\">\u68c0\u67e5vip\uff0cread_only\u548cslave status<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-30\" href=\"https:\/\/diuut.com\/?p=1370\/#%E5%90%AF%E5%8A%A8mha%E5%B9%B6%E6%A3%80%E6%9F%A5%E7%8A%B6%E6%80%81\" title=\"\u542f\u52a8mha\u5e76\u68c0\u67e5\u72b6\u6001\">\u542f\u52a8mha\u5e76\u68c0\u67e5\u72b6\u6001<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-31\" href=\"https:\/\/diuut.com\/?p=1370\/#MHA%E7%9B%B8%E5%85%B3%E9%99%84%E4%BB%B6\" title=\"MHA\u76f8\u5173\u9644\u4ef6\">MHA\u76f8\u5173\u9644\u4ef6<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"MHA%E5%AE%89%E8%A3%85\"><\/span>MHA\u5b89\u88c5<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E5%89%8D%E7%BD%AE%E7%8E%AF%E5%A2%83\"><\/span>\u524d\u7f6e\u73af\u5883<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>\u4e09\u53f0\u5df2\u7ecf\u642d\u5efa\u597d\u7684MySQL\u96c6\u7fa4\uff0c\u5e76\u5df2\u914d\u7f6e\u597d\u4e3b\u4ece\u590d\u5236\uff0c\u8be6\u7ec6\u642d\u5efa\u8fc7\u7a0b\u53ef\u53c2\u89c1\u4e0a\u4e00\u7bc7\u6587\u7ae0<\/p>\n\n\n\n<p><a href=\"https:\/\/diuut.com\/?p=1325\">MySQL\u5b89\u88c5\u53ca\u914d\u7f6e\u4e3b\u4ece\u590d\u5236<\/a><\/p>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E5%AE%89%E8%A3%85aliyun_w_get%E5%AE%89%E8%A3%85%E6%BA%90%E9%85%8D%E7%BD%AE%EF%BC%88%E5%8F%AF%E9%80%89%EF%BC%89\"><\/span>\u5b89\u88c5aliyun w get\u5b89\u88c5\u6e90\u914d\u7f6e\uff08\u53ef\u9009\uff09<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\nyum -y install wget\ncp \/etc\/yum.repos.d\/CentOS-Base.repo \/etc\/yum.repos.d\/CentOS-Base.repo.bak\nwget -O \/etc\/yum.repos.d\/CentOS-Base.repo http:\/\/mirrors.aliyun.com\/repo\/Centos-7.repo\nwget -O \/etc\/yum.repos.d\/epel.repo http:\/\/mirrors.aliyun.com\/repo\/epel-7.repo\nyum clean all\nyum makecache\n<\/pre><\/div>\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E4%B8%8B%E8%BD%BDMHA%E8%BD%AF%E4%BB%B6\"><\/span>\u4e0b\u8f7dMHA\u8f6f\u4ef6<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\nwget https:\/\/github.com\/yoshinorim\/mha4mysql-node\/releases\/download\/v0.58\/mha4mysql-node-0.58-0.el7.centos.noarch.rpm\nwget https:\/\/github.com\/yoshinorim\/mha4mysql-manager\/releases\/download\/v0.58\/mha4mysql-manager-0.58-0.el7.centos.noarch.rpm\n#\u6587\u7ae0\u672b\u5c3e\u4f1a\u9644\u4e0a\u5df2\u5305\u542b\u8fd92\u4e2a\u5b89\u88c5\u5305\u7684\u9644\u4ef6\u5305\n\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"353\" height=\"134\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-23.png\" alt=\"\" class=\"wp-image-1372\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-23.png 353w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-23-300x114.png 300w\" sizes=\"(max-width: 353px) 100vw, 353px\" \/><\/figure>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E5%AE%89%E8%A3%85Node%E8%BD%AF%E4%BB%B6%E4%BB%A5%E5%8F%8A%E4%BE%9D%E8%B5%96%E5%8C%85db1db2db3\"><\/span>\u5b89\u88c5Node\u8f6f\u4ef6\u4ee5\u53ca\u4f9d\u8d56\u5305(db1,db2,db3)<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\ntar zxf mha-node-dep.tar.gz #node\u4f9d\u8d56\nrpm -ivh node\/*\nrpm -ivh mha4mysql-node-0.58-0.el7.centos.noarch.rpm\n#node\u4f9d\u8d56\u4e5f\u53ef\u4ee5\u5728\u7ebfyum\u5b89\u88c5\uff1ayum install perl-DBD-MySQL\n\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"459\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-24.png\" alt=\"\" class=\"wp-image-1373\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-24.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-24-300x249.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"95\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-25.png\" alt=\"\" class=\"wp-image-1374\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-25.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-25-300x51.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E5%AE%89%E8%A3%85Manager%E8%BD%AF%E4%BB%B6%EF%BC%88db3%EF%BC%89\"><\/span>\u5b89\u88c5Manager\u8f6f\u4ef6\uff08db3\uff09<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n#\u7ba1\u7406\u8282\u70b9\u5b89\u88c5Manager\u8f6f\u4ef6\n#\u9700\u8981\u5b89\u88c5\u4f9d\u8d56\ntar zxf mha-manager-dep.tar.gz  #manager\u4f9d\u8d56\nrpm -ivh manager\/*\nrpm -ivh mha4mysql-manager-0.58-0.el7.centos.noarch.rpm\n#manager\u4f9d\u8d56\u4e5f\u53ef\u4ee5\u5728\u7ebfyum\u5b89\u88c5\uff1a\nyum install perl-DBD-MySQL perl-Config-Tiny perl-Log-Dispatch perl-Parallel-ForkManag \n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"354\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-26.png\" alt=\"\" class=\"wp-image-1375\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-26.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-26-300x192.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"174\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-27.png\" alt=\"\" class=\"wp-image-1376\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-27.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-27-300x94.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E9%AA%8C%E8%AF%81manager%E7%89%88%E6%9C%ACdb3\"><\/span>\u9a8c\u8bc1manager\u7248\u672c(db3)<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\nmasterha_manager  -v\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"290\" height=\"36\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-28.png\" alt=\"\" class=\"wp-image-1377\"\/><\/figure>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E9%85%8D%E7%BD%AEssh%E5%85%8D%E5%AF%86db1db2db3\"><\/span>\u914d\u7f6essh\u514d\u5bc6(db1,db2,db3)<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nssh-keygen -t rsa (\u4e00\u8def\u56de\u8f66)\nssh-copy-id -i ~\/.ssh\/id_rsa.pub root@db1\nssh-copy-id -i ~\/.ssh\/id_rsa.pub root@db2\nssh-copy-id -i ~\/.ssh\/id_rsa.pub root@db3\n#\u4e09\u53f0\u670d\u52a1\u5668\u4e4b\u95f4\u65e0\u9700\u5bc6\u7801\u6821\u9a8c\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"410\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-29.png\" alt=\"\" class=\"wp-image-1378\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-29.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-29-300x222.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"524\" height=\"178\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-30.png\" alt=\"\" class=\"wp-image-1379\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-30.png 524w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-30-300x102.png 300w\" sizes=\"(max-width: 524px) 100vw, 524px\" \/><\/figure>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E5%BB%BA%E7%AB%8B%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E7%9B%AE%E5%BD%95db3\"><\/span>\u5efa\u7acb\u914d\u7f6e\u6587\u4ef6\u76ee\u5f55(db3)<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\nmkdir  -p \/etc\/mha\/{conf,log,scripts}\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"396\" height=\"40\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-31.png\" alt=\"\" class=\"wp-image-1380\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-31.png 396w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-31-300x30.png 300w\" sizes=\"(max-width: 396px) 100vw, 396px\" \/><\/figure>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E5%88%9B%E5%BB%BA%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6db3\"><\/span>\u521b\u5efa\u914d\u7f6e\u6587\u4ef6(db3)<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\nvi \/etc\/mha\/conf\/mha.cnf\n#\u6ce8\u610f\u4fee\u6539\u91cc\u9762\u7684ip\uff0c\u8def\u5f84\uff0c\u7528\u6237\uff0c\u5bc6\u7801\u7b49(password\u4e0erepl_password\u5747\u4e3amysql\u5bc6\u7801)\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#91;server default]\nmanager_log=\/etc\/mha\/log\/manager.log\nmanager_workdir=\/etc\/mha\/log\nmaster_binlog_dir=\/data\/binlog\n#failover\u548cswitchover\u811a\u672c\nmaster_ip_failover_script=\/etc\/mha\/scripts\/master_ip_failover\nmaster_ip_online_change_script=\/etc\/mha\/scripts\/master_ip_online_change\nuser=root\npassword=root321\n#\u914d\u7f6e\u68c0\u67e5\u4e3b\u8282\u70b9\u7684\u6b21\u6570\nping_interval=3\nrepl_password=rpl321\nrepl_user=rpl_user\nssh_user=root\n# masters\n&#91;server1]\nhostname=192.168.253.100\nport=3306\n#cadidate_master\u4e3a1\u8868\u793a\u4f18\u5148\u8003\u8651\u6b64\u8282\u70b9\u8f6c\u4e3a\u4e3b\u8282\u70b9\ncandidate_master=1\nmaster_binlog_dir=\/data\/binlog\nremote_workdir=\/etc\/mha\/log\n&#91;server2]\nhostname=192.168.253.101\nport=3306\ncandidate_master=1\ncheck_repl_delay=0\nmaster_binlog_dir=\/data\/binlog\nremote_workdir=\/etc\/mha\/log\n&#91;server3]\nhostname=192.168.253.102\nport=3306\n<\/pre><\/div>\n\n\n<blockquote class=\"wp-block-quote\"><p>\u6ce8\u610f\uff1a<\/p><cite><strong>\u914d\u7f6e\u4e2d\u5f15\u7528\u7684\u811a\u672c\u5728\u9644\u4ef6\u91cc\u9762\uff0c\u9700\u8981\u4fee\u6539\u811a\u672cmaster_ip_failover\/master_ip_online_change\u4e2d\u7684my $vip\u548cmy $ifdev\uff0c\u4ee3\u8868vip\u548c\u7f51\u5361\u540d\u79f0\uff0c\u5e76\u4e0a\u4f20\u5230db3\u76ee\u5f55\/etc\/mha\/scripts\/<\/strong><\/cite><\/blockquote>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E8%84%9A%E6%9C%AC%E6%B7%BB%E5%8A%A0%E6%89%A7%E8%A1%8C%E6%9D%83%E9%99%90db3\"><\/span>\u811a\u672c\u6dfb\u52a0\u6267\u884c\u6743\u9650(db3)<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\n#\u5c06\u811a\u672c\u6587\u4ef6\u79fb\u5230.\/etc\/mha\/scripts\/\u4e2d\nchmod +x \/etc\/mha\/scripts\/* \ndos2unix \/etc\/mha\/scripts\/master_ip_failover\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-32.png\" alt=\"\" class=\"wp-image-1383\" width=\"540\" height=\"98\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-32.png 540w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-32-300x54.png 300w\" sizes=\"(max-width: 540px) 100vw, 540px\" \/><\/figure>\n\n\n\n<p>\u811a\u672c\u4e2d\u8bb0\u7740\u4fee\u6539vip\u5730\u5740\u4ee5\u53ca\u7528\u6237\u5bc6\u7801\uff0c\u5747\u4e3a\u540e\u7eed\u9700\u8981\u767b\u5f55\u7684\u6570\u636e\u5e93\u5bc6\u7801\uff0c\u65b9\u4fbf\u5207\u6362\u4e3b\u4ece\u3002<\/p>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"ssh%E5%85%8D%E5%AF%86%E6%A3%80%E6%9F%A5db3\"><\/span>ssh\u514d\u5bc6\u68c0\u67e5(db3)<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nmasterha_check_ssh --conf=\/etc\/mha\/conf\/mha.cnf\n. . .\n&#91;info] All SSH connection tests passed successfully.\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"229\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-33.png\" alt=\"\" class=\"wp-image-1384\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-33.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-33-300x124.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E5%90%84%E8%8A%82%E7%82%B9%E5%A4%8D%E5%88%B6%E6%83%85%E5%86%B5%E6%A3%80%E6%9F%A5db3\"><\/span>\u5404\u8282\u70b9\u590d\u5236\u60c5\u51b5\u68c0\u67e5(db3)<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\nmasterha_check_repl --conf=\/etc\/mha\/conf\/mha.cnf\n#Result\uff1aChecking the Status of the script.. OK \n#       MySQL Replication Health is OK.\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"410\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-34.png\" alt=\"\" class=\"wp-image-1385\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-34.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-34-300x222.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<p>\u5982\u51fa\u73b0\u201dMySQL Replication Health is NOT OK!\u201c\uff0c\u8bf4\u660e\u914d\u7f6e\u6709\u95ee\u9898<\/p>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E6%A3%80%E6%9F%A5manager%E7%9A%84%E7%8A%B6%E6%80%81%EF%BC%88db3%EF%BC%89\"><\/span>\u68c0\u67e5manager\u7684\u72b6\u6001\uff08db3\uff09<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\nmasterha_check_status --conf=\/etc\/mha\/conf\/mha.cnf\n# mha is stopped(2:NOT_RUNNING).\n\u6b64\u5904\u8fd8\u672a\u542f\u52a8\uff0c\u505c\u6b62\u72b6\u6001\u4e3a\u6b63\u5e38\u7ed3\u679c\u3002\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"536\" height=\"41\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-35.png\" alt=\"\" class=\"wp-image-1386\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-35.png 536w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-35-300x23.png 300w\" sizes=\"(max-width: 536px) 100vw, 536px\" \/><\/figure>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"Master_%E8%8A%82%E7%82%B9%E4%B8%8A%E6%89%8B%E5%8A%A8%E5%BC%80%E5%90%AF%E8%99%9A%E6%8B%9FIPdb3\"><\/span>Master \u8282\u70b9\u4e0a\u624b\u52a8\u5f00\u542f\u865a\u62dfIP(db3)<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\n# \u865a\u62dfip\u4e0e\u4e4b\u524d\u5728\u811a\u672c\u4e2d\u914d\u7f6e\u7684\u4fdd\u6301\u4e00\u76f4\uff0c\u9009\u7528\u672a\u5360\u7528\u7684\u5730\u5740\n# \u7528\u4e8e\u5207\u6362\u4e3b\u4ece\u65f6ip\u6307\u5411\u6700\u65b0\u7684\u4e3b\u5e93\n\/sbin\/ip addr add 172.16.53.99\/24 dev ens192 label ens192:1(\u6dfb\u52a0)\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"442\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-36.png\" alt=\"\" class=\"wp-image-1387\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-36.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-36-300x239.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\n\/sbin\/ip addr del 172.16.53.99\/24 dev ens192 label ens192:1(\u5220\u9664)(\u9700\u8981\u65f6\u518d\u7528)\n# \u53ef\u53c2\u8003\/etc\/mha\/scripts\/master_ip_failover \u4e2d\u7684\u547d\u4ee4\uff0c\u865a\u62dfip\u8be6\u7ec6\u5730\u5740\u53c2\u9009\u4e3b\u673a\u540c\u7f51\u6bb5\u7a7a\u5fc3\u5730\u5740\uff0cens\u4eceifconfig\u914d\u7f6e\u4e2d\u67e5\u770b\u672c\u673a\u7f51\u5361\u518d\u586b\u5165\n<\/pre><\/div>\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E5%90%AF%E5%8A%A8managerdb3\"><\/span>\u542f\u52a8manager(db3)<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\nnohup masterha_manager --conf=\/etc\/mha\/conf\/mha.cnf --remove_dead_master_conf --ignore_last_failover &lt; \/dev\/null &gt; \/etc\/mha\/log\/manager.log 2&gt;&amp;1 &amp;\n\n# \u68c0\u67e5\u65e5\u5fd7\ntail -f \/etc\/mha\/log\/manager.log\n...\nPing(SELECT) succeeded, waiting until MySQL doesn't respond.. \n...\n\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"125\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-37.png\" alt=\"\" class=\"wp-image-1388\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-37.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-37-300x68.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E5%86%8D%E6%AC%A1%E6%A3%80%E6%9F%A5manager%E7%8A%B6%E6%80%81db3\"><\/span>\u518d\u6b21\u68c0\u67e5manager\u72b6\u6001(db3)<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\nmasterha_check_status --conf=\/etc\/mha\/conf\/mha.cnf\n#mha (pid:20102) is running(0:PING_OK), master:192.168.253.100\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"125\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-38.png\" alt=\"\" class=\"wp-image-1389\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-38.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-38-300x68.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<h3><span class=\"ez-toc-section\" id=\"%E4%B8%BB%E4%BB%8E%E9%AB%98%E5%8F%AF%E7%94%A8%E5%88%87%E6%8D%A2%E6%B5%8B%E8%AF%95%E5%8F%AF%E9%80%89\"><\/span>\u4e3b\u4ece\u9ad8\u53ef\u7528\u5207\u6362\u6d4b\u8bd5(\u53ef\u9009)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E7%A1%AE%E8%AE%A4%E5%BD%93%E5%89%8D%E4%B8%BB%E4%BB%8E%E7%8A%B6%E6%80%81\"><\/span>\u786e\u8ba4\u5f53\u524d\u4e3b\u4ece\u72b6\u6001<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>\u5f53\u524d\u4e3b\u4ece\u72b6\u6001db1\uff08\u4e3b\uff09\u3001db2\uff08\u4ece\uff09\u3001db3\uff08\u4ece\uff09<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"324\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-39.png\" alt=\"\" class=\"wp-image-1392\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-39.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-39-300x175.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"391\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-40.png\" alt=\"\" class=\"wp-image-1393\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-40.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-40-300x212.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E5%B0%86db1%E4%B8%BB%E8%8A%82%E7%82%B9%E7%9A%84mysql%E8%BF%9B%E7%A8%8B%E5%81%9C%E6%8E%89\"><\/span>\u5c06db1\u4e3b\u8282\u70b9\u7684mysql\u8fdb\u7a0b\u505c\u6389<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsystemctl stop mysqld\n#\u5982\u975esystemctl\u542f\u52a8\uff0c\u53ef\u7528kill -9 pid \u6740\u6b7b\u8fdb\u7a0b\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"440\" height=\"65\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-41.png\" alt=\"\" class=\"wp-image-1394\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-41.png 440w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-41-300x44.png 300w\" sizes=\"(max-width: 440px) 100vw, 440px\" \/><\/figure>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E6%A3%80%E6%9F%A5managerlog\"><\/span>\u68c0\u67e5manager.log<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\ntail -f \/etc\/mha\/log\/manager.log\n..\nMaster failover to 192.168.253.101(192.168.253.101:3306) completed successfully.\n\n#\u663e\u793a\u4e3b\u5e93\u5df2\u5207\u6362\u5230db2\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"167\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-42.png\" alt=\"\" class=\"wp-image-1395\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-42.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-42-300x90.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<h3><span class=\"ez-toc-section\" id=\"%E5%86%8D%E6%A3%80%E6%9F%A5etcmhaconfmhacnf%E6%96%87%E4%BB%B6\"><\/span>\u518d\u68c0\u67e5\/etc\/mha\/conf\/mha.cnf\u6587\u4ef6<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nVi \/etc\/mha\/conf\/mha.cnf\n\u53d1\u73b0\u539f\u6765\u7684\u4e3b\u8282\u70b9\u5df2\u88ab\u4ecemha.cnf\u4e2d\u5220\u9664\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"363\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-43.png\" alt=\"\" class=\"wp-image-1396\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-43.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-43-300x197.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E6%A3%80%E6%9F%A5MHA%E8%BF%90%E8%A1%8C%E7%8A%B6%E6%80%81\"><\/span>\u68c0\u67e5MHA\u8fd0\u884c\u72b6\u6001<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nmasterha_check_status --conf=\/etc\/mha\/conf\/mha.cnf\n# \u53d1\u73b0mha\u5df2\u88ab\u505c\u6b62\n# (\u4e00\u6b21\u6027 \n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"57\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-45.png\" alt=\"\" class=\"wp-image-1398\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-45.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-45-300x31.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E6%A3%80%E6%9F%A5%E6%96%B0%E4%B8%BB%E8%8A%82%E7%82%B9db2%E7%9A%84slave%E7%8A%B6%E6%80%81\"><\/span>\u68c0\u67e5\u65b0\u4e3b\u8282\u70b9db2\u7684slave\u72b6\u6001<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>\u53d1\u73b0\u65b0\u4e3b\u8282\u70b9\u5df2\u88abreset slave<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"301\" height=\"111\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-46.png\" alt=\"\" class=\"wp-image-1399\"\/><\/figure>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E6%A3%80%E6%9F%A5db3%E8%8A%82%E7%82%B9%E7%9A%84slave%E7%8A%B6%E6%80%81\"><\/span>\u68c0\u67e5db3\u8282\u70b9\u7684slave\u72b6\u6001<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>\u53d1\u73b0\u5176\u590d\u5236\u901a\u9053\u53d8\u6210\u4e86db2<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"233\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-47.png\" alt=\"\" class=\"wp-image-1400\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-47.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-47-300x126.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<h3><span class=\"ez-toc-section\" id=\"%E6%89%8B%E5%B7%A5switchover%E6%B5%8B%E8%AF%95_%E5%8F%AF%E9%80%89\"><\/span>\u624b\u5de5switchover\u6d4b\u8bd5 (\u53ef\u9009)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E5%81%9C%E6%AD%A2%E5%BD%93%E5%89%8D%E7%9A%84mhadb3\"><\/span>\u505c\u6b62\u5f53\u524d\u7684mha(db3)<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\nmasterha_stop --conf=\/etc\/mha\/conf\/mha.cnf\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"37\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-48.png\" alt=\"\" class=\"wp-image-1401\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-48.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-48-300x20.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"switchover%E5%88%B0%E5%8E%9F%E6%9D%A5%E7%9A%84%E4%B8%BB%E8%8A%82%E7%82%B9db1\"><\/span>switchover\u5230\u539f\u6765\u7684\u4e3b\u8282\u70b9db1<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\nmasterha_master_switch --conf=\/etc\/mha\/conf\/mha.cnf --master_state=alive --new_master_host=192.168.253.100 --orig_master_is_new_slave --running_updates_limit=300\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"324\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-49.png\" alt=\"\" class=\"wp-image-1402\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-49.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-49-300x175.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<p>\u8be6\u7ec6\u6267\u884c\u8fc7\u7a0b\u7565<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"254\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-50.png\" alt=\"\" class=\"wp-image-1403\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-50.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-50-300x138.png 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<p>\u6b64\u5904\u5207\u6362\u65f6\u5982\u679c\u62a5\u9519\uff0c\u4e00\u822c\u662f\u811a\u672c\u6587\u4ef6\u4e2d\u7684\u6570\u636e\u5e93\u5bc6\u7801\u8f93\u5165\u6709\u8bef\uff0c\u6216\u8005vip\u672a\u8bbe\u7f6e\uff1b<\/p>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E6%A3%80%E6%9F%A5vip%EF%BC%8Cread_only%E5%92%8Cslave_status\"><\/span>\u68c0\u67e5vip\uff0cread_only\u548cslave status<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nifconfig\nmysql&gt; show slave status\\G;\n<\/pre><\/div>\n\n\n<p>#\u53d1\u73b0vip\u5df2\u6f02\u5230db1\uff0cread_only\u548cslave status<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"554\" height=\"279\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-52.png\" alt=\"\" class=\"wp-image-1405\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-52.png 554w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-52-300x151.png 300w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-52-216x108.png 216w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"506\" height=\"186\" src=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-51.png\" alt=\"\" class=\"wp-image-1404\" srcset=\"https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-51.png 506w, https:\/\/diuut.com\/wp-content\/uploads\/2021\/05\/image-51-300x110.png 300w\" sizes=\"(max-width: 506px) 100vw, 506px\" \/><\/figure>\n\n\n\n<h4><span class=\"ez-toc-section\" id=\"%E5%90%AF%E5%8A%A8mha%E5%B9%B6%E6%A3%80%E6%9F%A5%E7%8A%B6%E6%80%81\"><\/span>\u542f\u52a8mha\u5e76\u68c0\u67e5\u72b6\u6001<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\nnohup masterha_manager --conf=\/etc\/mha\/conf\/mha.cnf --remove_dead_master_conf --ignore_last_failover &lt; \/dev\/null &gt; \/etc\/mha\/log\/manager.log 2&gt;&amp;1 &amp;\nmasterha_check_status --conf=\/etc\/mha\/conf\/mha.cnf\n<\/pre><\/div>\n\n\n<h3><span class=\"ez-toc-section\" id=\"MHA%E7%9B%B8%E5%85%B3%E9%99%84%E4%BB%B6\"><\/span>MHA\u76f8\u5173\u9644\u4ef6<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u94fe\u63a5: https:\/\/pan.baidu.com\/s\/1AU-gQ9lLeOxMXKexEqK4lQ <\/p>\n\n\n\n<p>\u63d0\u53d6\u7801: 6k3x <\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>\u672c\u6587\u7ae0\u4ec5\u7528\u4e8e\u4e2a\u4eba\u8bb0\u5f55\u53ca\u5b66\u4e60\u53c2\u8003\u3002<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u9700\u6c42 \u4e3b\u4ece\u914d\u7f6e\u4e2d\u5982\u679c\u4e3b\u670d\u52a1\u6545\u969c\u540e\uff0c\u4e3b\u5e93\u914d\u7f6e\u9700\u81ea\u52a8\u5207\u6362\u81f3\u5176\u4e2d\u4e00\u4e2a\u4ece\u5e93\uff0cMHA\u6846\u67b6\u4e3a\u6b64\u5b9e\u73b0\u65b9\u6848\u4e4b\u4e00 MHA\u5b89\u88c5 \u524d<span class=\"more-button\"><a href=\"https:\/\/diuut.com\/?p=1370\" class=\"more-link\">view all . . .<span class=\"screen-reader-text\">MySQL\u5b9e\u73b0\u9ad8\u53ef\u7528\u65b9\u6848-MHA\u5b89\u88c5\u53ca\u914d\u7f6e<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":1350,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[9,40,39],"_links":{"self":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/1370"}],"collection":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1370"}],"version-history":[{"count":6,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/1370\/revisions"}],"predecessor-version":[{"id":1406,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/1370\/revisions\/1406"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/media\/1350"}],"wp:attachment":[{"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}