{"id":36068,"date":"2026-09-14T16:58:59","date_gmt":"2026-09-14T08:58:59","guid":{"rendered":"https:\/\/www.varidata.com\/uncategorized-zh-tw\/how-to-configure-automatic-failover-for-mysql-master-slave\/"},"modified":"2026-09-14T17:14:31","modified_gmt":"2026-09-14T09:14:31","slug":"how-to-configure-automatic-failover-for-mysql-master-slave","status":"publish","type":"post","link":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/","title":{"rendered":"\u5982\u4f55\u70ba MySQL \u4e3b\u5f9e\u67b6\u69cb\u8a2d\u5b9a\u81ea\u52d5\u6545\u969c\u5207\u63db"},"content":{"rendered":"<p>\u4f60\u53ef\u4ee5\u85c9\u52a9 Keepalived\u3001MySQL Utilities \u6216 MySQL InnoDB Cluster \u7b49\u5de5\u5177\uff0c\u70ba MySQL \u4e3b\u5f9e\u67b6\u69cb\u8a2d\u5b9a\u81ea\u52d5\u6545\u969c\u5207\u63db\u3002\u672c\u6587\u5c07\u5e36\u4f60\u4f9d\u5e8f\u5b8c\u6210\u524d\u7f6e\u689d\u4ef6\u6e96\u5099\u3001\u8907\u5beb\u8a2d\u5b9a\u3001\u6545\u969c\u5207\u63db\u5de5\u5177\u90e8\u7f72\u3001\u6e2c\u8a66\u4ee5\u53ca\u6700\u4f73\u5be6\u52d9\u3002Keepalived \u900f\u904e\u7ba1\u7406\u865b\u64ec IP \u5be6\u73fe\u9ad8\u53ef\u7528\uff0c\u800c MySQL Utilities \u548c InnoDB Cluster \u5247\u53ef\u4ee5\u5728\u4e3b\u5eab\u6545\u969c\u6642\u63d0\u5347\u65b0\u7684\u4e3b\u5eab\u3002\u672c\u6587\u9810\u8a2d\u4f60\u5df2\u7d93\u638c\u63e1\u57fa\u672c\u7684 <a href=\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/mysql-master-slave-replication-read-write-splitting-setup\/\" target=\"_blank\">MySQL \u6307\u4ee4<\/a>\uff0c\u4e26\u4e14\u81f3\u5c11\u6e96\u5099\u597d\u4e86<a href=\"https:\/\/www.varidata.com\/zh-tw\/server\/hk\/\" target=\"_blank\">\u5169\u53f0\u4f3a\u670d\u5668<\/a>\u3002\u4f60\u5c07\u5b78\u6703\u5982\u4f55\u5728\u4e3b\u5eab\u7576\u6a5f\u6642\u4fdd\u8b77\u8cc7\u6599\u4e00\u81f4\u6027\uff0c\u4e26\u76e1\u53ef\u80fd\u7dad\u6301\u696d\u52d9\u53ef\u7528\u6027\u3002\u6309\u7167\u672c\u6587\u6b65\u9a5f\u64cd\u4f5c\uff0c\u4f60\u53ef\u4ee5\u5efa\u7acb\u4e00\u5957\u503c\u5f97\u4fe1\u8cf4\u7684\u6545\u969c\u5207\u63db\u65b9\u6848\u3002<\/p>\n<h2>MySQL \u8907\u5beb\u7684\u524d\u7f6e\u689d\u4ef6<\/h2>\n<h3>\u4f3a\u670d\u5668\u8207\u7db2\u8def\u8981\u6c42<\/h3>\n<p>\u5728\u5efa\u7f6e\u4efb\u4f55\u6545\u969c\u5207\u63db\u65b9\u6848\u4e4b\u524d\uff0c\u4f60\u81f3\u5c11\u9700\u8981\u5169\u53f0\u4f3a\u670d\u5668\u3002\u5176\u4e2d\u4e00\u53f0\u4f5c\u70ba\u4e3b\u5eab\uff0c\u8ca0\u8cac\u8655\u7406\u6240\u6709\u5beb\u5165\u6d41\u91cf\uff1b\u53e6\u4e00\u53f0\u4f5c\u70ba\u5f9e\u5eab\uff0c\u63a5\u6536\u4e3b\u5eab\u7684\u5168\u90e8\u8b8a\u66f4\u526f\u672c\u3002\u70ba\u6bcf\u53f0\u4e3b\u6a5f\u5206\u914d\u975c\u614b IP \u4f4d\u5740\u3001\u53ef\u89e3\u6790\u7684\u4e3b\u6a5f\u540d\u7a31\uff0c\u4ee5\u53ca\u7a69\u5b9a\u53ef\u9760\u7684\u7db2\u8def\u9023\u7dda\u3002\u9023\u7dda\u4e2d\u65b7\u662f\u89f8\u767c\u6545\u969c\u5207\u63db\u6700\u5e38\u898b\u7684\u539f\u56e0\u4e4b\u4e00\uff0c\u56e0\u6b64\u7db2\u8def\u672c\u8eab\u5c31\u662f\u67b6\u69cb\u8a2d\u8a08\u7684\u4e00\u90e8\u5206\uff0c\u800c\u4e0d\u662f\u4e8b\u5f8c\u88dc\u6551\u9805\u76ee\u3002<\/p>\n<p>\u6545\u969c\u5207\u63db\u901a\u5e38\u6703\u56e0\u4e09\u985e\u554f\u984c\u88ab\u89f8\u767c\uff1a\u7bc0\u9ede\u4e4b\u9593\u7684\u7db2\u8def\u4e2d\u65b7\u3001\u4e3b\u5eab\u6240\u5728\u6a5f\u5668\u7576\u6a5f\uff0c\u6216\u8005 MySQL \u670d\u52d9\u672c\u8eab\u88ab\u95dc\u9589\u3002\u5c0d\u6545\u969c\u5207\u63db\u5de5\u5177\u4f86\u8aaa\uff0c\u9019\u4e09\u7a2e\u60c5\u6cc1\u8868\u73fe\u4e26\u4e0d\u76f8\u540c\uff0c\u56e0\u6b64\u4f60\u5fc5\u9808\u70ba\u6bcf\u7a2e\u60c5\u6cc1\u8a2d\u8a08\u6e05\u695a\u7684\u61c9\u5c0d\u7b56\u7565\u3002\u4f60\u4e5f\u53ef\u4ee5\u63a1\u7528\u4e3b\u4e3b\u67b6\u69cb\uff0c\u4e5f\u5c31\u662f\u6bcf\u500b\u4e3b\u5eab\u5404\u81ea\u8907\u5beb\u5230\u81ea\u5df1\u7684\u5f9e\u5eab\u3002\u9019\u7a2e\u8a2d\u8a08\u589e\u52a0\u4e86\u8cc7\u6599\u5099\u63f4\uff0c\u4f46\u4f60\u7684\u6545\u969c\u5207\u63db\u65b9\u6848\u4ecd\u7136\u5fc5\u9808\u5728\u6bcf\u500b\u4e3b\u5eab\u5404\u81ea\u64c1\u6709\u5f9e\u5eab\u7684\u524d\u63d0\u4e0b\uff0c\u6e96\u78ba\u63d0\u5347\u6b63\u78ba\u7684\u7bc0\u9ede\u3002\u52d9\u5fc5\u5145\u5206\u6e2c\u8a66\u9019\u7a2e\u62d3\u64b2\uff0c\u56e0\u70ba\u4e00\u65e6\u63d0\u5347\u932f\u8aa4\u7bc0\u9ede\uff0c\u5c31\u6703\u7834\u58de\u6574\u500b\u67b6\u69cb\u7684\u4e00\u81f4\u6027\u3002<\/p>\n<h3>MySQL \u5b89\u88dd\u8207\u7248\u672c\u76f8\u5bb9\u6027<\/h3>\n<p>\u5728\u6240\u6709\u7bc0\u9ede\u4e0a\u5b89\u88dd\u76f8\u540c\u7248\u672c\u7684 MySQL\u3002\u7248\u672c\u4e0d\u4e00\u81f4\u53ef\u80fd\u6703\u5728\u4e00\u4e9b\u7d30\u7bc0\u4e0a\u7834\u58de MySQL \u8907\u5beb\uff0c\u5c24\u5176\u662f\u5728\u4e8c\u9032\u4f4d\u65e5\u8a8c\u683c\u5f0f\u65bc\u4e0d\u540c\u7248\u672c\u4e4b\u9593\u767c\u751f\u8b8a\u5316\u6642\u66f4\u662f\u5982\u6b64\u3002\u5728\u958b\u59cb\u8a2d\u5b9a\u4e4b\u524d\uff0c\u5148\u6aa2\u67e5\u6bcf\u53f0\u4e3b\u6a5f\u4e0a\u7684\u7248\u672c\uff0c\u4e26\u512a\u5148\u5347\u7d1a\u4e0d\u4e00\u81f4\u7684\u4f3a\u670d\u5668\u3002\u5728 Ubuntu \u6216 Debian \u4e0a\uff0c\u4e3b\u8a2d\u5b9a\u6a94\u4f4d\u65bc <code>\/etc\/mysql\/mysql.conf.d\/mysqld.cnf<\/code>\uff0c\u7a0d\u5f8c\u4f60\u9700\u8981\u5728\u4e3b\u5eab\u4e0a\u4fee\u6539\u5b83\u3002<\/p>\n<p>\u5728\u8abf\u6574\u8907\u5beb\u8a2d\u5b9a\u4e4b\u524d\uff0c\u5148\u898f\u5283\u597d\u76e3\u63a7\u65b9\u6848\u3002\u4f60\u9700\u8981\u4e00\u7a2e\u65b9\u6cd5\u4f86\u5feb\u901f\u5075\u6e2c\u4e3b\u5eab\u662f\u5426\u5931\u6548\uff0c\u4e5f\u9700\u8981\u4e00\u7a2e\u65b9\u6cd5\u4f86\u78ba\u8a8d\u526f\u672c\u662f\u5426\u5065\u5eb7\u4e14\u5df2\u7d93\u8ffd\u5e73\u3002\u63d0\u524d\u78ba\u5b9a\u7531\u54ea\u7a2e\u5de5\u5177\u8ca0\u8cac\u76e3\u63a7\u53e2\u96c6\u3001\u6aa2\u67e5\u983b\u7387\u662f\u591a\u5c11\uff0c\u4ee5\u53ca\u6545\u969c\u6642\u901a\u77e5\u8ab0\u3002\u9019\u88e1\u7684\u898f\u5283\u8d8a\u624e\u5be6\uff0c\u5be6\u969b\u6545\u969c\u767c\u751f\u6642\u5c31\u8d8a\u4e0d\u5bb9\u6613\u51fa\u610f\u5916\u3002\u4f3a\u670d\u5668\u6e96\u5099\u5b8c\u6210\u4e14\u7248\u672c\u4e00\u81f4\u5f8c\uff0c\u5c31\u53ef\u4ee5\u9032\u5165\u8907\u5beb\u8a2d\u5b9a\u968e\u6bb5\u3002<\/p>\n<h2>\u8a2d\u5b9a MySQL \u4e3b\u5f9e\u8907\u5beb<\/h2>\n<h3>\u8a2d\u5b9a\u4e3b\u5eab\u4f3a\u670d\u5668<\/h3>\n<p>\u5148\u5f9e\u4f60\u9078\u5b9a\u70ba\u4e3b\u5eab\u7684\u90a3\u53f0\u6a5f\u5668\u958b\u59cb\u3002\u5728 Ubuntu \u6216 Debian \u4e0a\uff0c\u958b\u555f <code>\/etc\/mysql\/mysql.conf.d\/mysqld.cnf<\/code>\uff0c\u8a2d\u5b9a\u552f\u4e00\u7684\u4f3a\u670d\u5668 ID\uff0c\u555f\u7528\u4e8c\u9032\u4f4d\u65e5\u8a8c\uff0c\u4e26\u6307\u5b9a\u65e5\u8a8c\u6a94\u6848\u540d\u7a31\u3002\u9019\u4e9b\u8a2d\u5b9a\u53ef\u4ee5\u8b93\u4e3b\u5eab\u8a18\u9304\u6bcf\u4e00\u6b21\u8b8a\u66f4\uff0c\u4e26\u5c07\u5176\u63d0\u4f9b\u7d66\u5404\u500b\u526f\u672c\u3002<\/p>\n<pre><code>[mysqld]\r\nserver-id = 1\r\nlog_bin = mysql-bin\r\nbinlog_do_db = appdb<\/code><\/pre>\n<p>\u5132\u5b58\u6a94\u6848\u5f8c\u91cd\u65b0\u555f\u52d5\u670d\u52d9\u3002\u63a5\u8457\uff0c\u5efa\u7acb\u4e00\u500b\u5c08\u9580\u7528\u65bc MySQL \u8907\u5beb\u7684\u5e33\u865f\uff0c\u4e26\u6388\u4e88\u5b83 REPLICATION SLAVE \u6b0a\u9650\u3002\u77ed\u66ab\u9396\u8868\u5f8c\uff0c\u8b80\u53d6\u76ee\u524d\u7684\u4e8c\u9032\u4f4d\u65e5\u8a8c\u4f4d\u7f6e\uff0c\u4e26\u8a18\u9304\u65e5\u8a8c\u6a94\u540d\u548c\u504f\u79fb\u91cf\u3002\u9019\u500b\u4f4d\u7f6e\u5c31\u662f\u6bcf\u500b\u5f9e\u5eab\u958b\u59cb\u8907\u5beb\u8cc7\u6599\u7684\u8d77\u9ede\u3002<\/p>\n<h3>\u8a2d\u5b9a\u5f9e\u5eab\u4e26\u555f\u52d5\u8907\u5beb<\/h3>\n<p>\u5207\u63db\u5230\u5f9e\u5eab\u4e3b\u6a5f\uff0c\u7de8\u8f2f\u5b83\u81ea\u5df1\u7684\u8a2d\u5b9a\u6a94\u3002\u70ba\u5176\u5206\u914d\u4e0d\u540c\u7684\u4f3a\u670d\u5668 ID\uff0c\u7136\u5f8c\u91cd\u65b0\u555f\u52d5\u670d\u52d9\u3002\u63a5\u8457\u4f7f\u7528\u4f60\u525b\u624d\u8a18\u9304\u7684\u65e5\u8a8c\u6a94\u6848\u548c\u4f4d\u7f6e\uff0c\u900f\u904e CHANGE MASTER TO \u9673\u8ff0\u5f0f\u5c07\u5f9e\u5eab\u6307\u5411\u4e3b\u5eab\u3002<\/p>\n<pre><code>CHANGE MASTER TO\r\n  MASTER_HOST='192.0.2.10',\r\n  MASTER_USER='repl',\r\n  MASTER_PASSWORD='secret',\r\n  MASTER_LOG_FILE='mysql-bin.000001',\r\n  MASTER_LOG_POS=154;\r\nSTART SLAVE;<\/code><\/pre>\n<p>\u57f7\u884c SHOW SLAVE STATUS\uff0c\u4e26\u78ba\u8a8d Slave_IO_Running \u548c Slave_SQL_Running \u90fd\u986f\u793a\u70ba Yes\u3002\u82e5\u4f60\u9700\u8981\u8a2d\u5b9a\u4e00\u500b\u4e3b\u5eab\u540c\u6642\u8907\u5beb\u5230\u591a\u500b\u5f9e\u5eab\uff0cOracle Utilities \u53ef\u4ee5\u81ea\u52d5\u5316\u9019\u4e00\u6b65\u3002\u900f\u904e\u5728\u4e3b\u5eab\u5beb\u5165\u4e00\u7b46\u8a18\u9304\u3001\u518d\u5230\u5f9e\u5eab\u8b80\u53d6\u8a72\u8a18\u9304\uff0c\u6e2c\u8a66 MySQL \u8907\u5beb\u662f\u5426\u6b63\u5e38\u3002\u63a5\u8457\u5728\u5169\u7aef\u57f7\u884c\u6821\u9a57\u548c\u6bd4\u5c0d\uff0c\u4ee5\u9a57\u8b49\u8cc7\u6599\u4e00\u81f4\u6027\uff0c\u78ba\u4fdd\u8907\u5beb\u93c8\u8def\u771f\u6b63\u53ef\u9760\u3002\u5230\u9019\u4e00\u6b65\uff0c\u4e00\u500b\u5065\u5eb7\u7684\u5f9e\u5eab\u5c31\u5df2\u7d93\u80fd\u5920\u93e1\u50cf\u4e3b\u5eab\uff0c\u4e26\u6e96\u5099\u597d\u63a5\u5165\u6545\u969c\u5207\u63db\u5de5\u5177\u3002<\/p>\n<h2>\u70ba MySQL \u8a2d\u5b9a\u81ea\u52d5\u6545\u969c\u5207\u63db<\/h2>\n<p>\u73fe\u5728\uff0c\u4f60\u5df2\u7d93\u8b93 MySQL \u8907\u5beb\u6b63\u5e38\u904b\u4f5c\u3002\u4e0b\u4e00\u6b65\u5c31\u662f\u52a0\u5165\u4e00\u500b\u53ef\u4ee5\u5728\u4e3b\u5eab\u6545\u969c\u6642\u81ea\u52d5\u63a5\u624b\u7684\u6a5f\u5236\u3002\u751f\u7522\u74b0\u5883\u4e2d\u4e3b\u8981\u6709\u5169\u7a2e\u601d\u8def\uff1aKeepalived \u8ca0\u8cac\u5728\u4e3b\u6a5f\u4e4b\u9593\u6f02\u79fb\u865b\u64ec IP\uff1bMySQL Utilities \u548c InnoDB Cluster \u5247\u76f4\u63a5\u5c07\u5f9e\u5eab\u63d0\u5347\u70ba\u4e3b\u5eab\u3002\u4f60\u4e5f\u53ef\u4ee5\u7d44\u5408\u4f7f\u7528\u9019\u4e9b\u5de5\u5177\uff0c\u4ee5\u7372\u5f97\u66f4\u9ad8\u7684\u8cc7\u6599\u5099\u63f4\u548c\u53ef\u9760\u6027\u3002<\/p>\n<h3>\u4f7f\u7528 Keepalived \u8207\u865b\u64ec IP<\/h3>\n<p>Keepalived \u57f7\u884c\u65bc\u5169\u53f0\u4f3a\u670d\u5668\u4e0a\uff0c\u4e26\u900f\u904e VRRP \u5171\u7528\u4e00\u500b\u6d6e\u52d5 IP \u4f4d\u5740\u3002\u6b63\u5e38\u60c5\u6cc1\u4e0b\uff0c\u9019\u500b\u865b\u64ec IP \u7531\u4e3b\u5eab\u6301\u6709\uff1b\u4e00\u65e6\u4e3b\u5eab\u767c\u751f\u6545\u969c\uff0cKeepalived \u5c31\u6703\u5c07\u8a72 IP \u6f02\u79fb\u5230\u5f9e\u5eab\u3002\u61c9\u7528\u7a0b\u5f0f\u59cb\u7d42\u9023\u7dda\u5230\u540c\u4e00\u500b\u4f4d\u5740\uff0c\u56e0\u6b64\u5e7e\u4e4e\u611f\u53d7\u4e0d\u5230\u5207\u63db\u904e\u7a0b\u3002\u9019\u7a2e\u8a2d\u8a08\u5728\u76e1\u91cf\u5c11\u6539\u52d5\u61c9\u7528\u67b6\u69cb\u7684\u524d\u63d0\u4e0b\uff0c\u5be6\u73fe\u4e86\u9ad8\u53ef\u7528\u3002<\/p>\n<p>Keepalived \u7684\u8a2d\u5b9a\u6a94\u4f4d\u65bc <code>\/etc\/keepalived\/keepalived.conf<\/code>\u3002\u5728\u4e3b\u5eab\u4e0a\uff0c\u4f60\u9700\u8981\u5b9a\u7fa9\u4e00\u500b\u5065\u5eb7\u6aa2\u67e5\u6307\u4ee4\u78bc\u4ee5\u53ca\u4e00\u500b VRRP \u5be6\u4f8b\u3002\u4e0b\u9762\u7684\u7bc4\u4f8b\u5c55\u793a\u4e86\u4f86\u81ea\u5be6\u969b\u90e8\u7f72\u7684\u8a9e\u6cd5\u7d50\u69cb\u3002<\/p>\n<p>\u5c07\u9019\u4efd\u8a2d\u5b9a\u8907\u88fd\u5230\u5f9e\u5eab\uff0c\u4e26\u628a\u72c0\u614b\u6539\u6210 <code>BACKUP<\/code>\uff0c\u540c\u6642\u5c07\u512a\u5148\u7d1a\u964d\u4f4e\u70ba 101\u3002\u7136\u5f8c\u5728\u5169\u53f0\u6a5f\u5668\u4e0a\u91cd\u65b0\u555f\u52d5 keepalived \u670d\u52d9\u3002\u8a72\u670d\u52d9\u6bcf\u5169\u79d2\u6aa2\u67e5\u4e00\u6b21 MySQL \u72c0\u614b\u3002\u7576\u4e3b\u5eab\u7576\u6a5f\u5f8c\uff0c\u5065\u5eb7\u6aa2\u67e5\u6703\u5931\u6557\uff0c\u5099\u5eab\u6703\u5728\u5e7e\u79d2\u5167\u63a5\u7ba1\u865b\u64ec IP\u3002\u5982\u6b64\u4e00\u4f86\uff0c\u4f60\u7121\u9808\u4fee\u6539\u61c9\u7528\u8a2d\u5b9a\uff0c\u4e5f\u80fd\u7372\u5f97\u6545\u969c\u5207\u63db\u80fd\u529b\u3002<\/p>\n<h3>\u4f7f\u7528 MySQL Utilities \u6216 InnoDB Cluster<\/h3>\n<p>MySQL Utilities \u63d0\u4f9b\u4e86\u5169\u500b\u8655\u7406\u4e3b\u5eab\u6545\u969c\u5207\u63db\u7684\u547d\u4ee4\u5217\u5de5\u5177\u3002<code>mysqlrpladmin<\/code> \u7528\u65bc\u57f7\u884c\u53d7\u63a7\u5207\u63db\uff0c\u800c <code>mysqlfailover<\/code> \u5247\u6703\u6301\u7e8c\u76e3\u63a7\u4e3b\u5eab\uff0c\u4e26\u5728\u4e3b\u5eab\u6545\u969c\u6642\u81ea\u52d5\u89f8\u767c\u6545\u969c\u5207\u63db\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u900f\u904e\u57f7\u884c <code>mysqlfailover --master=root@utils1:3306 --discover-slaves-login=root --rediscover<\/code> \u9032\u5165\u76e3\u63a7\u6a21\u5f0f\u3002\u5b83\u6703\u6bcf\u9694\u5e7e\u79d2\u6aa2\u67e5\u4e00\u6b21\u4e3b\u5eab\u72c0\u614b\u3002\u4e00\u65e6\u767c\u73fe\u6545\u969c\uff0c\u5b83\u6703\u8b58\u5225\u6700\u5408\u9069\u7684\u5f9e\u5eab\u9032\u884c\u63d0\u5347\u3002\u8a72\u5de5\u5177\u9084\u6703\u5728\u63d0\u5347\u524d\u5617\u8a66\u5f9e\u5176\u4ed6\u5f9e\u5eab\u88dc\u9f4a\u7f3a\u5931\u4e8b\u4ef6\u3002\u4f60\u4e5f\u53ef\u4ee5\u9650\u5236\u54ea\u4e9b\u5f9e\u5eab\u6709\u8cc7\u683c\u88ab\u63d0\u5347\uff0c\u6216\u8005\u8a2d\u5b9a\u81ea\u8a02\u7684\u6545\u969c\u5207\u63db\u524d\u5f8c\u6307\u4ee4\u78bc\u3002<\/p>\n<p>MySQL InnoDB Cluster \u5247\u63a1\u7528\u4e86\u53e6\u4e00\u7a2e\u601d\u8def\u3002\u5b83\u57fa\u65bc Group Replication\uff0c\u800c Group Replication \u63d0\u4f9b\u7684\u662f\u540c\u6b65\u8907\u5beb\u3002\u4e0b\u8868\u6bd4\u8f03\u4e86 Group Replication \u8207\u50b3\u7d71\u975e\u540c\u6b65\u4e3b\u5f9e\u8907\u5beb\u4e4b\u9593\u7684\u5dee\u7570\u3002<\/p>\n<div class=\"qc-default-table-wrapper \">\n<table style=\"min-width: 75px\">\n<colgroup>\n<col style=\"min-width: 25px\">\n<col style=\"min-width: 25px\">\n<col style=\"min-width: 25px\">\n    <\/colgroup>\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\">\n<p>\u6bd4\u8f03\u9805\u76ee<\/p>\n<\/th>\n<th colspan=\"1\" rowspan=\"1\">\n<p>MySQL Group Replication<\/p>\n<\/th>\n<th colspan=\"1\" rowspan=\"1\">\n<p>\u50b3\u7d71\u4e3b\u5f9e\uff08\u975e\u540c\u6b65\uff09\u8907\u5beb<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u6545\u969c\u5207\u63db\u901f\u5ea6<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u81ea\u52d5\u6545\u969c\u5207\u63db\uff0c\u5e7e\u4e4e\u53ef\u5be6\u73fe\u96f6\u505c\u6a5f\uff1b\u900f\u904e\u6cd5\u5b9a\u591a\u6578\u6a5f\u5236\u9632\u6b62\u8166\u88c2<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u9700\u8981\u4eba\u5de5\u6545\u969c\u5207\u63db\uff0c\u6216\u4f9d\u8cf4\u5916\u90e8\u5de5\u5177\u4ecb\u5165\uff0c\u56e0\u6b64\u6703\u7522\u751f\u505c\u6a5f\uff1b\u96e3\u4ee5\u6eff\u8db3\u6700\u5c0f\u505c\u6a5f\u6642\u9593\u7684\u9ad8\u53ef\u7528\u8981\u6c42<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u4e00\u81f4\u6027<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u55ae\u4e3b\u6a21\u5f0f\u4e0b\u53ef\u5be6\u73fe\u96f6\u8cc7\u6599\u907a\u5931\uff1b\u900f\u904e\u5171\u8b58\u5354\u5b9a\u9032\u884c\u540c\u6b65\u63d0\u4ea4<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u5982\u679c\u4e3b\u5eab\u5728\u526f\u672c\u62c9\u53d6\u4e8c\u9032\u4f4d\u65e5\u8a8c\u4e8b\u4ef6\u524d\u5d29\u6f70\uff0c\u5c31\u5b58\u5728\u8cc7\u6599\u907a\u5931\u98a8\u96aa\uff1b\u8907\u5beb\u5ef6\u9072\u9084\u6703\u5c0e\u81f4\u8b80\u53d6\u820a\u8cc7\u6599\uff0c\u4e26\u5728\u6545\u969c\u5207\u63db\u5f8c\u5e36\u4f86\u8cc7\u6599\u4e0d\u4e00\u81f4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u6b0a\u8861\u9ede<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u7531\u65bc\u5171\u8b58\u6a5f\u5236\uff0c\u5beb\u5165\u5ef6\u9072\u66f4\u9ad8\uff1b\u90e8\u7f72\u66f4\u8907\u96dc\uff0c\u4e26\u4e14\u66f4\u4f9d\u8cf4\u7db2\u8def\u54c1\u8cea<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u5beb\u5165\u5ef6\u9072\u8f03\u4f4e\uff0c\u4f46\u4e00\u81f4\u6027\u4fdd\u969c\u8f03\u5f31<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u5982\u679c\u4f60\u9700\u8981\u5f37\u4e00\u81f4\u6027\uff0c\u4e26\u4e14\u80fd\u5920\u63a5\u53d7\u66f4\u9ad8\u7684\u5beb\u5165\u5ef6\u9072\uff0c\u90a3\u9ebc\u8acb\u9078\u64c7 Group Replication\u3002\u5982\u679c\u4f60\u66f4\u91cd\u8996\u8f03\u7c21\u55ae\u7684\u90e8\u7f72\u65b9\u5f0f\u548c\u8f03\u4f4e\u7684\u57f7\u884c\u958b\u92b7\uff0c\u90a3\u9ebc\u50b3\u7d71\u8907\u5beb\u642d\u914d Keepalived \u6216 MySQL Utilities \u6703\u66f4\u9069\u5408\u3002\u7121\u8ad6\u9078\u64c7\u54ea\u7a2e\u65b9\u6848\uff0c\u90fd\u8981\u5fb9\u5e95\u6e2c\u8a66\u6545\u969c\u5207\u63db\u8a2d\u5b9a\u3002\u6a21\u64ec\u4e3b\u5eab\u5d29\u6f70\uff0c\u4e26\u9a57\u8b49\u865b\u64ec IP \u662f\u5426\u767c\u751f\u6f02\u79fb\u3001\u5f9e\u5eab\u662f\u5426\u88ab\u6b63\u78ba\u63d0\u5347\u3002<\/p>\n<h2>\u6e2c\u8a66\u6545\u969c\u5207\u63db\u8207\u6700\u4f73\u5be6\u52d9<\/h2>\n<h3>\u6a21\u64ec\u4e3b\u5eab\u6545\u969c<\/h3>\n<p>\u5728\u771f\u6b63\u767c\u751f\u6545\u969c\u4e4b\u524d\uff0c\u4f60\u5fc5\u9808\u8b49\u660e\u4f60\u7684\u8a2d\u5b9a\u78ba\u5be6\u53ef\u7528\u3002\u505c\u6b62\u4e3b\u5eab\u4e0a\u7684 MySQL \u670d\u52d9\uff0c\u4e26\u89c0\u5bdf\u7cfb\u7d71\u884c\u70ba\u3002Keepalived \u6703\u900f\u904e\u5065\u5eb7\u6aa2\u67e5\u6307\u4ee4\u78bc\u5075\u6e2c\u5230\u7a0b\u5e8f\u5931\u6548\uff0c\u4e26\u5728\u5e7e\u79d2\u5167\u5c07\u865b\u64ec IP \u6f02\u79fb\u5230\u5f9e\u5eab\u3002\u4f60\u7684\u61c9\u7528\u7a0b\u5f0f\u7121\u9808\u4eba\u5de5\u4ecb\u5165\uff0c\u5c31\u80fd\u91cd\u65b0\u9023\u7dda\u5230\u65b0\u7684\u4f4d\u5740\u3002<\/p>\n<p>\u6700\u597d\u5728\u7dad\u8b77\u8996\u7a97\u671f\u9593\u57f7\u884c\u9019\u985e\u6f14\u7df4\u3002\u78ba\u8a8d\u5f9e\u5eab\u5df2\u7d93\u88ab\u63d0\u5347\u70ba\u4e3b\u5eab\uff0c\u4e26\u4e14\u80fd\u5920\u6b63\u5e38\u63a5\u53d7\u5beb\u5165\u3002\u540c\u6642\u6aa2\u67e5\u820a\u4e3b\u5eab\u6062\u5fa9\u5f8c\uff0c\u662f\u5426\u80fd\u91cd\u65b0\u4ee5\u526f\u672c\u8eab\u5206\u52a0\u5165\u53e2\u96c6\u3002Keepalived \u8ca0\u8cac\u8655\u7406 IP \u6f02\u79fb\uff0c\u4f46\u4f60\u7684\u63d0\u5347\u6307\u4ee4\u78bc\u4ecd\u7136\u9700\u8981\u5728\u65b0\u4e3b\u5eab\u4e0a\u91cd\u8a2d\u8907\u5beb\u95dc\u4fc2\u3002\u6545\u969c\u5207\u63db\u5b8c\u6210\u5f8c\uff0c\u9084\u8981\u9a57\u8b49\u8907\u5beb\u5065\u5eb7\u76e3\u63a7\u5de5\u5177\u662f\u5426\u986f\u793a\u72c0\u614b\u6b63\u5e38\u3002<\/p>\n<h3>\u907f\u514d\u8166\u88c2\u8207\u8cc7\u6599\u907a\u5931<\/h3>\n<p>\u8166\u88c2\u6307\u7684\u662f\u5169\u500b\u7bc0\u9ede\u90fd\u8a8d\u70ba\u81ea\u5df1\u662f\u4e3b\u5eab\uff0c\u4e26\u540c\u6642\u63a5\u53d7\u5beb\u5165\uff0c\u6700\u7d42\u5c0e\u81f4\u8cc7\u6599\u5206\u53c9\u3002MySQL InnoDB Cluster \u900f\u904e\u6cd5\u5b9a\u591a\u6578\u6a5f\u5236\u4f86\u9632\u6b62\u9019\u7a2e\u60c5\u6cc1\u3002\u53ea\u6709\u7576\u5927\u591a\u6578\u7bc0\u9ede\u90fd\u78ba\u8a8d\u5f8c\uff0c\u5beb\u5165\u64cd\u4f5c\u624d\u6703\u63d0\u4ea4\u3002\u9019\u7a2e\u57fa\u65bc Paxos \u7684\u5171\u8b58\u6a5f\u5236\uff0c\u6b63\u662f\u5b83\u5728\u7db2\u8def\u5206\u5340\u5834\u666f\u4e0b\u9632\u6b62\u8166\u88c2\u7684\u6838\u5fc3\u539f\u7406\u3002<\/p>\n<div class=\"qc-default-table-wrapper \">\n<table style=\"min-width: 75px\">\n<colgroup>\n<col style=\"min-width: 25px\">\n<col style=\"min-width: 25px\">\n<col style=\"min-width: 25px\">\n    <\/colgroup>\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\">\n<p>\u53e2\u96c6\u898f\u6a21<\/p>\n<\/th>\n<th colspan=\"1\" rowspan=\"1\">\n<p>\u6240\u9700\u6cd5\u5b9a\u591a\u6578<\/p>\n<\/th>\n<th colspan=\"1\" rowspan=\"1\">\n<p>\u53ef\u5bb9\u5fcd\u7bc0\u9ede\u6545\u969c\u6578<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>1 \u500b\u7bc0\u9ede<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>1<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>0<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>3 \u500b\u7bc0\u9ede\uff08\u5efa\u8b70\uff09<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>2<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>1<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>5 \u500b\u7bc0\u9ede<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>3<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>7 \u500b\u7bc0\u9ede<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>4<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>3<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u5076\u6578\u7bc0\u9ede\u53e2\u96c6\u4e26\u4e0d\u5b89\u5168\u3002\u82e5\u767c\u751f 50\/50 \u5206\u88c2\uff0c\u4efb\u4f55\u4e00\u5074\u90fd\u7121\u6cd5\u53d6\u5f97\u591a\u6578\uff0c\u56e0\u6b64\u96d9\u65b9\u90fd\u6703\u62d2\u7d55\u5beb\u5165\u3002\u9019\u7a2e\u505a\u6cd5\u72a7\u7272\u4e86\u4e00\u90e8\u5206\u53ef\u7528\u6027\uff0c\u4f46\u63db\u4f86\u4e86\u8cc7\u6599\u4e00\u81f4\u6027\u4fdd\u8b77\u3002<\/p>\n<p>\u8acb\u9075\u5faa\u4ee5\u4e0b\u898f\u5247\u4f86\u4fdd\u8b77\u4f60\u7684\u8cc7\u6599\uff1a\u5148\u78ba\u8a8d\u4e3b\u5eab\u78ba\u5be6\u5df2\u7d93\u5931\u6548\uff0c\u518d\u57f7\u884c\u6545\u969c\u5207\u63db\uff1b\u4e00\u6b21\u6545\u969c\u53ea\u5207\u63db\u4e00\u6b21\uff0c\u7d55\u4e0d\u8981\u63d0\u5347\u4e00\u500b\u4e0d\u4e00\u81f4\u7684\u5f9e\u5eab\uff1b\u6240\u6709\u5beb\u5165\u90fd\u5fc5\u9808\u53ea\u9001\u5230\u4e3b\u5eab\uff1b\u6545\u969c\u5207\u63db\u5b8c\u6210\u5f8c\uff0c\u53ca\u6642\u66f4\u65b0\u61c9\u7528\u8a2d\u5b9a\uff0c\u4f7f\u5176\u6307\u5411\u65b0\u7684\u4e3b\u5eab\uff1b\u4e26\u4e14\u4e00\u5b9a\u8981\u5148\u5728\u9810\u767c\u4f48\u6216\u6e2c\u8a66\u74b0\u5883\u4e2d\u9a57\u8b49\u8a2d\u5b9a\u3002<\/p>\n<div class=\"qc-divider-wrapper\">\n<div class=\"qc-divider\" style=\"border-top-style: solid;width: 100%\"><\/div>\n<\/div>\n<p>\u81ea\u52d5\u6545\u969c\u5207\u63db\u5efa\u7acb\u5728\u4e09\u500b\u652f\u67f1\u4e4b\u4e0a\uff1a\u53ef\u7528\u7684\u8907\u5beb\u93c8\u8def\u3001\u53ef\u9760\u7684\u6545\u969c\u5207\u63db\u5de5\u5177\uff0c\u4ee5\u53ca\u53cd\u8986\u7684\u6e2c\u8a66\u6f14\u7df4\u3002\u61c9\u6839\u64da\u4f60\u7684\u62d3\u64b2\u9078\u64c7\u5408\u9069\u7684\u5de5\u5177\u3002Keepalived \u9069\u5408\u7c21\u55ae\u7684\u865b\u64ec IP \u6545\u969c\u5207\u63db\uff0c\u800c MySQL Utilities \u6216 InnoDB Cluster \u66f4\u9069\u5408\u5177\u5099\u62d3\u64b2\u611f\u77e5\u80fd\u529b\u7684\u4e3b\u5eab\u63d0\u5347\u5834\u666f\u3002<\/p>\n<p>\u63a5\u4e0b\u4f86\uff0c\u4f60\u61c9\u8a72\u52a0\u5165\u76e3\u63a7\u3001\u5b9a\u671f\u5b89\u6392\u6545\u969c\u5207\u63db\u6f14\u7df4\uff0c\u4e26\u5728\u6bcf\u6b21\u6e2c\u8a66\u5f8c\u8907\u67e5 MySQL \u65e5\u8a8c\u3002\u6bcf\u4e00\u6b21\u6f14\u7df4\u90fd\u61c9\u5148\u5728\u6e2c\u8a66\u74b0\u5883\u5b8c\u6210\uff0c\u518d\u63a8\u5ee3\u5230\u6b63\u5f0f\u74b0\u5883\u3002\u9019\u6a23\u7684\u7fd2\u6163\u80fd\u66f4\u597d\u5730\u4fdd\u8b77\u8cc7\u6599\uff0c\u4e26\u7dad\u6301\u9ad8\u53ef\u7528\u6027\u3002<\/p>\n<h2>\u5e38\u898b\u554f\u984c<\/h2>\n<h3>\u81ea\u52d5\u6545\u969c\u5207\u63db\u4e00\u822c\u9700\u8981\u591a\u9577\u6642\u9593\uff1f<\/h3>\n<p>Keepalived \u6bcf\u5169\u79d2\u6aa2\u67e5\u4e00\u6b21\u4e3b\u5eab\u72c0\u614b\uff0c\u4e00\u65e6\u5065\u5eb7\u6aa2\u67e5\u5931\u6557\uff0c\u5c31\u6703\u6f02\u79fb\u865b\u64ec IP\uff0c\u56e0\u6b64\u5207\u63db\u901a\u5e38\u6703\u5728\u6578\u79d2\u5167\u5b8c\u6210\u3002MySQL Utilities \u548c InnoDB Cluster \u63d0\u5347\u65b0\u4e3b\u5eab\u7684\u8017\u6642\u4e5f\u5927\u81f4\u76f8\u4f3c\u3002\u5be6\u969b\u6240\u9700\u6642\u9593\u4ecd\u53d6\u6c7a\u65bc\u4f60\u7684\u76e3\u63a7\u9593\u9694\u548c\u7db2\u8def\u72c0\u6cc1\u3002<\/p>\n<h3>\u6c92\u6709\u865b\u64ec IP \u4e5f\u80fd\u5be6\u73fe\u6545\u969c\u5207\u63db\u55ce\uff1f<\/h3>\n<p>\u53ef\u4ee5\u3002MySQL Utilities \u548c InnoDB Cluster \u90fd\u53ef\u4ee5\u76f4\u63a5\u63d0\u5347\u526f\u672c\uff0c\u56e0\u6b64\u4f60\u7684\u61c9\u7528\u7a0b\u5f0f\u9700\u8981\u91cd\u65b0\u9023\u7dda\u5230\u65b0\u7684\u4e3b\u6a5f\u3002\u865b\u64ec IP \u7684\u512a\u52e2\u5728\u65bc\u4fdd\u6301\u5b58\u53d6\u4f4d\u5740\u4e0d\u8b8a\uff0c\u5f9e\u800c\u514d\u53bb\u61c9\u7528\u5c64\u91cd\u65b0\u8a2d\u5b9a\u3002\u5177\u9ad4\u63a1\u7528\u54ea\u7a2e\u65b9\u5f0f\uff0c\u61c9\u6839\u64da\u4f60\u7684\u61c9\u7528\u80fd\u63a5\u53d7\u591a\u5927\u6539\u52d5\u4f86\u6c7a\u5b9a\u3002<\/p>\n<h3>\u6545\u969c\u5207\u63db\u5f8c\uff0c\u820a\u4e3b\u5eab\u6703\u600e\u9ebc\u6a23\uff1f<\/h3>\n<p>\u820a\u4e3b\u5eab\u6062\u5fa9\u5f8c\uff0c\u6703\u4ee5\u526f\u672c\u8eab\u5206\u91cd\u65b0\u52a0\u5165\u3002\u4f60\u7684\u63d0\u5347\u6307\u4ee4\u78bc\u6703\u900f\u904e CHANGE MASTER TO \u5c07\u5b83\u91cd\u65b0\u6307\u5411\u65b0\u7684\u4e3b\u5eab\u3002\u52d9\u5fc5\u78ba\u8a8d\u8907\u5beb\u6062\u5fa9\u6b63\u5e38\uff0c\u4e26\u78ba\u4fdd\u5728\u6545\u969c\u671f\u9593\u6c92\u6709\u4efb\u4f55\u5beb\u5165\u843d\u5230\u9019\u500b\u5df2\u88ab\u964d\u7d1a\u7684\u7bc0\u9ede\u4e0a\u3002<\/p>\n<h3>\u81ea\u52d5\u6545\u969c\u5207\u63db\u6703\u5c0e\u81f4\u5beb\u5165\u907a\u5931\u55ce\uff1f<\/h3>\n<p>\u5728\u975e\u540c\u6b65\u8907\u5beb\u67b6\u69cb\u4e2d\uff0c\u78ba\u5be6\u6709\u9019\u7a2e\u53ef\u80fd\u3002\u5982\u679c\u4e3b\u5eab\u5728\u526f\u672c\u62c9\u53d6\u5230\u6700\u65b0\u4e8c\u9032\u4f4d\u65e5\u8a8c\u4e8b\u4ef6\u4e4b\u524d\u5d29\u6f70\uff0c\u90a3\u9ebc\u6700\u8fd1\u7684\u4e00\u90e8\u5206\u8b8a\u66f4\u53ef\u80fd\u6703\u907a\u5931\u3002InnoDB Cluster \u900f\u904e\u540c\u6b65\u7684 Group Replication \u548c\u57fa\u65bc\u6cd5\u5b9a\u591a\u6578\u7684\u63d0\u4ea4\u6a5f\u5236\u907f\u514d\u4e86\u9019\u500b\u554f\u984c\u3002\u800c\u50b3\u7d71\u67b6\u69cb\u5247\u9700\u8981\u63a5\u53d7\u4e00\u500b\u5c0f\u7bc4\u570d\u7684\u8cc7\u6599\u907a\u5931\u8996\u7a97\u3002<\/p>\n<h3>\u8981\u5be6\u73fe\u5b89\u5168\u6545\u969c\u5207\u63db\uff0c\u81f3\u5c11\u9700\u8981\u591a\u5c11\u500b\u7bc0\u9ede\uff1f<\/h3>\n<p>\u4e09\u500b\u7bc0\u9ede\u53ef\u4ee5\u5f62\u6210 2 \u7684\u6cd5\u5b9a\u591a\u6578\uff0c\u4e26\u5bb9\u5fcd 1 \u500b\u7bc0\u9ede\u6545\u969c\u3002\u5076\u6578\u7bc0\u9ede\u53e2\u96c6\u4e26\u4e0d\u5b89\u5168\uff0c\u56e0\u70ba\u767c\u751f 50\/50 \u5206\u88c2\u6642\uff0c\u4efb\u4f55\u4e00\u5074\u90fd\u62ff\u4e0d\u5230\u591a\u6578\u3002\u5c0d\u65bc\u7c21\u55ae\u7684\u865b\u64ec IP \u6545\u969c\u5207\u63db\uff0cKeepalived \u96d9\u6a5f\u65b9\u6848\u5df2\u7d93\u53ef\u884c\uff1b\u4f46\u5c0d\u65bc\u4f9d\u8cf4\u6cd5\u5b9a\u591a\u6578\u6a5f\u5236\u7684\u65b9\u6848\uff0c\u5247\u9700\u8981\u4f7f\u7528\u5947\u6578\u7bc0\u9ede\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f60\u53ef\u4ee5\u85c9\u52a9 Keepalived\u3001MySQL Utilities \u6216 MySQL InnoDB Cluster [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":12,"featured_media":36065,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[267],"tags":[],"class_list":["post-36068","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-tc"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u5982\u4f55\u70ba MySQL \u4e3b\u5f9e\u67b6\u69cb\u8a2d\u5b9a\u81ea\u52d5\u6545\u969c\u5207\u63db<\/title>\n<meta name=\"description\" content=\"\u4f7f\u7528 Keepalived\u3001MySQL Utilities \u6216 InnoDB Cluster\uff0c\u70ba MySQL \u4e3b\u5f9e\u67b6\u69cb\u5be6\u73fe\u81ea\u52d5\u6545\u969c\u5207\u63db\u3002\u4e86\u89e3\u8907\u5beb\u8a2d\u5b9a\u3001\u865b\u64ec IP \u548c\u5f9e\u5eab\u63d0\u5347\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/\" \/>\n<meta property=\"og:locale\" content=\"zh_TW\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5982\u4f55\u70ba MySQL \u4e3b\u5f9e\u67b6\u69cb\u8a2d\u5b9a\u81ea\u52d5\u6545\u969c\u5207\u63db\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/\" \/>\n<meta property=\"og:site_name\" content=\"Varidata Limited\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-14T08:58:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-09-14T09:14:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.varidata.com\/wp-content\/uploads\/2026\/09\/Screenshot-2026-09-14-165831.png\" \/>\n\t<meta property=\"og:image:width\" content=\"615\" \/>\n\t<meta property=\"og:image:height\" content=\"405\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/blog-tc\\\/how-to-configure-automatic-failover-for-mysql-master-slave\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/blog-tc\\\/how-to-configure-automatic-failover-for-mysql-master-slave\\\/\"},\"author\":\"Varidata\",\"headline\":\"\u5982\u4f55\u70ba MySQL \u4e3b\u5f9e\u67b6\u69cb\u8a2d\u5b9a\u81ea\u52d5\u6545\u969c\u5207\u63db\",\"datePublished\":\"2026-09-14T08:58:59+00:00\",\"dateModified\":\"2026-09-14T09:14:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/blog-tc\\\/how-to-configure-automatic-failover-for-mysql-master-slave\\\/\"},\"wordCount\":129,\"publisher\":{\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/blog-tc\\\/how-to-configure-automatic-failover-for-mysql-master-slave\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.varidata.com\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/Screenshot-2026-09-14-165831.png\",\"articleSection\":[\"Varidata \u5b98\u65b9\u535a\u5ba2\"],\"inLanguage\":\"zh-TW\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/blog-tc\\\/how-to-configure-automatic-failover-for-mysql-master-slave\\\/\",\"url\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/blog-tc\\\/how-to-configure-automatic-failover-for-mysql-master-slave\\\/\",\"name\":\"\u5982\u4f55\u70ba MySQL \u4e3b\u5f9e\u67b6\u69cb\u8a2d\u5b9a\u81ea\u52d5\u6545\u969c\u5207\u63db\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/blog-tc\\\/how-to-configure-automatic-failover-for-mysql-master-slave\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/blog-tc\\\/how-to-configure-automatic-failover-for-mysql-master-slave\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.varidata.com\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/Screenshot-2026-09-14-165831.png\",\"datePublished\":\"2026-09-14T08:58:59+00:00\",\"dateModified\":\"2026-09-14T09:14:31+00:00\",\"description\":\"\u4f7f\u7528 Keepalived\u3001MySQL Utilities \u6216 InnoDB Cluster\uff0c\u70ba MySQL \u4e3b\u5f9e\u67b6\u69cb\u5be6\u73fe\u81ea\u52d5\u6545\u969c\u5207\u63db\u3002\u4e86\u89e3\u8907\u5beb\u8a2d\u5b9a\u3001\u865b\u64ec IP \u548c\u5f9e\u5eab\u63d0\u5347\u3002\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/blog-tc\\\/how-to-configure-automatic-failover-for-mysql-master-slave\\\/#breadcrumb\"},\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/blog-tc\\\/how-to-configure-automatic-failover-for-mysql-master-slave\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/blog-tc\\\/how-to-configure-automatic-failover-for-mysql-master-slave\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.varidata.com\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/Screenshot-2026-09-14-165831.png\",\"contentUrl\":\"https:\\\/\\\/www.varidata.com\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/Screenshot-2026-09-14-165831.png\",\"width\":615,\"height\":405,\"caption\":\"MySQL\u4e3b\u5f9e\u81ea\u52d5\u6545\u969c\u5207\u63db\u67b6\u69cb\u5716\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/blog-tc\\\/how-to-configure-automatic-failover-for-mysql-master-slave\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5982\u4f55\u70ba MySQL \u4e3b\u5f9e\u67b6\u69cb\u8a2d\u5b9a\u81ea\u52d5\u6545\u969c\u5207\u63db\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/#website\",\"url\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/\",\"name\":\"Varidata Limited\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-TW\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/#organization\",\"name\":\"Varidata\",\"url\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.varidata.com\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/varidata_logo_white_-748x480_hor_web-1.png\",\"contentUrl\":\"https:\\\/\\\/www.varidata.com\\\/wp-content\\\/uploads\\\/2021\\\/09\\\/varidata_logo_white_-748x480_hor_web-1.png\",\"width\":248,\"height\":94,\"caption\":\"Varidata\"},\"image\":{\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.varidata.com\\\/zh-tw\\\/#\\\/schema\\\/person\\\/8fe12b0dd65fd2ba7ccf0dea7d14de6c\",\"name\":\"Amy Yan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/087e2e5704ab9b17ce8a5ebfda282b5f9d46ea62ff6c00f7b19ef4d6ce4e83aa?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/087e2e5704ab9b17ce8a5ebfda282b5f9d46ea62ff6c00f7b19ef4d6ce4e83aa?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/087e2e5704ab9b17ce8a5ebfda282b5f9d46ea62ff6c00f7b19ef4d6ce4e83aa?s=96&d=mm&r=g\",\"caption\":\"Amy Yan\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5982\u4f55\u70ba MySQL \u4e3b\u5f9e\u67b6\u69cb\u8a2d\u5b9a\u81ea\u52d5\u6545\u969c\u5207\u63db","description":"\u4f7f\u7528 Keepalived\u3001MySQL Utilities \u6216 InnoDB Cluster\uff0c\u70ba MySQL \u4e3b\u5f9e\u67b6\u69cb\u5be6\u73fe\u81ea\u52d5\u6545\u969c\u5207\u63db\u3002\u4e86\u89e3\u8907\u5beb\u8a2d\u5b9a\u3001\u865b\u64ec IP \u548c\u5f9e\u5eab\u63d0\u5347\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/","og_locale":"zh_TW","og_type":"article","og_title":"\u5982\u4f55\u70ba MySQL \u4e3b\u5f9e\u67b6\u69cb\u8a2d\u5b9a\u81ea\u52d5\u6545\u969c\u5207\u63db","og_url":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/","og_site_name":"Varidata Limited","article_published_time":"2026-09-14T08:58:59+00:00","article_modified_time":"2026-09-14T09:14:31+00:00","og_image":[{"width":615,"height":405,"url":"https:\/\/www.varidata.com\/wp-content\/uploads\/2026\/09\/Screenshot-2026-09-14-165831.png","type":"image\/png"}],"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/#article","isPartOf":{"@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/"},"author":"Varidata","headline":"\u5982\u4f55\u70ba MySQL \u4e3b\u5f9e\u67b6\u69cb\u8a2d\u5b9a\u81ea\u52d5\u6545\u969c\u5207\u63db","datePublished":"2026-09-14T08:58:59+00:00","dateModified":"2026-09-14T09:14:31+00:00","mainEntityOfPage":{"@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/"},"wordCount":129,"publisher":{"@id":"https:\/\/www.varidata.com\/zh-tw\/#organization"},"image":{"@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/#primaryimage"},"thumbnailUrl":"https:\/\/www.varidata.com\/wp-content\/uploads\/2026\/09\/Screenshot-2026-09-14-165831.png","articleSection":["Varidata \u5b98\u65b9\u535a\u5ba2"],"inLanguage":"zh-TW"},{"@type":"WebPage","@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/","url":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/","name":"\u5982\u4f55\u70ba MySQL \u4e3b\u5f9e\u67b6\u69cb\u8a2d\u5b9a\u81ea\u52d5\u6545\u969c\u5207\u63db","isPartOf":{"@id":"https:\/\/www.varidata.com\/zh-tw\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/#primaryimage"},"image":{"@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/#primaryimage"},"thumbnailUrl":"https:\/\/www.varidata.com\/wp-content\/uploads\/2026\/09\/Screenshot-2026-09-14-165831.png","datePublished":"2026-09-14T08:58:59+00:00","dateModified":"2026-09-14T09:14:31+00:00","description":"\u4f7f\u7528 Keepalived\u3001MySQL Utilities \u6216 InnoDB Cluster\uff0c\u70ba MySQL \u4e3b\u5f9e\u67b6\u69cb\u5be6\u73fe\u81ea\u52d5\u6545\u969c\u5207\u63db\u3002\u4e86\u89e3\u8907\u5beb\u8a2d\u5b9a\u3001\u865b\u64ec IP \u548c\u5f9e\u5eab\u63d0\u5347\u3002","breadcrumb":{"@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/#breadcrumb"},"inLanguage":"zh-TW","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/"]}]},{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/#primaryimage","url":"https:\/\/www.varidata.com\/wp-content\/uploads\/2026\/09\/Screenshot-2026-09-14-165831.png","contentUrl":"https:\/\/www.varidata.com\/wp-content\/uploads\/2026\/09\/Screenshot-2026-09-14-165831.png","width":615,"height":405,"caption":"MySQL\u4e3b\u5f9e\u81ea\u52d5\u6545\u969c\u5207\u63db\u67b6\u69cb\u5716"},{"@type":"BreadcrumbList","@id":"https:\/\/www.varidata.com\/zh-tw\/blog-tc\/how-to-configure-automatic-failover-for-mysql-master-slave\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.varidata.com\/zh-tw\/"},{"@type":"ListItem","position":2,"name":"\u5982\u4f55\u70ba MySQL \u4e3b\u5f9e\u67b6\u69cb\u8a2d\u5b9a\u81ea\u52d5\u6545\u969c\u5207\u63db"}]},{"@type":"WebSite","@id":"https:\/\/www.varidata.com\/zh-tw\/#website","url":"https:\/\/www.varidata.com\/zh-tw\/","name":"Varidata Limited","description":"","publisher":{"@id":"https:\/\/www.varidata.com\/zh-tw\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.varidata.com\/zh-tw\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-TW"},{"@type":"Organization","@id":"https:\/\/www.varidata.com\/zh-tw\/#organization","name":"Varidata","url":"https:\/\/www.varidata.com\/zh-tw\/","logo":{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/www.varidata.com\/zh-tw\/#\/schema\/logo\/image\/","url":"https:\/\/www.varidata.com\/wp-content\/uploads\/2021\/09\/varidata_logo_white_-748x480_hor_web-1.png","contentUrl":"https:\/\/www.varidata.com\/wp-content\/uploads\/2021\/09\/varidata_logo_white_-748x480_hor_web-1.png","width":248,"height":94,"caption":"Varidata"},"image":{"@id":"https:\/\/www.varidata.com\/zh-tw\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.varidata.com\/zh-tw\/#\/schema\/person\/8fe12b0dd65fd2ba7ccf0dea7d14de6c","name":"Amy Yan","image":{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/secure.gravatar.com\/avatar\/087e2e5704ab9b17ce8a5ebfda282b5f9d46ea62ff6c00f7b19ef4d6ce4e83aa?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/087e2e5704ab9b17ce8a5ebfda282b5f9d46ea62ff6c00f7b19ef4d6ce4e83aa?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/087e2e5704ab9b17ce8a5ebfda282b5f9d46ea62ff6c00f7b19ef4d6ce4e83aa?s=96&d=mm&r=g","caption":"Amy Yan"}}]}},"_links":{"self":[{"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/posts\/36068","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/comments?post=36068"}],"version-history":[{"count":2,"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/posts\/36068\/revisions"}],"predecessor-version":[{"id":36072,"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/posts\/36068\/revisions\/36072"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/media\/36065"}],"wp:attachment":[{"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/media?parent=36068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/categories?post=36068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.varidata.com\/zh-tw\/wp-json\/wp\/v2\/tags?post=36068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}