{"id":1843,"date":"2020-07-01T06:21:01","date_gmt":"2020-06-30T22:21:01","guid":{"rendered":"http:\/\/39.97.231.10\/?p=1843"},"modified":"2020-07-01T06:21:01","modified_gmt":"2020-06-30T22:21:01","slug":"mysql%e9%ab%98%e5%8f%af%e7%94%a8%e5%a4%8d%e5%88%b6%e7%ae%a1%e7%90%86%e5%b7%a5%e5%85%b7-orchestrator%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"http:\/\/www.weijing.co\/?p=1843","title":{"rendered":"MySQL\u9ad8\u53ef\u7528\u590d\u5236\u7ba1\u7406\u5de5\u5177 \u2014\u2014 Orchestrator\u4f7f\u7528"},"content":{"rendered":"<h2>\u6d4b\u8bd5\u8bf4\u660e<\/h2>\n<h3>\u73af\u5883\u4ecb\u7ecd<\/h3>\n<p>\u670d\u52a1\u5668\u73af\u5883\uff1a<\/p>\n<div>\n<div><\/div>\n<pre>\u4e09\u53f0\u670d\u52a1\u5668\n1\uff1aMySQL\u5b9e\u4f8b\uff083306\u662forch\u7684\u540e\u7aef\u6570\u636e\u5e93\uff0c3307\u662fMySQL\u4e3b\u4ece\u67b6\u6784\u300c\u5f00\u542fGTID\u300d\uff09\nMaster \uff1a192.168.163.131:3307\nSlave  \uff1a192.168.163.132:3307\nSlave  \uff1a192.168.163.133:3307\n2\uff1ahosts\uff08etc\/hosts\uff09\uff1a\n192.168.163.131 test1\n192.168.163.132 test2\n192.168.163.133 test3<\/pre>\n<div><\/div>\n<\/div>\n<p>\u8fd9\u91cc\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0corch\u68c0\u6d4b\u4e3b\u5e93\u5b95\u673a\u4f9d\u8d56\u4ece\u5e93\u7684IO\u7ebf\u7a0b\uff08\u672c\u8eab\u8fde\u4e0d\u4e0a\u4e3b\u5e93\u540e\uff0c\u8fd8\u4f1a\u901a\u8fc7\u4ece\u5e93\u518d\u53bb\u68c0\u6d4b\u4e3b\u5e93\u662f\u5426\u5f02\u5e38\uff09\uff0c\u6240\u4ee5\u9ed8\u8ba4change\u642d\u5efa\u7684\u4e3b\u4ece\u611f\u77e5\u4e3b\u5e93\u5b95\u673a\u7684\u7b49\u5f85\u65f6\u95f4\u8fc7\u957f\uff0c\u9700\u8981\u9700\u8981\u7a0d\u5fae\u6539\u4e0b\uff1a<\/p>\n<div>\n<pre>change master to master_host=\\'192.168.163.131\\',master_port=3307,master_user=\\'rep\\',master_password=\\'rep\\',master_auto_position=1,MASTER_HEARTBEAT_PERIOD=2,MASTER_CONNECT_RETRY=1, MASTER_RETRY_COUNT=86400;<\/pre>\n<\/div>\n<div>\n<pre>set global slave_net_timeout=8;<\/pre>\n<\/div>\n<p><a href=\\\"https:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/replication-options-slave.html#sysvar_slave_net_timeout\\\">slave_net_timeout<\/a>\uff08\u5168\u5c40\u53d8\u91cf\uff09\uff1aMySQL5.7.7\u4e4b\u540e\uff0c\u9ed8\u8ba4\u6539\u621060\u79d2\u3002\u8be5\u53c2\u6570\u5b9a\u4e49\u4e86\u4ece\u5e93\u4ece\u4e3b\u5e93\u83b7\u53d6\u6570\u636e\u7b49\u5f85\u7684\u79d2\u6570\uff0c\u8d85\u8fc7\u8fd9\u4e2a\u65f6\u95f4\u4ece\u5e93\u4f1a\u4e3b\u52a8\u9000\u51fa\u8bfb\u53d6\uff0c\u4e2d\u65ad\u8fde\u63a5\uff0c\u5e76\u5c1d\u8bd5\u91cd\u8fde\u3002<br \/>\n<a href=\\\"http:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/change-master-to.html\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">master_heartbeat_period<\/a>\uff1a\u590d\u5236\u5fc3\u8df3\u7684\u5468\u671f\u3002\u9ed8\u8ba4\u662f<a href=\\\"https:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/replication-options-slave.html#sysvar_slave_net_timeout\\\">slave_net_timeout<\/a>\u7684\u4e00\u534a\u3002Master\u5728\u6ca1\u6709\u6570\u636e\u7684\u65f6\u5019\uff0c\u6bcf<a href=\\\"http:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/change-master-to.html\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">master_heartbeat_period<\/a>\u79d2\u53d1\u9001\u4e00\u4e2a\u5fc3\u8df3\u5305\uff0c\u8fd9\u6837 Slave \u5c31\u80fd\u77e5\u9053 Master \u662f\u4e0d\u662f\u8fd8\u6b63\u5e38\u3002<br \/>\nslave_net_timeout\u662f\u8bbe\u7f6e\u5728\u591a\u4e45\u6ca1\u6536\u5230\u6570\u636e\u540e\u8ba4\u4e3a\u7f51\u7edc\u8d85\u65f6\uff0c\u4e4b\u540e Slave \u7684 IO \u7ebf\u7a0b\u4f1a\u91cd\u65b0\u8fde\u63a5 Master \u3002\u7ed3\u5408\u8fd9\u4e24\u4e2a\u8bbe\u7f6e\u5c31\u53ef\u4ee5\u907f\u514d\u7531\u4e8e\u7f51\u7edc\u95ee\u9898\u5bfc\u81f4\u7684\u590d\u5236\u5ef6\u8bef\u3002master_heartbeat_period \u5355\u4f4d\u662f\u79d2\uff0c\u53ef\u4ee5\u662f\u4e2a\u5e26\u4e0a\u5c0f\u6570\uff0c\u5982 10.5\uff0c\u6700\u9ad8\u7cbe\u5ea6\u4e3a 1 \u6beb\u79d2\u3002<\/p>\n<div>\n<pre>\u91cd\u8bd5\u7b56\u7565\u4e3a\uff1a\n\u5907\u5e93\u8fc7\u4e86slave-net-timeout\u79d2\u8fd8\u6ca1\u6709\u6536\u5230\u4e3b\u5e93\u6765\u7684\u6570\u636e\uff0c\u5b83\u5c31\u4f1a\u5f00\u59cb\u7b2c\u4e00\u6b21\u91cd\u8bd5\u3002\u7136\u540e\u6bcf\u8fc7 master-connect-retry \u79d2\uff0c\u5907\u5e93\u4f1a\u518d\u6b21\u5c1d\u8bd5\u91cd\u8fde\u4e3b\u5e93\u3002\u76f4\u5230\u91cd\u8bd5\u4e86 master-retry-count \u6b21\uff0c\u5b83\u624d\u4f1a\u653e\u5f03\u91cd\u8bd5\u3002\u5982\u679c\u91cd\u8bd5\u7684\u8fc7\u7a0b\u4e2d\uff0c\u8fde\u4e0a\u4e86\u4e3b\u5e93\uff0c\u90a3\u4e48\u5b83\u8ba4\u4e3a\u5f53\u524d\u4e3b\u5e93\u662f\u597d\u7684\uff0c\u53c8\u4f1a\u5f00\u59cb slave-net-timeout \u79d2\u7684\u7b49\u5f85\u3002\nslave-net-timeout \u7684\u9ed8\u8ba4\u503c\u662f 60 \u79d2\uff0c master-connect-retry \u9ed8\u8ba4\u4e3a 60 \u79d2\uff0c master-retry-count \u9ed8\u8ba4\u4e3a 86400 \u6b21\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u4e3b\u5e93\u4e00\u5206\u949f\u90fd\u6ca1\u6709\u4efb\u4f55\u6570\u636e\u53d8\u66f4\u53d1\u9001\u8fc7\u6765\uff0c\u5907\u5e93\u624d\u4f1a\u5c1d\u8bd5\u91cd\u8fde\u4e3b\u5e93\u3002<\/pre>\n<\/div>\n<p>\u8fd9\u6837\uff0c\u4e3b\u5e93\u5b95\u673a\u4e4b\u540e\uff0c\u7ea68~10\u79d2\u611f\u77e5\u4e3b\u5e93\u5f02\u5e38\uff0c<a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\u5f00\u59cb\u5207\u6362\u3002\u53e6\u5916\u8fd8\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0corch\u9ed8\u8ba4\u662f\u7528\u4e3b\u673a\u540d\u6765\u8fdb\u884c\u7ba1\u7406\u7684\uff0c\u9700\u8981\u5728mysql\u7684\u914d\u7f6e\u6587\u4ef6\u91cc\u6dfb\u52a0\uff1areport_host\u548creport_port\u53c2\u6570\u3002<br \/>\n\u6570\u636e\u5e93\u73af\u5883\uff1a<\/p>\n<div>\n<pre>Orchestrator\u540e\u7aef\u6570\u636e\u5e93\uff1a\n\u5728\u542f\u52a8Orchestrator\u7a0b\u5e8f\u7684\u65f6\u5019\uff0c\u4f1a\u81ea\u52a8\u5728\u6570\u636e\u5e93\u91cc\u521b\u5efaorchestrator\u6570\u636e\u5e93\uff0c\u4fdd\u5b58orchestrator\u7684\u4e00\u4e9b\u6570\u636e\u4fe1\u606f\u3002\nOrchestrator\u7ba1\u7406\u7684\u6570\u636e\u5e93\uff1a\n\u5728\u914d\u7f6e\u6587\u4ef6\u91cc\u914d\u7f6e\u7684\u4e00\u4e9bquery\u53c2\u6570\uff0c\u9700\u8981\u5728\u6bcf\u4e2a\u88ab\u7ba1\u7406\u7684\u76ee\u6807\u5e93\u91cc\u6709meta\u5e93\u6765\u4fdd\u7559\u4e00\u4e9b\u5143\u4fe1\u606f\uff08\u7c7b\u4f3ccmdb\u529f\u80fd\uff09\uff0c\u6bd4\u5982\u7528pt-heartbeat\u6765\u9a8c\u8bc1\u4e3b\u4ece\u5ef6\u8fdf\uff1b\u7528cluster\u8868\u6765\u4fdd\u5b58\u522b\u540d\u3001\u6570\u636e\u4e2d\u5fc3\u7b49\u3002<\/pre>\n<\/div>\n<p>\u5982\u4e0b\u9762\u662f\u6d4b\u8bd5\u73af\u5883\u7684cluster\u8868\u4fe1\u606f\uff1a<\/p>\n<div>\n<div><\/div>\n<pre>&gt; CREATE TABLE `cluster` (\n  `anchor` tinyint(4) NOT NULL,\n  `cluster_name` varchar(128) CHARACTER SET ascii NOT NULL DEFAULT \\'\\',\n  `cluster_domain` varchar(128) CHARACTER SET ascii NOT NULL DEFAULT \\'\\',\n  `data_center` varchar(128) NOT NULL,\n  PRIMARY KEY (`anchor`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8\n&gt;select * from cluster;\n+--------+--------------+----------------+-------------+\n| anchor | cluster_name | cluster_domain | data_center |\n+--------+--------------+----------------+-------------+\n|      1 | test         | CaoCao         | BJ          |\n+--------+--------------+----------------+-------------+<\/pre>\n<div><\/div>\n<\/div>\n<h3>\u6d4b\u8bd5\u8bf4\u660e<\/h3>\n<p>\u5f00\u542f<a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\u8fdb\u7a0b\uff1a<\/p>\n<div>\n<pre>.\/orchestrator --config=\/etc\/orchestrator.conf.json http<\/pre>\n<\/div>\n<p>\u5728\u6d4f\u89c8\u5668\u91cc\u8f93\u5165\u4e09\u53f0\u4e3b\u673a\u7684\u4efb\u610f\u4e3b\u673a\u7684IP\u52a0\u7aef\u53e3\uff08http:\/\/192.168.163.131:3000\uff09\u8fdb\u5165\u5230Web\u7ba1\u7406\u754c\u9762\uff0c\u5728Clusters\u5bfc\u822a\u7684Discover\u91cc\u8f93\u5165\u4efb\u610f\u4e00\u53f0\u88ab\u7ba1\u7406MySQL\u5b9e\u4f8b\u7684\u4fe1\u606f\u3002\u6dfb\u52a0\u5b8c\u6210\u4e4b\u540e\uff0cWeb\u754c\u9762\u6548\u679c\uff1a<br \/>\n<img src=\\\"https:\/\/img2018.cnblogs.com\/blog\/163084\/201902\/163084-20190218170011479-429145698.png\\\" alt=\\\"\\\" width=\\\"553\\\" height=\\\"233\\\" \/><br \/>\n\u5728web\u4e0a\u53ef\u4ee5\u8fdb\u884c\u76f8\u5173\u7684\u7ba1\u7406\uff0c\u5173\u4e8eWeb\u4e0a\u7684\u76f8\u5173\u6309\u94ae\u7684\u8bf4\u660e\uff0c\u4e0b\u9762\u4f1a\u505a\u76f8\u5173\u8bf4\u660e\uff1a<br \/>\n1.\u00a0\u00a0\u90e8\u5206\u53ef\u4fee\u6539\u7684\u53c2\u6570(\u70b9\u51fbWeb\u4e0a\u9700\u8981\u88ab\u4fee\u6539\u5b9e\u4f8b\u7684\u4efb\u610f\u56fe\u6807\uff09\uff1a<br \/>\n<img src=\\\"https:\/\/img2018.cnblogs.com\/blog\/163084\/201902\/163084-20190219010132613-2042001429.png\\\" alt=\\\"\\\" width=\\\"555\\\" height=\\\"549\\\" \/><br \/>\n\u8bf4\u660e<\/p>\n<div>\n<div><\/div>\n<pre>Instance Alias \uff1a\u5b9e\u4f8b\u522b\u540d\nLast seen       :  \u6700\u540e\u68c0\u6d4b\u65f6\u95f4\nSelf coordinates \uff1a\u81ea\u8eab\u7684binlog\u4f4d\u70b9\u4fe1\u606f\nNum replicas \uff1a\u6709\u51e0\u4e2a\u4ece\u5e93\nServer ID    \uff1a MySQL server_id\nServer UUID \uff1a    MySQL UUID\nVersion \uff1a    \u7248\u672c\nRead only \uff1a \u662f\u5426\u53ea\u8bfb\nHas binary logs \uff1a\u662f\u5426\u5f00\u542fbinlog\nBinlog format    \uff1abinlog \u6a21\u5f0f\nLogs slave updates \uff1a\u662f\u5426\u5f00\u542flog_slave_updates\nGTID supported \uff1a\u662f\u5426\u652f\u6301GTID\nGTID based replication \uff1a\u662f\u5426\u662f\u57fa\u4e8eGTID\u7684\u590d\u5236\nGTID mode    \uff1a\u590d\u5236\u662f\u5426\u5f00\u542f\u4e86GTID\nExecuted GTID set \uff1a\u590d\u5236\u4e2d\u6267\u884c\u8fc7\u7684GTID\u5217\u8868\nUptime \uff1a\u542f\u52a8\u65f6\u95f4\nAllow TLS \uff1a\u662f\u5426\u5f00\u542fTLS\nCluster \uff1a\u96c6\u7fa4\u522b\u540d\nAudit \uff1a\u5ba1\u8ba1\u5b9e\u4f8b\nAgent \uff1aAgent\u5b9e\u4f8b<\/pre>\n<div><\/div>\n<\/div>\n<p>\u8bf4\u660e\uff1a\u4e0a\u9762\u56fe\u4e2d\uff0c\u540e\u9762\u6709\u6309\u94ae\u7684\u90fd\u662f\u53ef\u4ee5\u5728Web\u4e0a\u8fdb\u884c\u4fee\u6539\u7684\u529f\u80fd\uff0c\u5982\uff1a\u662f\u5426\u53ea\u8bfb\uff0c\u662f\u5426\u5f00\u542fGTID\u7684\u590d\u5236\u7b49\u3002\u5176\u4e2dBegin Downtime \u4f1a\u5c06\u5b9e\u4f8b\u6807\u8bb0\u4e3a\u5df2\u505c\u7528\uff0c\u6b64\u65f6\u5982\u679c\u53d1\u751fFailover\uff0c\u8be5\u5b9e\u4f8b\u4e0d\u4f1a\u53c2\u4e0e\u3002<br \/>\n2.\u00a0\u00a0\u4efb\u610f\u6539\u53d8\u4e3b\u4ece\u7684\u62d3\u6251\u7ed3\u6784\uff1a\u53ef\u4ee5\u76f4\u63a5\u5728\u56fe\u4e0a\u62d6\u52a8\u53d8\u66f4\u590d\u5236\uff0c\u4f1a\u81ea\u52a8\u6062\u590d\u62d3\u6251\u5173\u7cfb\uff1a<br \/>\n<img src=\\\"https:\/\/img2018.cnblogs.com\/blog\/163084\/201902\/163084-20190218170338591-1722669532.gif\\\" alt=\\\"\\\" width=\\\"651\\\" height=\\\"255\\\" \/><br \/>\n3.\u00a0\u00a0\u4e3b\u5e93\u6302\u4e86\u4e4b\u540e\u81ea\u52a8Failover\uff0c\u5982\uff1a<br \/>\n<img src=\\\"https:\/\/img2018.cnblogs.com\/blog\/163084\/201902\/163084-20190218172337242-1994050306.gif\\\" alt=\\\"\\\" width=\\\"649\\\" height=\\\"257\\\" \/><br \/>\n\u56fe\u4e2d\u663e\u793a\uff0c\u5f53\u4e3b\u6302\u6389\u4e4b\u540e\uff0c\u62d3\u6251\u7ed3\u6784\u91cc\u81ea\u52a8\u5254\u9664\u8be5\u4e3b\u8282\u70b9\uff0c\u9009\u62e9\u4e00\u4e2a\u6700\u5408\u9002\u7684\u4ece\u5e93\u63d0\u5347\u6210\u4e3b\u5e93\uff0c\u5e76\u4fee\u590d\u590d\u5236\u62d3\u6251\u3002\u5728Failover\u8fc7\u7a0b\u5f53\u4e2d\uff0c\u53ef\u4ee5\u67e5\u770b\/tmp\/recovery.log\u6587\u4ef6\uff08\u914d\u7f6e\u6587\u4ef6\u91cc\u5b9a\u6b7b\uff09\uff0c\u91cc\u9762\u5305\u542b\u4e86\u5728Failover\u8fc7\u7a0b\u4e2dHooks\u6267\u884c\u7684\u5916\u90e8\u811a\u672c\uff0c\u7c7b\u4f3cMHA\u7684master_ip_failover_script\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u5916\u90e8\u811a\u672c\u8fdb\u884c\u76f8\u5e94\u7684\u5982\uff1aVIP\u5207\u6362\u3001Proxy\u4fee\u6539\u3001DNS\u4fee\u6539\u3001\u4e2d\u95f4\u4ef6\u4fee\u6539\u3001LVS\u4fee\u6539\u7b49\u7b49\uff0c\u5177\u4f53\u7684\u6267\u884c\u811a\u672c\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u5b9e\u9645\u60c5\u51b5\u7f16\u5199\u3002<br \/>\n4.\u00a0\u00a0<a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a><a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/raft-vs-sync-repl.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u9ad8\u53ef\u7528<\/a>\u3002\u56e0\u4e3a\u5728\u4e00\u5f00\u59cb\u5c31\u5df2\u7ecf\u90e8\u7f72\u4e863\u53f0\uff0c\u901a\u8fc7<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/configuration-raft.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u914d\u7f6e\u6587\u4ef6<\/a>\u91cc\u7684<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/deployment-raft.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Raft<\/a>\u53c2\u6570\u8fdb\u884c\u901a\u4fe1\u3002\u53ea\u8981\u67092\u4e2a\u8282\u70b9\u7684<a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\u6b63\u5e38\uff0c\u5c31\u4e0d\u4f1a\u5f71\u54cd\u4f7f\u7528\uff0c\u5982\u679c\u51fa\u73b02\u4e2a\u8282\u70b9\u7684<a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\u5f02\u5e38\uff0c\u5219Failover\u4f1a\u5931\u8d25\u30022\u4e2a\u8282\u70b9\u5f02\u5e38\u7684\u56fe\u5982\u4e0b\uff1a<br \/>\n<img src=\\\"https:\/\/img2018.cnblogs.com\/blog\/163084\/201902\/163084-20190218180148778-225961613.png\\\" alt=\\\"\\\" width=\\\"746\\\" height=\\\"257\\\" \/><br \/>\n\u56fe\u4e2d\u7684\u5404\u4e2a\u8282\u70b9\u5168\u90e8\u663e\u793a\u7070\u8272\uff0c\u6b64\u65f6Raft\u7b97\u6cd5\u5931\u6548\uff0c\u5bfc\u81f4Orch\u7684Failover\u529f\u80fd\u5931\u8d25\u3002\u76f8\u5bf9\u6bd4MHA\u7684Manager\u7684\u5355\u70b9\uff0c<a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\u901a\u8fc7Raft\u7b97\u6cd5\u89e3\u51b3\u4e86\u672c\u8eab\u7684\u9ad8\u53ef\u7528\u6027\u4ee5\u53ca\u89e3\u51b3\u7f51\u7edc\u9694\u79bb\u95ee\u9898\uff0c\u7279\u522b\u662f\u8de8\u6570\u636e\u4e2d\u5fc3\u7f51\u7edc\u5f02\u5e38\u3002\u8fd9\u91cc\u8bf4\u660e\u4e0bRaft\uff0c\u901a\u8fc7\u5171\u8bc6\u7b97\u6cd5\uff1a<br \/>\n<a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\u8282\u70b9\u80fd\u591f\u9009\u62e9\u5177\u6709\u4ef2\u88c1\u7684\u9886\u5bfc\u8005\uff08leader\uff09\u3002\u5982\u67093\u4e2aorch\u8282\u70b9\uff0c\u5176\u4e2d\u4e00\u4e2a\u53ef\u4ee5\u6210\u4e3aleader\uff083\u8282\u70b9\u4ef2\u88c1\u5927\u5c0f\u4e3a2\uff0c5\u8282\u70b9\u4ef2\u88c1\u5927\u5c0f\u4e3a3\uff09\u3002\u53ea\u5141\u8bb8leader\u8fdb\u884c\u4fee\u6539\uff0c\u6bcf\u4e2aMySQL\u62d3\u6251\u670d\u52a1\u5668\u5c06\u7531\u4e09\u4e2a\u4e0d\u540c\u7684orchestrator\u8282\u70b9\u72ec\u7acb\u8bbf\u95ee\uff0c\u5728\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u4e09\u4e2a\u8282\u70b9\u5c06\u770b\u5230\u6216\u591a\u6216\u5c11\u76f8\u540c\u7684\u62d3\u6251\u56fe\uff0c\u4f46\u4ed6\u4eec\u6bcf\u4e2a\u90fd\u4f1a\u72ec\u7acb\u5206\u6790\u5199\u5165\u5176\u81ea\u5df1\u7684\u4e13\u7528\u540e\u7aef\u6570\u636e\u5e93\u670d\u52a1\u5668\uff1a<br \/>\n\u2460 \u6240\u6709\u66f4\u6539\u90fd\u5fc5\u987b\u901a\u8fc7leader\u3002<br \/>\n\u2461\u00a0\u5728\u542f\u7528raft\u6a21\u5f0f\u4e0a\u7981\u6b62\u4f7f\u7528orchestrator\u5ba2\u6237\u7aef\u3002<br \/>\n\u2462 \u5728\u542f\u7528raft\u6a21\u5f0f\u4e0a\u4f7f\u7528orchestrator-client\uff0corchestrator-client\u53ef\u4ee5\u5b89\u88c5\u5728\u6ca1\u6709orchestrator\u4e0a\u7684\u670d\u52a1\u5668\u3002<br \/>\n\u2463 \u5355\u4e2aorchestrator\u8282\u70b9\u7684\u6545\u969c\u4e0d\u4f1a\u5f71\u54cdorchestrator\u7684\u53ef\u7528\u6027\u3002\u57283\u8282\u70b9\u8bbe\u7f6e\u4e0a\uff0c\u6700\u591a\u4e00\u4e2a\u670d\u52a1\u5668\u53ef\u80fd\u4f1a\u5931\u8d25\u3002\u57285\u8282\u70b9\u8bbe\u7f6e\u4e0a\uff0c2\u4e2a\u8282\u70b9\u53ef\u80fd\u4f1a\u5931\u8d25\u3002<br \/>\n\u2464 Orchestrator\u8282\u70b9\u5f02\u5e38\u5173\u95ed\uff0c\u7136\u540e\u518d\u542f\u52a8\u3002\u5b83\u5c06\u91cd\u65b0\u52a0\u5165Raft\u7ec4\uff0c\u5e76\u63a5\u6536\u9057\u6f0f\u7684\u4efb\u4f55\u4e8b\u4ef6,\u53ea\u8981\u6709\u8db3\u591f\u7684Raft\u8bb0\u5f55\u3002<br \/>\n\u2465 \u8981\u52a0\u5165\u6bd4\u65e5\u5fd7\u4fdd\u7559\u5141\u8bb8\u7684\u66f4\u957f\/\u66f4\u8fdc\u7684orchestrator\u8282\u70b9\u6216\u8005\u6570\u636e\u5e93\u5b8c\u5168\u4e3a\u7a7a\u7684\u8282\u70b9\uff0c\u9700\u8981\u4ece\u53e6\u4e00\u4e2a\u6d3b\u52a8\u8282\u70b9<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/raft.md#behavior-and-implications-of-orchestratorraft-setup\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u514b\u9686\u540e\u7aefDB<\/a>\u3002<br \/>\n\u5173\u4e8eRaft\u66f4\u591a\u7684\u4fe1\u606f\u89c1\uff1a<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/raft.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/raft.md<\/a><br \/>\n<a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\u7684<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/raft-vs-sync-repl.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u9ad8\u53ef\u7528\u67092\u79cd\u65b9\u5f0f<\/a>\uff0c\u7b2c\u4e00\u79cd\u5c31\u662f\u4e0a\u9762\u8bf4\u7684\u901a\u8fc7<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/deployment-raft.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Raft<\/a>\uff08\u63a8\u8350\uff09\uff0c\u53e6\u4e00\u79cd\u662f\u901a\u8fc7<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/deployment-shared-backend.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u540e\u7aef\u6570\u636e\u5e93\u7684\u540c\u6b65<\/a>\u3002\u8be6\u7ec6\u4fe1\u606f\u89c1<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/raft-vs-sync-repl.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u6587\u6863<\/a>\u3002\u6587\u6863\u91cc\u8be6\u7ec6\u6bd4\u8f83\u4e86\u4e24\u79cd\u9ad8\u53ef\u7528\u6027\u90e8\u7f72\u65b9\u6cd5\u3002\u4e24\u79cd\u65b9\u6cd5\u7684\u56fe\u5982\u4e0b\uff1a<br \/>\n<img src=\\\"https:\/\/img2018.cnblogs.com\/blog\/163084\/201902\/163084-20190219225803246-157307488.png\\\" alt=\\\"\\\" width=\\\"488\\\" height=\\\"322\\\" \/><br \/>\n\u5230\u8fd9\u91cc\uff0c<a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\u7684\u57fa\u672c\u529f\u80fd\u5df2\u7ecf\u5b9e\u73b0\uff0c\u5305\u62ec\u4e3b\u52a8Failover\u3001\u4fee\u6539\u62d3\u6251\u7ed3\u6784\u4ee5\u53caWeb\u4e0a\u7684\u53ef\u89c6\u5316\u64cd\u4f5c\u3002<br \/>\n5. Web\u4e0a\u5404\u4e2a\u6309\u94ae\u7684\u529f\u80fd\u8bf4\u660e<br \/>\n\u2460\uff1aHome\u4e0b\u7684status\uff1a\u67e5\u770borch\u7684\u72b6\u6001\uff1a\u5305\u62ec\u8fd0\u884c\u65f6\u95f4\u3001\u7248\u672c\u3001\u540e\u7aef\u6570\u636e\u5e93\u4ee5\u53ca\u5404\u4e2aRaft\u8282\u70b9\u7684\u72b6\u6001\u3002<br \/>\n\u2461\uff1aCluster\u4e0b\u7684dashboard\uff1a\u67e5\u770borch\u4e0b\u7684\u6240\u6709\u88ab\u7ba1\u7406\u7684MySQL\u5b9e\u4f8b\u3002<br \/>\n\u2462\uff1aCluster\u4e0b\u7684Failure analysis\uff1a\u67e5\u770b\u6545\u969c\u5206\u6790\u4ee5\u53ca\u5305\u62ec\u8bb0\u5f55\u7684\u6545\u969c\u7c7b\u578b\u5217\u8868\u3002<br \/>\n\u2463\uff1aCluster\u4e0b\u7684Discover\uff1a\u7528\u6765\u53d1\u73b0\u88ab\u7ba1\u7406\u7684MySQL\u5b9e\u4f8b\u3002<br \/>\n\u2464\uff1aAudit\u4e0b\u7684Failure detection\uff1a\u6545\u969c\u68c0\u6d4b\u4fe1\u606f\uff0c\u5305\u542b\u5386\u53f2\u4fe1\u606f\u3002<br \/>\n\u2465\uff1aAudit\u4e0b\u7684Recovery\uff1a\u6545\u969c\u6062\u590d\u4fe1\u606f\u4ee5\u53ca\u6545\u969c\u786e\u8ba4\u3002<br \/>\n\u2466\uff1aAudit\u4e0b\u7684<a href=\\\"https:\/\/github.com\/github\/orchestrator-agent\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Agent<\/a>\uff1a\u662f\u4e00\u4e2a\u5728MySQL\u4e3b\u673a\u4e0a\u8fd0\u884c\u5e76\u4e0eorchestrator\u901a\u4fe1\u7684\u670d\u52a1\uff0c\u80fd\u591f\u5411orch\u63d0\u4f9b\u64cd\u4f5c\u7cfb\u7edf\uff0c\u6587\u4ef6\u7cfb\u7edf\u548cLVM\u4fe1\u606f\uff0c\u4ee5\u53ca\u8c03\u7528\u67d0\u4e9b\u547d\u4ee4\u548c\u811a\u672c\u3002<br \/>\n\u2467\uff1a\u5bfc\u822a\u680f\u91cc\u7684<img src=\\\"https:\/\/img2018.cnblogs.com\/blog\/163084\/201902\/163084-20190219114643288-2002838327.png\\\" alt=\\\"\\\" width=\\\"18\\\" height=\\\"17\\\" \/>\u56fe\u6807\uff0c\u5bf9\u5e94\u5de6\u8fb9\u5bfc\u822a\u680f\u7684\u56fe\u6807\uff1a<br \/>\n\u7b2c1\u884c\uff1a\u96c6\u7fa4\u522b\u540d\u7684\u67e5\u770b\u4fee\u6539\u3002<br \/>\n\u7b2c2\u884c\uff1apools\u3002<br \/>\n\u7b2c3\u884c\uff1aCompact display\uff0c\u7d27\u51d1\u5c55\u793a\u3002<img src=\\\"https:\/\/img2018.cnblogs.com\/blog\/163084\/201902\/163084-20190219115128134-967922582.png\\\" alt=\\\"\\\" width=\\\"22\\\" height=\\\"21\\\" \/><br \/>\n\u7b2c4\u884c\uff1aPool indicator\uff0c\u6c60\u6307\u793a\u5668\u3002<img src=\\\"https:\/\/img2018.cnblogs.com\/blog\/163084\/201902\/163084-20190219115400308-424272566.png\\\" alt=\\\"\\\" width=\\\"20\\\" height=\\\"20\\\" \/><br \/>\n\u7b2c5\u884c\uff1aColorize DC\uff0c\u6bcf\u4e2a\u6570\u636e\u4e2d\u5fc3\u7528\u4e0d\u540c\u989c\u8272\u5c55\u793a\u3002<img src=\\\"https:\/\/img2018.cnblogs.com\/blog\/163084\/201902\/163084-20190219115630089-1429833411.png\\\" alt=\\\"\\\" width=\\\"24\\\" height=\\\"22\\\" \/><br \/>\n\u7b2c6\u884c\uff1aAnonymize\uff0c\u533f\u540d\u96c6\u7fa4\u4e2d\u7684\u4e3b\u673a\u540d\u3002<img src=\\\"https:\/\/img2018.cnblogs.com\/blog\/163084\/201902\/163084-20190219115942562-1845343072.png\\\" alt=\\\"\\\" width=\\\"22\\\" height=\\\"21\\\" \/><br \/>\n\u6ce8\u610f\uff1a\u5de6\u8fb9\u5bfc\u822a\u680f\u91cc\u7684<img src=\\\"https:\/\/img2018.cnblogs.com\/blog\/163084\/201902\/163084-20190219120053779-131236462.png\\\" alt=\\\"\\\" width=\\\"26\\\" height=\\\"24\\\" \/>\u56fe\u6807\uff0c\u8868\u793a\u5b9e\u4f8b\u7684\u6982\u62ec\uff1a\u5b9e\u4f8b\u540d\u3001\u522b\u540d\u3001\u6545\u969c\u68c0\u6d4b\u548c\u6062\u590d\u7b49\u4fe1\u606f\u3002<br \/>\n\u2467\uff1a\u5bfc\u822a\u680f\u91cc\u7684<img src=\\\"https:\/\/img2018.cnblogs.com\/blog\/163084\/201902\/163084-20190219120323532-1505321279.png\\\" alt=\\\"\\\" width=\\\"22\\\" height=\\\"21\\\" \/>\u56fe\u6807\uff0c\u8868\u793a\u662f\u5426\u7981\u6b62\u5168\u5c40\u6062\u590d\u3002\u7981\u6b62\u6389\u7684\u8bdd\u4e0d\u4f1a\u8fdb\u884cFailover\u3002<br \/>\n\u2468\uff1a\u5bfc\u822a\u680f\u91cc\u7684<img src=\\\"https:\/\/img2018.cnblogs.com\/blog\/163084\/201902\/163084-20190219133056778-1995235495.png\\\" alt=\\\"\\\" width=\\\"35\\\" height=\\\"19\\\" \/>\u56fe\u6807\uff0c\u8868\u793a\u662f\u5426\u5f00\u542f\u5237\u65b0\u9875\u9762\uff08\u9ed8\u8ba460\u4e00\u6b21\uff09\u3002<br \/>\n\u2469\uff1a\u5bfc\u822a\u680f\u91cc\u7684<img src=\\\"https:\/\/img2018.cnblogs.com\/blog\/163084\/201902\/163084-20190219134020045-306472431.png\\\" alt=\\\"\\\" width=\\\"73\\\" height=\\\"23\\\" \/>\u56fe\u6807\uff0c\u8868\u793aMySQL\u5b9e\u4f8b\u8fc1\u79fb\u6a21\u5f0f\u3002<\/p>\n<div>\n<pre>Smart mode\uff1a\u81ea\u52a8\u9009\u62e9\u8fc1\u79fb\u6a21\u5f0f\uff0c\u8ba9Orch\u81ea\u5df1\u9009\u62e9\u8fc1\u79fb\u6a21\u5f0f\u3002\nClassic mode\uff1a\u7ecf\u5178\u8fc1\u79fb\u6a21\u5f0f\uff0c\u901a\u8fc7binlog\u548cposition\u8fdb\u884c\u8fc1\u79fb\u3002\nGTID mode\uff1aGTID\u8fc1\u79fb\u6a21\u5f0f\u3002\nPseudo GTID mode\uff1a\u4f2aGTID\u8fc1\u79fb\u6a21\u5f0f\u3002<\/pre>\n<\/div>\n<p>\u5230\u6b64\uff0c<a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\u7684\u57fa\u672c\u6d4b\u8bd5\u548cWeb\u8bf4\u660e\u5df2\u7ecf\u4ecb\u7ecd\u5b8c\u6bd5\u3002\u548cMHA\u6bd4\u5df2\u7ecf\u6709\u5f88\u5927\u7684\u4f53\u9a8c\u63d0\u5347\uff0c\u4e0d\u4ec5\u5728Web\u8fdb\u884c\u90e8\u5206\u53c2\u6570\u7684\u8bbe\u7f6e\u4fee\u6539\uff0c\u8fd8\u53ef\u4ee5\u6539\u53d8\u590d\u5236\u62d3\u6251\uff0c\u6700\u91cd\u8981\u7684\u662f\u89e3\u51b3MHA Manager\u5355\u70b9\u7684\u95ee\u9898\u3002\u8fd8\u6709\u4ec0\u4e48\u7406\u7531\u4e0d\u66ff\u6362MHA\u5462\uff1f:)<\/p>\n<h2>\u5de5\u4f5c\u6d41\u7a0b\u8bf4\u660e<\/h2>\n<p><a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\u5b9e\u73b0\u4e86\u81ea\u52a8Failover\uff0c\u73b0\u5728\u6765\u770b\u770b\u81ea\u52a8Failover\u7684\u5927\u81f4\u6d41\u7a0b\u662f\u600e\u4e48\u6837\u7684\u3002<br \/>\n1.\u00a0<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/failure-detection.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u68c0\u6d4b\u6d41\u7a0b<\/a><br \/>\n\u2460 orchestrator\u5229\u7528\u590d\u5236\u62d3\u6251\uff0c\u5148\u68c0\u67e5\u4e3b\u672c\u8eab\uff0c\u5e76\u89c2\u5bdf\u5176slaves\u3002<br \/>\n\u2461 \u5982\u679corchestrator\u672c\u8eab\u8fde\u4e0d\u4e0a\u4e3b\uff0c\u53ef\u4ee5\u8fde\u4e0a\u8be5\u4e3b\u7684\u4ece\uff0c\u5219\u901a\u8fc7\u4ece\u53bb\u68c0\u6d4b\uff0c\u82e5\u5728\u4ece\u4e0a\u4e5f\u770b\u4e0d\u5230\u4e3b\uff08IO Thread\uff09\u300c2\u6b21\u68c0\u67e5\u300d\uff0c\u5224\u65adMaster\u5b95\u673a\u3002<br \/>\n\u8be5\u68c0\u6d4b\u65b9\u6cd5\u6bd4\u8f83\u5408\u7406\uff0c\u5f53\u4ece\u90fd\u8fde\u4e0d\u4e0a\u4e3b\u4e86\uff0c\u5219\u590d\u5236\u80af\u5b9a\u6709\u51fa\u95ee\u9898\uff0c\u6545\u4f1a\u8fdb\u884c\u5207\u6362\u3002\u6240\u4ee5\u5728\u751f\u4ea7\u4e2d\u975e\u5e38\u53ef\u9760\u3002<br \/>\n\u68c0\u6d4b\u53d1\u751f\u6545\u969c\u540e\u5e76\u4e0d\u90fd\u4f1a\u8fdb\u884c\u81ea\u52a8\u6062\u590d\uff0c\u6bd4\u5982\uff1a\u7981\u6b62\u5168\u5c40\u6062\u590d\u3001\u8bbe\u7f6e\u4e86shutdown time\u3001\u4e0a\u6b21\u6062\u590d\u79bb\u672c\u6b21\u6062\u590d\u65f6\u95f4\u5728RecoveryPeriodBlockSeconds\u8bbe\u7f6e\u7684\u65f6\u95f4\u5185\u3001\u5931\u8d25\u7c7b\u578b\u4e0d\u88ab\u8ba4\u4e3a\u503c\u5f97\u6062\u590d\u7b49\u3002\u68c0\u6d4b\u4e0e\u6062\u590d\u65e0\u5173\uff0c\u4f46\u59cb\u7ec8\u542f\u7528\u3002 \u6bcf\u6b21\u68c0\u6d4b\u90fd\u4f1a\u6267\u884cOnFailureDetectionProcesses Hooks\u3002<br \/>\n<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/configuration-failure-detection.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u914d\u7f6e\u6545\u969c\u68c0\u6d4b<\/a>\uff1a<\/p>\n<div>\n<div><\/div>\n<pre>{\n  \\\"FailureDetectionPeriodBlockMinutes\\\": 60,\n}\nHooks\u76f8\u5173\u53c2\u6570\uff1a\n{\n  \\\"OnFailureDetectionProcesses\\\": [\n    \\\"echo \\'Detected {failureType} on {failureCluster}. Affected replicas: {countReplicas}\\' &gt;&gt; \/tmp\/recovery.log\\\"\n  ],\n}\nMySQL\u590d\u5236\u76f8\u5173\u8c03\u6574\uff1a\nslave_net_timeout\nMASTER_CONNECT_RETRY<\/pre>\n<div><\/div>\n<\/div>\n<p>2.\u00a0<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/topology-recovery.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u6062\u590d\u6d41\u7a0b<\/a><br \/>\n\u6062\u590d\u7684\u5b9e\u4f8b\u9700\u8981\u652f\u6301\uff1aGTID\u3001\u4f2aGTID\u3001\u5f00\u542fBinlog\u3002<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/configuration-recovery.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u6062\u590d\u7684\u914d\u7f6e<\/a>\u5982\u4e0b\uff1a<\/p>\n<div>\n<div><\/div>\n<pre>{\n  \\\"RecoveryPeriodBlockSeconds\\\": 3600,\n  \\\"RecoveryIgnoreHostnameFilters\\\": [],\n  \\\"RecoverMasterClusterFilters\\\": [\n    \\\"thiscluster\\\",\n    \\\"thatcluster\\\"\n  ],\n  \\\"RecoverMasterClusterFilters\\\": [\\\"*\\\"],\n  \\\"RecoverIntermediateMasterClusterFilters\\\": [\n    \\\"*\\\"\n  ],\n}\n{\n  \\\"ApplyMySQLPromotionAfterMasterFailover\\\": true,\n  \\\"PreventCrossDataCenterMasterFailover\\\": false,\n  \\\"FailMasterPromotionIfSQLThreadNotUpToDate\\\": true,\n  \\\"MasterFailoverLostInstancesDowntimeMinutes\\\": 10,\n  \\\"DetachLostReplicasAfterMasterFailover\\\": true,\n}\nHooks\uff1a\n{\n  \\\"PreGracefulTakeoverProcesses\\\": [\n    \\\"echo \\'Planned takeover about to take place on {failureCluster}. Master will switch to read_only\\' &gt;&gt; \/tmp\/recovery.log\\\"\n  ],\n  \\\"PreFailoverProcesses\\\": [\n    \\\"echo \\'Will recover from {failureType} on {failureCluster}\\' &gt;&gt; \/tmp\/recovery.log\\\"\n  ],\n  \\\"PostFailoverProcesses\\\": [\n    \\\"echo \\'(for all types) Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Successor: {successorHost}:{successorPort}\\' &gt;&gt; \/tmp\/recovery.log\\\"\n  ],\n  \\\"PostUnsuccessfulFailoverProcesses\\\": [],\n  \\\"PostMasterFailoverProcesses\\\": [\n    \\\"echo \\'Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:\u2028    {failedPort}; Promoted: {successorHost}:{successorPort}\\' &gt;&gt; \/tmp\/recovery.log\\\"\n  ],\n  \\\"PostIntermediateMasterFailoverProcesses\\\": [],\n  \\\"PostGracefulTakeoverProcesses\\\": [\n    \\\"echo \\'Planned takeover complete\\' &gt;&gt; \/tmp\/recovery.log\\\"\n  ],\n}<\/pre>\n<div><a title=\\\"\u590d\u5236\u4ee3\u7801\\\"><img src=\\\"https:\/\/common.cnblogs.com\/images\/copycode.gif\\\" alt=\\\"\u590d\u5236\u4ee3\u7801\\\" \/><\/a><\/div>\n<\/div>\n<p>\u5177\u4f53\u7684\u53c2\u6570\u542b\u4e49\u8bf7\u53c2\u8003\u300c<a id=\\\"cb_post_title_url\\\" href=\\\"https:\/\/www.cnblogs.com\/zhoujinyi\/p\/10387581.html\\\">MySQL\u9ad8\u53ef\u7528\u590d\u5236\u7ba1\u7406\u5de5\u5177 \u2014\u2014 Orchestrator\u4ecb\u7ecd<\/a>\u300d\u3002\u5728\u6267\u884c\u6545\u969c\u68c0\u6d4b\u548c\u6062\u590d\u7684\u65f6\u5019\u90fd\u53ef\u4ee5\u6267\u884c\u5916\u90e8\u81ea\u5b9a\u4e49\u811a\u672c\uff08hooks\uff09\uff0c\u6765\u914d\u5408\u4f7f\u7528\uff08VIP\u3001Proxy\u3001DNS\uff09\u3002<br \/>\n\u53ef\u4ee5\u6062\u590d\u4e2d\u7ee7\u4e3b\u5e93\uff08DeadIntermediateMaster\uff09\u548c\u4e3b\u5e93\uff1a<br \/>\n\u4e2d\u7ee7\u4e3b\u5e93\uff1a\u6062\u590d\u4f1a\u627e\u5176\u540c\u7ea7\u7684\u8282\u70b9\u8fdb\u884c\u505a\u4e3b\u4ece\u3002\u5339\u914d\u526f\u672c\u6309\u7167\u54ea\u4e9b\u5b9e\u4f8b\u5177\u6709log-slave-updates\u3001\u5b9e\u4f8b\u662f\u5426\u5ef6\u8fdf\u3001\u5b83\u4eec\u662f\u5426\u5177\u6709\u590d\u5236\u8fc7\u6ee4\u5668\u3001\u54ea\u4e9b\u7248\u672c\u7684MySQL\u7b49\u7b49<br \/>\n\u4e3b\u5e93\uff1a\u6062\u590d\u53ef\u4ee5\u6307\u5b9a\u63d0\u5347\u7279\u5b9a\u7684\u4ece\u5e93\u300c\u63d0\u5347\u89c4\u5219\u300d\uff08register-candidate\uff09\uff0c\u63d0\u5347\u7684\u4ece\u5e93\u4e0d\u4e00\u5b9a\u662f\u6700\u65b0\u7684\uff0c\u800c\u662f\u9009\u62e9\u6700\u5408\u9002\u7684\uff0c\u8bbe\u7f6e\u5b8c\u63d0\u5347\u89c4\u5219\u4e4b\u540e\uff0c\u6709\u6548\u671f\u4e3a1\u4e2a\u5c0f\u65f6\u3002<br \/>\n\u63d0\u5347\u89c4\u5219\u9009\u9879\u6709\uff1a<\/p>\n<div>\n<pre>prefer      --\u6bd4\u8f83\u559c\u6b22\nneutral    --\u4e2d\u7acb\uff08\u9ed8\u8ba4\uff09\nprefer_not --\u6bd4\u8f83\u4e0d\u559c\u6b22\nmust_not  --\u62d2\u7edd<\/pre>\n<\/div>\n<p>\u6062\u590d\u652f\u6301\u7684\u7c7b\u578b\u6709\uff1a<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/topology-recovery.md#automated-recovery\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u81ea\u52a8\u6062\u590d<\/a>\u3001<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/topology-recovery.md#graceful-master-promotion\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u4f18\u96c5\u7684\u6062\u590d<\/a>\u3001<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/topology-recovery.md#manual-recovery\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u624b\u52a8\u6062\u590d<\/a>\u3001<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/topology-recovery.md#manual-forced-failover\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u624b\u52a8\u5f3a\u5236\u6062\u590d<\/a>\uff0c\u6062\u590d\u7684\u65f6\u5019\u4e5f\u53ef\u4ee5\u6267\u884c\u76f8\u5e94\u7684<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/topology-recovery.md#recovery-hooks\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Hooks\u53c2\u6570<\/a>\u3002\u5177\u4f53\u7684\u6062\u590d\u6d41\u7a0b\u53ef\u4ee5\u770b<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/topology-recovery.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u6062\u590d\u6d41\u7a0b<\/a>\u7684\u8bf4\u660e\u3002\u5173\u4e8e<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/configuration-recovery.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u6062\u590d\u7684\u914d\u7f6e<\/a>\u53ef\u4ee5<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/configuration-recovery.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u5b98\u65b9\u8bf4\u660e<\/a>\u3002<br \/>\n\u8865\u5145\uff1a\u6bcf\u6b21\u6062\u590d\u9664\u4e86\u81ea\u52a8\u7684Failover\u4e4b\u5916\uff0c\u90fd\u9700\u8981\u914d\u5408\u6267\u884c\u81ea\u5df1\u5b9a\u4e49\u7684Hooks\u7684\u811a\u672c\u6765\u5904\u7406\u5916\u90e8\u7684\u4e00\u4e9b\u64cd\u4f5c\uff1aVIP\u4fee\u6539\u3001DNS\u4fee\u6539\u3001Proxy\u4fee\u6539\u7b49\u7b49\u3002\u6240\u4ee5\u8fd9\u4e48\u591aHooks\u7684\u53c2\u6570\u8be5\u5982\u4f55\u8bbe\u7f6e\u5462\uff1f\u54ea\u4e2a\u53c2\u6570\u9700\u8981\u6267\u884c\uff0c\u54ea\u4e2a\u53c2\u6570\u4e0d\u9700\u8981\u6267\u884c\uff0c\u4ee5\u53caHooks\u7684\u6267\u884c\u987a\u5e8f\u662f\u600e\u4e48\u6837\u7684\uff1f\u867d\u7136\u6587\u7ae0\u91cc\u6709\u4ecb\u7ecd\uff0c\u4f46\u4e3a\u4e86\u66f4\u597d\u7684\u8fdb\u884c\u8bf4\u660e\uff0c\u4e0b\u9762\u8fdb\u884c\u5404\u79cd\u6062\u590d\u573a\u666f\u6267\u884cHooks\u7684\u987a\u5e8f\uff1a<\/p>\n<pre>  \\\"OnFailureDetectionProcesses\\\": [   #\u68c0\u6d4b\u6545\u969c\u65f6\u6267\u884c\n    \\\"echo \\'\u2461  Detected {failureType} on {failureCluster}. Affected replicas: {countSlaves}\\' &gt;&gt; \/tmp\/recovery.log\\\"\n  ],\n  \\\"PreGracefulTakeoverProcesses\\\": [   #\u5728\u4e3b\u53d8\u4e3a\u53ea\u8bfb\u4e4b\u524d\u7acb\u5373\u6267\u884c\n    \\\"echo \\'\u2460   Planned takeover about to take place on {failureCluster}. Master will switch to read_only\\' &gt;&gt; \/tmp\/recovery.log\\\"\n  ],\n  \\\"PreFailoverProcesses\\\": [   #\u5728\u6267\u884c\u6062\u590d\u64cd\u4f5c\u4e4b\u524d\u7acb\u5373\u6267\u884c\n    \\\"echo \\'\u2462  Will recover from {failureType} on {failureCluster}\\' &gt;&gt; \/tmp\/recovery.log\\\"\n  ],\n  \\\"PostMasterFailoverProcesses\\\": [ #\u5728\u4e3b\u6062\u590d\u6210\u529f\u7ed3\u675f\u65f6\u6267\u884c\n    \\\"echo \\'\u2463  Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Promoted: {successorHost}:{successorPort}\\' &gt;&gt; \/tmp\/recovery.log\\\"\n  ],\n  \\\"PostFailoverProcesses\\\": [   #\u5728\u4efb\u4f55\u6210\u529f\u6062\u590d\u7ed3\u675f\u65f6\u6267\u884c\n    \\\"echo \\'\u2464  (for all types) Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Successor: {successorHost}:{successorPort}\\' &gt;&gt; \/tmp\/recovery.log\\\"\n  ],\n  \\\"PostUnsuccessfulFailoverProcesses\\\": [  #\u5728\u4efb\u4f55\u4e0d\u6210\u529f\u7684\u6062\u590d\u7ed3\u675f\u65f6\u6267\u884c\n    \\\"echo \\'\u2467  &gt;&gt; \/tmp\/recovery.log\\'\\\"\n  ],\n  \\\"PostIntermediateMasterFailoverProcesses\\\": [  #\u5728\u6210\u529f\u7684\u4e2d\u95f4\u4e3b\u6062\u590d\u7ed3\u675f\u65f6\u6267\u884c\n    \\\"echo \\'\u2465 Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Successor: {successorHost}:{successorPort}\\' &gt;&gt; \/tmp\/recovery.log\\\"\n  ],\n  \\\"PostGracefulTakeoverProcesses\\\": [   #\u5728\u65e7\u4e3b\u4f4d\u4e8e\u65b0\u664b\u5347\u7684\u4e3b\u4e4b\u540e\u6267\u884c\n    \\\"echo \\'\u2466 Planned takeover complete\\' &gt;&gt; \/tmp\/recovery.log\\\"\n  ],<\/pre>\n<div><\/div>\n<div>\n<pre> \u4e3b\u5e93\u5b95\u673a\uff0c\u81ea\u52a8Failover\n\u2461  Detected UnreachableMaster on test1:3307. Affected replicas: 2\n\u2461  Detected DeadMaster on test1:3307. Affected replicas: 2\n\u2462  Will recover from DeadMaster on test1:3307\n\u2463  Recovered from DeadMaster on test1:3307. Failed: test1:3307; Promoted: test2:3307\n\u2464  (for all types) Recovered from DeadMaster on test1:3307. Failed: test1:3307; Successor: test2:3307\n \u4f18\u96c5\u7684\u4e3b\u4ece\u5207\u6362\uff1atest2:3307\u4f18\u96c5\u7684\u5207\u6362\u5230test1:3307\uff0c\u5207\u6362\u4e4b\u540e\u9700\u8981\u624b\u52a8\u6267\u884cstart slave\n  orchestrator-client -c graceful-master-takeover -a test2:3307 -d test1:3307\n\u2460  Planned takeover about to take place on test2:3307. Master will switch to read_only\n\u2461  Detected DeadMaster on test2:3307. Affected replicas: 1\n\u2462  Will recover from DeadMaster on test2:3307\n\u2463  Recovered from DeadMaster on test2:3307. Failed: test2:3307; Promoted: test1:3307\n\u2464  (for all types) Recovered from DeadMaster on test2:3307. Failed: test2:3307; Successor: test1:3307\n\u2466 Planned takeover complete\n \u624b\u52a8\u6062\u590d\uff0c\u5f53\u4ece\u5e93\u8fdb\u5165\u505c\u673a\u6216\u5219\u7ef4\u62a4\u6a21\u5f0f\uff0c\u6b64\u65f6\u4e3b\u5e93\u5b95\u673a\uff0c\u4e0d\u4f1a\u81ea\u52a8Failover\uff0c\u9700\u8981\u624b\u52a8\u6267\u884c\u6062\u590d\uff0c\u6307\u5b9a\u6b7b\u6389\u7684\u4e3b\u5b9e\u4f8b\uff1a\n  orchestrator-client -c recover -i test1:3307\n\u2461  Detected UnreachableMaster on test1:3307. Affected replicas: 2\n\u2461  Detected DeadMaster on test1:3307. Affected replicas: 2\n\u2462  Will recover from DeadMaster on test1:3307\n\u2463  Recovered from DeadMaster on test1:3307. Failed: test1:3307; Promoted: test2:3307\n\u2464  (for all types) Recovered from DeadMaster on test1:3307. Failed: test1:3307; Successor: test2:3307\n \u624b\u52a8\u5f3a\u5236\u6062\u590d\uff0c\u4e0d\u7ba1\u4efb\u4f55\u60c5\u51b5\uff0c\u90fd\u8fdb\u884c\u6062\u590d\uff1a\n  orchestrator-client -c force-master-failover -i test2:3307\n\u2461  Detected DeadMaster on test2:3307. Affected replicas: 2\n\u2462  Will recover from DeadMaster on test2:3307\n\u2461  Detected AllMasterSlavesNotReplicating on test2:3307. Affected replicas: 2\n\u2463  Recovered from DeadMaster on test2:3307. Failed: test2:3307; Promoted: test1:3307\n\u2464  (for all types) Recovered from DeadMaster on test2:3307. Failed: test2:3307; Successor: test1:3307<\/pre>\n<div><\/div>\n<\/div>\n<p>\u5176\u4e2d\u4e0a\u9762\u7684\u60c5\u51b5\u4e0b\uff0c\u2465\u548c\u2467\u90fd\u6ca1\u6267\u884c\u3002\u56e0\u4e3a\u2465\u662f\u6267\u884c\u4e2d\u95f4\u4e3b\u5e93\u65f6\u5019\u6267\u884c\u7684\uff0c\u6ca1\u6709\u4e2d\u95f4\u4e3b\u5e93\uff08\u7ea7\u8054\u590d\u5236\uff09\u53ef\u4ee5\u4e0d\u7528\u8bbe\u7f6e\u3002\u2467\u662f\u6062\u590d\u5931\u8d25\u7684\u65f6\u5019\u6267\u884c\u7684\uff0c\u4e0a\u9762\u6062\u590d\u6ca1\u6709\u51fa\u73b0\u5931\u8d25\uff0c\u53ef\u4ee5\u5b9a\u4e49\u4e00\u4e9b\u544a\u8b66\u63d0\u9192\u3002<\/p>\n<h2>\u751f\u4ea7\u73af\u5883\u4e0a\u90e8\u7f72<\/h2>\n<p>\u5728\u751f\u4ea7\u4e0a\u90e8\u7f72<a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\uff0c\u53ef\u4ee5\u53c2\u8003<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/deployment.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u6587\u6863<\/a>\u3002<br \/>\n1.\u00a0\u00a0<a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\u9996\u5148\u9700\u8981\u786e\u8ba4\u672c\u8eab\u9ad8\u53ef\u7528\u7684\u540e\u7aef\u6570\u636e\u5e93\u662f\u7528\u5355\u4e2aMySQL\uff0cMySQL\u590d\u5236\u8fd8\u662f\u672c\u8eab\u7684Raft\u3002<br \/>\n2.\u00a0\u8fd0\u884c\u53d1\u73b0\u670d\u52a1\uff08web\u3001orchestrator-client\uff09<\/p>\n<div>\n<pre>orchestrator-client -c discover -i this.hostname.com<\/pre>\n<\/div>\n<p>3.\u00a0\u786e\u5b9a\u63d0\u5347\u89c4\u5219\uff08\u67d0\u4e9b\u670d\u52a1\u5668\u66f4\u9002\u5408\u88ab\u63d0\u5347\uff09<\/p>\n<div>\n<pre>orchestrator -c register-candidate -i ${::fqdn} --promotion-rule ${promotion_rule}<\/pre>\n<\/div>\n<p>4.\u00a0\u5982\u679c\u670d\u52a1\u5668\u51fa\u73b0\u95ee\u9898\uff0c\u5c06\u5728Web\u754c\u9762\u4e0a\u7684\u95ee\u9898\u4e0b\u62c9\u5217\u8868\u4e2d\u663e\u793a\u3002\u4f7f\u7528<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/deployment.md#downtiming\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Downtiming<\/a>\u5219\u4e0d\u4f1a\u5728\u95ee\u9898\u5217\u8868\u91cc\u663e\u793a\uff0c\u5e76\u4e14\u4e5f\u4e0d\u4f1a\u8fdb\u884c\u6062\u590d\uff0c\u5904\u4e8e\u7ef4\u62a4\u6a21\u5f0f\u3002<\/p>\n<div>\n<pre>orchestrator -c begin-downtime -i ${::fqdn} --duration=5m --owner=cron --reason=continuous_downtime\\\"\n\u4e5f\u53ef\u4ee5\u7528API\uff1a\ncurl -s \\\"http:\/\/my.orchestrator.service:80\/api\/begin-downtime\/my.hostname\/3306\/wallace\/experimenting+failover\/45m\\\"<\/pre>\n<\/div>\n<p>5.\u00a0<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/deployment.md#pseudo-gtid\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u4f2aGTID<\/a>\uff0c\u5982\u679cMySQL\u6ca1\u6709\u5f00\u542fGTID\uff0c\u5219\u53ef\u4ee5\u5f00\u542f\u4f2aGTID\u5b9e\u73b0\u7c7b\u4f3cGTID\u7684\u529f\u80fd\u3002<br \/>\n6.\u00a0\u4fdd\u5b58<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/deployment.md#populating-meta-data\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u5143\u6570\u636e<\/a>\uff0c\u5143\u6570\u636e\u5927\u90e8\u5206\u901a\u8fc7\u53c2\u6570\u7684query\u6765\u83b7\u53d6\uff0c\u6bd4\u5982\u5728\u81ea\u7684\u8868cluster\u91cc\u83b7\u53d6\u96c6\u7fa4\u7684\u522b\u540d(DetectClusterAliasQuery)\u3001\u6570\u636e\u4e2d\u5fc3(DetectDataCenterQuery)\u3001\u57df\u540d(DetectClusterDomainQuery)\u7b49\uff0c\u4ee5\u53ca\u590d\u5236\u7684\u5ef6\u8fdf\uff08pt-heartbeat\uff09\u3001\u662f\u5426\u534a\u540c\u6b65(DetectSemiSyncEnforcedQuery)\u3002\u4ee5\u53ca\u53ef\u4ee5\u901a\u8fc7\u6b63\u5219\u5339\u914d\uff1aDataCenterPattern\u3001PhysicalEnvironmentPattern\u7b49\u3002<br \/>\n7.\u00a0\u53ef\u4ee5\u7ed9\u5b9e\u4f8b\u6253<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/tags.md\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u6807\u7b7e<\/a>\u3002<\/p>\n<h2>\u547d\u4ee4\u884c\u3001API\u7684\u4f7f\u7528<\/h2>\n<p><a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\u4e0d\u4ec5\u6709Web\u754c\u9762\u6765\u8fdb\u884c\u67e5\u770b\u548c\u7ba1\u7406\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\uff08<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/622e979722bf433232ae267727933ba055cdbfed\/docs\/orchestrator-client.md#orchestrator-client\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">orchestrator-client<\/a>\uff09\u548cAPI\uff08curl\uff09\u6765\u6267\u884c\u66f4\u591a\u7684\u7ba1\u7406\u547d\u4ee4\uff0c\u73b0\u5728\u6765\u8bf4\u660e\u51e0\u4e2a\u6bd4\u8f83\u5e38\u7528\u65b9\u6cd5\u3002<br \/>\n\u901a\u8fc7help\u6765\u770b\u4e0b\u6709\u54ea\u4e9b\u53ef\u4ee5\u6267\u884c\u7684\u547d\u4ee4\uff1a.\/orchestrator-client &#8211;help\uff0c\u547d\u4ee4\u7684\u8bf4\u660e\u53ef\u4ee5\u770b<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/622e979722bf433232ae267727933ba055cdbfed\/go\/app\/command_help.go\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">\u624b\u518c\u8bf4\u660e.<\/a><br \/>\n<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/622e979722bf433232ae267727933ba055cdbfed\/docs\/orchestrator-client.md#orchestrator-client\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">orchestrator-client<\/a>\u4e0d\u9700\u8981\u548c<a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\u670d\u52a1\u653e\u4e00\u8d77\uff0c\u4e0d\u9700\u8981\u8bbf\u95ee\u540e\u7aef\u6570\u636e\u5e93\uff0c\u5728\u4efb\u610f\u4e00\u53f0\u4e0a\u90fd\u53ef\u4ee5\u3002<br \/>\n\u6ce8\u610f\uff1a\u56e0\u4e3a\u914d\u7f6e\u4e86Raft\uff0c\u6709\u591a\u4e2aOrchestrator\uff0c\u6240\u4ee5\u9700\u8981ORCHESTRATOR_API\u7684\u73af\u5883\u53d8\u91cf\uff0corchestrator-client\u4f1a\u81ea\u52a8\u9009\u62e9leader\u3002\u5982\uff1a<\/p>\n<div>\n<pre>export ORCHESTRATOR_API=\\\"test1:3000\/api test2:3000\/api test3:3000\/api\\\"<\/pre>\n<\/div>\n<p>1. \u5217\u51fa\u6240\u6709\u96c6\u7fa4\uff1aclusters<br \/>\n\u9ed8\u8ba4\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c clusters\ntest2:3307<\/pre>\n<\/div>\n<p>\u8fd4\u56de\u5305\u542b\u96c6\u7fa4\u522b\u540d\uff1aclusters-alias<\/p>\n<div>\n<pre># orchestrator-client -c clusters-alias\ntest2:3307,test<\/pre>\n<\/div>\n<p>2. \u53d1\u73b0\u6307\u5b9a\u5b9e\u4f8b\uff1adiscover\/async-discover<br \/>\n\u540c\u6b65\u53d1\u73b0\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c discover -i test1:3307\ntest1:3307<\/pre>\n<\/div>\n<p>\u5f02\u6b65\u53d1\u73b0\uff1a\u9002\u7528\u4e8e\u6279\u91cf<\/p>\n<div>\n<pre># orchestrator-client -c async-discover -i test1:3307\n:null<\/pre>\n<\/div>\n<p>3. \u5fd8\u8bb0\u6307\u5b9a\u5bf9\u8c61\uff1aforget\/forget-cluster<br \/>\n\u5fd8\u8bb0\u6307\u5b9a\u5b9e\u4f8b\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c forget -i test1:3307<\/pre>\n<\/div>\n<p>\u5fd8\u8bb0\u6307\u5b9a\u96c6\u7fa4\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c forget-cluster -i test<\/pre>\n<\/div>\n<p>4. \u6253\u5370\u6307\u5b9a\u96c6\u7fa4\u7684\u62d3\u6251\uff1atopology\/topology-tabulated<br \/>\n\u666e\u901a\u8fd4\u56de\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c topology -i test1:3307\ntest2:3307   [0s,ok,5.7.25-0ubuntu0.16.04.2-log,rw,ROW,&gt;&gt;,GTID]\n+ test1:3307 [0s,ok,5.7.25-0ubuntu0.16.04.2-log,ro,ROW,&gt;&gt;,GTID]\n+ test3:3307 [0s,ok,5.7.25-log,ro,ROW,&gt;&gt;,GTID]<\/pre>\n<\/div>\n<p>\u5217\u8868\u8fd4\u56de\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c topology-tabulated -i test1:3307\ntest2:3307  |0s|ok|5.7.25-0ubuntu0.16.04.2-log|rw|ROW|&gt;&gt;,GTID\n+ test1:3307|0s|ok|5.7.25-0ubuntu0.16.04.2-log|ro|ROW|&gt;&gt;,GTID\n+ test3:3307|0s|ok|5.7.25-log                 |ro|ROW|&gt;&gt;,GTID<\/pre>\n<\/div>\n<p>5. \u67e5\u770b\u4f7f\u7528\u54ea\u4e2aAPI\uff1a\u81ea\u5df1\u4f1a\u9009\u62e9\u51faleader\u3002which-api<\/p>\n<div>\n<pre># orchestrator-client -c which-api\ntest3:3000\/api<\/pre>\n<\/div>\n<p>\u4e5f\u53ef\u4ee5\u901a\u8fc7 http:\/\/192.168.163.133:3000\/api\/leader-check \u67e5\u770b\u3002<br \/>\n6. \u8c03\u7528api\u8bf7\u6c42\uff0c\u9700\u8981\u548c -path \u53c2\u6570\u4e00\u8d77\uff1aapi..-path<\/p>\n<div>\n<pre># orchestrator-client -c api -path clusters\n[ \\\"test2:3307\\\" ]\n# orchestrator-client -c api -path leader-check\n\\\"OK\\\"\n# orchestrator-client -c api -path status\n{ \\\"Code\\\": \\\"OK\\\", \\\"Message\\\": \\\"Application node is healthy\\\"...}<\/pre>\n<\/div>\n<p>7. \u641c\u7d22\u5b9e\u4f8b\uff1asearch<\/p>\n<div>\n<pre># orchestrator-client -c search -i test\ntest2:3307\ntest1:3307\ntest3:3307<\/pre>\n<\/div>\n<p>8. \u6253\u5370\u6307\u5b9a\u5b9e\u4f8b\u7684\u4e3b\u5e93\uff1awhich-master<\/p>\n<div>\n<pre># orchestrator-client -c which-master -i test1:3307\ntest2:3307\n# orchestrator-client -c which-master -i test3:3307\ntest2:3307\n# orchestrator-client -c which-master -i test2:3307 #\u81ea\u5df1\u672c\u8eab\u662f\u4e3b\u5e93\n:0<\/pre>\n<\/div>\n<p>9. \u6253\u5370\u6307\u5b9a\u5b9e\u4f8b\u7684\u4ece\u5e93\uff1awhich-replicas<\/p>\n<div>\n<pre># orchestrator-client -c which-replicas -i test2:3307\ntest1:3307\ntest3:3307<\/pre>\n<\/div>\n<p>10. \u6253\u5370\u6307\u5b9a\u5b9e\u4f8b\u7684\u5b9e\u4f8b\u540d\uff1awhich-instance<\/p>\n<div>\n<pre># orchestrator-client -c instance -i test1:3307\ntest1:3307<\/pre>\n<\/div>\n<p>11. \u6253\u5370\u6307\u5b9a\u4e3b\u5b9e\u4f8b\u4ece\u5e93\u5f02\u5e38\u7684\u5217\u8868\uff1awhich-broken-replicas\uff0c\u6a21\u62dftest3\u7684\u590d\u5236\u5f02\u5e38\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c which-broken-replicas -i test2:3307\ntest3:3307<\/pre>\n<\/div>\n<p>12. \u7ed9\u51fa\u4e00\u4e2a\u5b9e\u4f8b\u6216\u5219\u96c6\u7fa4\u522b\u540d\uff0c\u6253\u5370\u51fa\u8be5\u5b9e\u4f8b\u6240\u5728\u96c6\u7fa4\u4e0b\u7684\u6240\u6709\u5176\u4ed6\u5b9e\u4f8b\u3002which-cluster-instances<\/p>\n<div>\n<pre># orchestrator-client -c which-cluster-instances -i test\ntest1:3307\ntest2:3307\ntest3:3307\nroot@test1:~# orchestrator-client -c which-cluster-instances -i test1:3307\ntest1:3307\ntest2:3307\ntest3:3307<\/pre>\n<div><\/div>\n<\/div>\n<p>13. \u7ed9\u51fa\u4e00\u4e2a\u5b9e\u4f8b\uff0c\u6253\u5370\u8be5\u5b9e\u7684\u96c6\u7fa4\u540d\u79f0\uff1a\u9ed8\u8ba4\u662fhostname:port\u3002which-cluster<\/p>\n<div>\n<pre># orchestrator-client -c which-cluster -i test1:3307\ntest2:3307# orchestrator-client -c which-cluster -i test2:3307\ntest2:3307# orchestrator-client -c which-cluster -i test3:3307\ntest2:3307<\/pre>\n<\/div>\n<p>14. \u6253\u5370\u51fa\u6307\u5b9a\u5b9e\u4f8b\/\u96c6\u7fa4\u540d\u6216\u5219\u6240\u6709\u6240\u5728\u96c6\u7fa4\u7684\u53ef\u5199\u5b9e\u4f8b\uff0c\uff1awhich-cluster-master<br \/>\n\u6307\u5b9a\u5b9e\u4f8b\uff1awhich-cluster-master<\/p>\n<div>\n<pre># orchestrator-client -c which-cluster-master -i test2:3307\ntest2:3307\n# orchestrator-client -c which-cluster-master -i test\ntest2:3307<\/pre>\n<\/div>\n<p>\u6240\u6709\u5b9e\u4f8b\uff1aall-clusters-masters\uff0c\u6bcf\u4e2a\u96c6\u7fa4\u8fd4\u56de\u4e00\u4e2a<\/p>\n<div>\n<pre># orchestrator-client -c all-clusters-masters\ntest1:3307<\/pre>\n<\/div>\n<p>15. \u6253\u5370\u51fa\u6240\u6709\u5b9e\u4f8b\uff1aall-instances<\/p>\n<div>\n<pre># orchestrator-client -c all-instances\ntest2:3307\ntest1:3307\ntest3:3307<\/pre>\n<\/div>\n<p>16. \u6253\u5370\u51fa\u96c6\u7fa4\u4e2d\u53ef\u4ee5\u4f5c\u4e3apt-online-schema-change\u64cd\u4f5c\u7684\u526f\u672c\u5217\u8868\uff1awhich-cluster-osc-replicas<\/p>\n<div>\n<pre>~# orchestrator-client -c which-cluster-osc-replicas -i test\ntest1:3307\ntest3:3307\nroot@test1:~# orchestrator-client -c which-cluster-osc-replicas -i test2:3307\ntest1:3307\ntest3:3307<\/pre>\n<\/div>\n<p>17. \u6253\u5370\u51fa\u96c6\u7fa4\u4e2d\u53ef\u4ee5\u4f5c\u4e3apt-online-schema-change\u53ef\u4ee5\u64cd\u4f5c\u7684\u5065\u5eb7\u7684\u526f\u672c\u5217\u8868\uff1awhich-cluster-osc-running-replicas<\/p>\n<div>\n<pre># orchestrator-client -c which-cluster-osc-running-replicas -i test\ntest1:3307\ntest3:3307\n# orchestrator-client -c which-cluster-osc-running-replicas -i test1:3307\ntest1:3307\ntest3:3307<\/pre>\n<\/div>\n<p>18. \u6253\u5370\u51fa\u6240\u6709\u5728\u7ef4\u62a4\uff08downtimed\uff09\u7684\u5b9e\u4f8b\uff1adowntimed<\/p>\n<div>\n<pre># orchestrator-client -c downtimed\ntest1:3307\ntest3:3307<\/pre>\n<\/div>\n<p>19. \u6253\u5370\u51fa\u8fdb\u7fa4\u4e2d\u4e3b\u7684\u6570\u636e\u4e2d\u5fc3\uff1adominant-dc<\/p>\n<div>\n<pre># orchestrator-client -c dominant-dc\nBJ<\/pre>\n<\/div>\n<p>20. \u5c06\u96c6\u7fa4\u7684\u4e3b\u63d0\u4ea4\u5230KV\u5b58\u50a8\u3002submit-masters-to-kv-stores<\/p>\n<div>\n<pre># orchestrator-client -c submit-masters-to-kv-stores\nmysql\/master\/test:test2:3307\nmysql\/master\/test\/hostname:test2\nmysql\/master\/test\/port:3307\nmysql\/master\/test\/ipv4:192.168.163.132\nmysql\/master\/test\/ipv6:<\/pre>\n<\/div>\n<p>21. \u8fc1\u79fb\u4ece\u5e93\u5230\u53e6\u4e00\u4e2a\u5b9e\u4f8b\u4e0a\uff1arelocate<\/p>\n<div>\n<div><\/div>\n<pre># orchestrator-client -c relocate -i test3:3307 -d test1:3307   #\u8fc1\u79fbtest3:3307\u4f5c\u4e3atest1:3307\u7684\u4ece\u5e93\ntest3:3307&lt;test1:3307\n\u67e5\u770b\n# orchestrator-client -c topology -i test2:3307\ntest2:3307     [0s,ok,5.7.25-0ubuntu0.16.04.2-log,rw,ROW,&gt;&gt;,GTID]\n+ test1:3307   [0s,ok,5.7.25-0ubuntu0.16.04.2-log,ro,ROW,&gt;&gt;,GTID]\n  + test3:3307 [0s,ok,5.7.25-log,ro,ROW,&gt;&gt;,GTID]<\/pre>\n<\/div>\n<p>22. \u8fc1\u79fb\u4e00\u4e2a\u5b9e\u4f8b\u7684\u6240\u6709\u4ece\u5e93\u5230\u53e6\u4e00\u4e2a\u5b9e\u4f8b\u4e0a\uff1arelocate-replicas<\/p>\n<div>\n<pre># orchestrator-client -c relocate-replicas -i test1:3307 -d test2:3307   #\u8fc1\u79fbtest1:3307\u4e0b\u7684\u6240\u6709\u4ece\u5e93\u5230test2:3307\u4e0b\uff0c\u5e76\u5217\u51fa\u88ab\u8fc1\u79fb\u7684\u4ece\u5e93\u7684\u5b9e\u4f8b\u540d\ntest3:3307<\/pre>\n<\/div>\n<p>23.\u00a0\u5c06slave\u5728\u62d3\u6251\u4e0a\u5411\u4e0a\u79fb\u52a8\u4e00\u7ea7\uff0c\u5bf9\u5e94web\u4e0a\u7684\u662f\u5728Classic Model\u4e0b\u8fdb\u884c\u62d6\u52a8\uff1amove-up<\/p>\n<div>\n<pre># orchestrator-client -c move-up -i test3:3307 -d test2:3307\ntest3:3307&lt;test2:3307<\/pre>\n<\/div>\n<p>\u7ed3\u6784\u4ece\u00a0test2:3307 -&gt; test1:3307 -&gt; test3:3307 \u53d8\u6210 test2:3307 -&gt; test1:3307<br \/>\n-&gt; test3:3307<br \/>\n24.\u00a0\u5c06slave\u5728\u62d3\u6251\u4e0a\u5411\u4e0b\u79fb\u52a8\u4e00\u7ea7\uff08\u79fb\u5230\u540c\u7ea7\u7684\u4e0b\u9762\uff09\uff0c\u5bf9\u5e94web\u4e0a\u7684\u662f\u5728Classic Model\u4e0b\u8fdb\u884c\u62d6\u52a8\uff1amove-below<\/p>\n<div>\n<pre># orchestrator-client -c move-below -i test3:3307 -d test1:3307\ntest3:3307&lt;test1:3307<\/pre>\n<\/div>\n<p>\u7ed3\u6784\u4ece test2:3307 -&gt; test1:3307\u00a0 \u53d8\u6210\u00a0\u00a0test2:3307 -&gt; test1:3307 -&gt; test3:3307<br \/>\n-&gt; test3:3307<br \/>\n25.\u00a0\u5c06\u7ed9\u5b9a\u5b9e\u4f8b\u7684\u6240\u6709\u4ece\u5e93\u5728\u62d3\u6251\u4e0a\u5411\u4e0a\u79fb\u52a8\u4e00\u7ea7\uff0c\u57fa\u4e8eClassic Model\u6a21\u5f0f\uff1amove-up-replicas<\/p>\n<div>\n<pre># orchestrator-client -c move-up-replicas -i test1:3307<\/pre>\n<pre> test3:3307<\/pre>\n<\/div>\n<p>\u7ed3\u6784\u4ece\u00a0test2:3307 -&gt; test1:3307 -&gt; test3:3307 \u53d8\u6210 test2:3307 -&gt; test1:3307<br \/>\n-&gt; test3:3307<br \/>\n26. \u521b\u5efa\u4e3b\u4e3b\u590d\u5236\uff0c\u5c06\u7ed9\u5b9a\u5b9e\u4f8b\u76f4\u63a5\u548c\u5f53\u524d\u4e3b\u5e93\u505a\u6210\u4e3b\u4e3b\u590d\u5236\uff1amake-co-master<\/p>\n<div>\n<pre># orchestrator-client -c make-co-master -i test1:3307\ntest1:3307&lt;test2:3307<\/pre>\n<\/div>\n<p>27.\u5c06\u5b9e\u4f8b\u8f6c\u6362\u4e3a\u81ea\u5df1\u4e3b\u4eba\u7684\u4e3b\u4eba\uff0c\u5207\u6362\u4e24\u4e2a\uff1atake-master<\/p>\n<div>\n<pre># orchestrator-client -c take-master -i test3:3307\ntest3:3307&lt;test2:3307<\/pre>\n<\/div>\n<p>\u7ed3\u6784\u4ece\u00a0test2:3307 -&gt; test1:3307 -&gt; test3:3307 \u53d8\u6210\u00a0test2:3307 -&gt; test3:3307 -&gt; test1:3307<br \/>\n28. \u901a\u8fc7GTID\u79fb\u52a8\u526f\u672c\uff0cmove-gtid\uff1a<br \/>\n\u901a\u8fc7<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/622e979722bf433232ae267727933ba055cdbfed\/docs\/orchestrator-client.md#orchestrator-client\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">orchestrator-client<\/a>\u6267\u884c\u62a5\u9519\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c move-gtid -i test3:3307 -d test1:3307\nparse error: Invalid numeric literal at line 1, column 9\nparse error: Invalid numeric literal at line 1, column 9\nparse error: Invalid numeric literal at line 1, column 9<\/pre>\n<\/div>\n<p>\u901a\u8fc7orchestrator\u6267\u884c\u662f\u6ca1\u95ee\u9898\uff0c\u9700\u8981\u6dfb\u52a0&#8211;ignore-raft-setup\u53c2\u6570\uff1a<\/p>\n<div>\n<pre># orchestrator -c move-gtid -i test3:3307 -d test2:3307 --ignore-raft-setup\ntest3:3307&lt;test2:3307<\/pre>\n<\/div>\n<p>29.\u901a\u8fc7GTID\u79fb\u52a8\u6307\u5b9a\u5b9e\u4f8b\u4e0b\u7684\u6240\u6709slaves\u5230\u53e6\u4e00\u4e2a\u5b9e\u4f8b\uff0cmove-replicas-gtid<br \/>\n\u901a\u8fc7<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/622e979722bf433232ae267727933ba055cdbfed\/docs\/orchestrator-client.md#orchestrator-client\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">orchestrator-client<\/a>\u6267\u884c\u62a5\u9519\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c move-replicas-gtid -i test3:3307 -d test1:3307\njq: error (at &lt;stdin&gt;:1): Cannot index string with string \\\"Key\\\"<\/pre>\n<\/div>\n<p>\u901a\u8fc7orchestrator\u6267\u884c\u662f\u6ca1\u95ee\u9898\uff0c\u9700\u8981\u6dfb\u52a0&#8211;ignore-raft-setup\u53c2\u6570\uff1a<\/p>\n<div>\n<pre># .\/orchestrator -c move-replicas-gtid -i test2:3307 -d test1:3307 --ignore-raft-setup\ntest3:3307<\/pre>\n<\/div>\n<p>30. \u5c06\u7ed9\u5b9a\u5b9e\u4f8b\u7684\u540c\u7ea7slave\uff0c\u53d8\u66f4\u6210\u4ed6\u7684slave\uff0ctake-siblings<\/p>\n<div>\n<pre># orchestrator-client -c take-siblings -i test3:3307\ntest3:3307&lt;test1:3307<\/pre>\n<\/div>\n<p>\u7ed3\u6784\u4ece test1:3307 -&gt; test2:3307\u00a0 \u53d8\u6210\u00a0\u00a0test1:3307 -&gt; test3:3307 -&gt; test2:3307<br \/>\n-&gt; test3:3307<br \/>\n31. \u7ed9\u6307\u5b9a\u5b9e\u4f8b\u6253\u4e0a\u6807\u7b7e\uff0ctag<\/p>\n<div>\n<pre># orchestrator-client -c tag -i test1:3307 --tag \\'name=AAA\\'\ntest1:3307<\/pre>\n<\/div>\n<p>32. \u5217\u51fa\u6307\u5b9a\u5b9e\u4f8b\u7684\u6807\u7b7e\uff0ctags\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c tags -i test1:3307\nname=AAA<\/pre>\n<\/div>\n<p>33. \u5217\u51fa\u7ed9\u5b9a\u5b9e\u4f8b\u7684\u6807\u7b7e\u503c\uff1atag-value<\/p>\n<div>\n<pre># orchestrator-client -c tag-value -i test1:3307 --tag \\\"name\\\"\nAAA<\/pre>\n<\/div>\n<p>34. \u79fb\u9664\u6307\u5b9a\u5b9e\u4f8b\u4e0a\u7684\u6807\u7b7e\uff1auntag<\/p>\n<div>\n<pre># orchestrator-client -c untag -i test1:3307 --tag \\\"name=AAA\\\"\ntest1:3307<\/pre>\n<\/div>\n<p>35. \u5217\u51fa\u6253\u8fc7\u67d0\u4e2a\u6807\u7b7e\u7684\u5b9e\u4f8b\uff0ctagged\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c tagged -t name\ntest3:3307\ntest1:3307\ntest2:3307<\/pre>\n<\/div>\n<p>36. \u6807\u8bb0\u6307\u5b9a\u5b9e\u4f8b\u8fdb\u5165\u505c\u7528\u6a21\u5f0f\uff0c\u5305\u62ec\u65f6\u95f4\u3001\u64cd\u4f5c\u4eba\u3001\u548c\u539f\u56e0\uff0cbegin-downtime\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c begin-downtime -i test1:3307 -duration=10m -owner=zjy -reason \\'test\\'\ntest1:3307<\/pre>\n<\/div>\n<p>37. \u79fb\u9664\u6307\u5b9a\u5b9e\u4f8b\u7684\u505c\u7528\u6a21\u5f0f\uff0cend&#8211;downtime\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c end-downtime -i test1:3307\ntest1:3307<\/pre>\n<\/div>\n<p>38. \u8bf7\u6c42\u6307\u5b9a\u5b9e\u4f8b\u4e0a\u7684\u7ef4\u62a4\u9501\uff1a\u62d3\u6251\u66f4\u6539\u9700\u8981\u5c06\u9501\u653e\u5728\u6700\u5c0f\u53d7\u5f71\u54cd\u7684\u5b9e\u4f8b\u4e0a\uff0c\u4ee5\u907f\u514d\u5728\u540c\u4e00\u4e2a\u5b9e\u4f8b\u4e0a\u53d1\u751f\u4e24\u4e2a\u4e0d\u534f\u8c03\u7684\u64cd\u4f5c\uff0cbegin-maintenance \uff1a<\/p>\n<div>\n<pre># orchestrator-client -c begin-maintenance -i test1:3307 --reason \\\"XXX\\\"\ntest1:3307<\/pre>\n<\/div>\n<p>\u9501\u9ed8\u8ba410\u5206\u949f\u540e\u8fc7\u671f\uff0c\u6709\u53c2\u6570MaintenanceExpireMinutes\u3002<br \/>\n39. \u79fb\u9664\u6307\u5b9a\u5b9e\u4f8b\u4e0a\u7684\u7ef4\u62a4\u9501\uff1aend-maintenance<\/p>\n<div>\n<pre># orchestrator-client -c end-maintenance -i test1:3307\ntest1:3307<\/pre>\n<\/div>\n<p>40. \u8bbe\u7f6e\u63d0\u5347\u89c4\u5219\uff0c\u6062\u590d\u65f6\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u5b9e\u4f8b\u8fdb\u884c\u63d0\u5347\uff1aregister-candidate\uff1a\u9700\u8981\u548cpromotion-rule\u4e00\u8d77\u4f7f\u7528<\/p>\n<div>\n<pre># orchestrator-client -c register-candidate -i test3:3307 --promotion-rule prefer\ntest3:3307<\/pre>\n<\/div>\n<p>\u63d0\u5347test3:3307\u7684\u6743\u91cd\uff0c\u5982\u679c\u8fdb\u884cFailover\uff0c\u4f1a\u6210\u4e3aMaster\u3002<br \/>\n41. \u6307\u5b9a\u5b9e\u4f8b\u6267\u884c\u505c\u6b62\u590d\u5236\uff1a<br \/>\n\u666e\u901a\u7684\uff1astop slave\uff1astop-replica<\/p>\n<div>\n<pre># orchestrator-client -c stop-replica -i test2:3307\ntest2:3307<\/pre>\n<\/div>\n<p>\u5e94\u7528\u5b8crelay log\uff0c\u5728stop slave\uff1astop-replica-nice<\/p>\n<div>\n<pre># orchestrator-client -c stop-replica-nice -i test2:3307\ntest2:3307<\/pre>\n<\/div>\n<p>42.\u6307\u5b9a\u5b9e\u4f8b\u6267\u884c\u5f00\u542f\u590d\u5236\uff1a\u00a0start-replica<\/p>\n<div>\n<pre># orchestrator-client -c start-replica -i test2:3307\ntest2:3307<\/pre>\n<\/div>\n<p>43. \u6307\u5b9a\u5b9e\u4f8b\u6267\u884c\u590d\u5236\u91cd\u542f\uff1arestart-replica<\/p>\n<div>\n<pre># orchestrator-client -c restart-replica -i test2:3307\ntest2:3307<\/pre>\n<\/div>\n<p>44.\u6307\u5b9a\u5b9e\u4f8b\u6267\u884c\u590d\u5236\u91cd\u7f6e\uff1areset-replica<\/p>\n<div>\n<pre># orchestrator-client -c reset-replica -i test2:3307\ntest2:3307<\/pre>\n<\/div>\n<p>45.\u5206\u79bb\u526f\u672c\uff1a\u975eGTID\u4fee\u6539binlog position\uff0cdetach-replica \uff1a<\/p>\n<div>\n<pre># orchestrator-client -c detach-replica -i test2:3307<\/pre>\n<\/div>\n<p>46.\u6062\u590d\u526f\u672c\uff1areattach-replica<\/p>\n<div>\n<pre># orchestrator-client -c reattach-replica  -i test2:3307<\/pre>\n<\/div>\n<p>47.\u5206\u79bb\u526f\u672c\uff1a\u6ce8\u91camaster_host\u6765\u5206\u79bb\uff0cdetach-replica-master-host \uff1a\u5982Master_Host: \/\/test1<\/p>\n<div>\n<pre># orchestrator-client -c detach-replica-master-host -i test2:3307\ntest2:3307<\/pre>\n<\/div>\n<p>48. \u6062\u590d\u526f\u672c\uff1areattach-replica-master-host<\/p>\n<div>\n<pre># orchestrator-client -c reattach-replica-master-host -i test2:3307\ntest2:3307<\/pre>\n<\/div>\n<p>49. \u8df3\u8fc7SQL\u7ebf\u7a0b\u7684Query\uff0c\u5982\u4e3b\u952e\u51b2\u7a81\uff0c\u652f\u6301\u5728GTID\u548c\u975eGTID\u4e0b\uff1askip-query<\/p>\n<div>\n<pre># orchestrator-client -c skip-query -i test2:3307\ntest2:3307<\/pre>\n<\/div>\n<p>50. \u5c06\u9519\u8bef\u7684GTID\u4e8b\u52a1\u5f53\u505a\u7a7a\u4e8b\u52a1\u5e94\u7528\u526f\u672c\u7684\u4e3b\u4e0a\uff1agtid-errant-inject-empty\u300cweb\u4e0a\u7684fix\u300d<\/p>\n<div>\n<pre># orchestrator-client -c gtid-errant-inject-empty  -i test2:3307\ntest2:3307<\/pre>\n<\/div>\n<p>51.\u00a0\u00a0\u901a\u8fc7RESET MASTER\u5220\u9664\u9519\u8bef\u7684GTID\u4e8b\u52a1\uff1agtid-errant-reset-master<\/p>\n<div>\n<pre># orchestrator-client -c gtid-errant-reset-master  -i test2:3307\ntest2:3307<\/pre>\n<\/div>\n<p>52. \u8bbe\u7f6e\u534a\u540c\u6b65\u76f8\u5173\u7684\u53c2\u6570:<\/p>\n<div>\n<pre>orchestrator-client -c $variable -i test1:3307<\/pre>\n<pre>    enable-semi-sync-master      \u4e3b\u4e0a\u6267\u884c\u5f00\u542f\u534a\u540c\u6b65\n    disable-semi-sync-master      \u4e3b\u4e0a\u6267\u884c\u5173\u95ed\u534a\u540c\u6b65\n    enable-semi-sync-replica       \u4ece\u4e0a\u6267\u884c\u5f00\u542f\u534a\u540c\u6b65\n    disable-semi-sync-replica      \u4ece\u4e0a\u6267\u884c\u5173\u95ed\u534a\u540c\u6b65<\/pre>\n<\/div>\n<p>53. \u6267\u884c\u9700\u8981stop\/start slave\u914d\u5408\u7684SQL\uff1arestart-replica-statements<\/p>\n<div>\n<pre># orchestrator-client -c restart-replica-statements -i test3:3307 -query \\\"change master to auto_position=1\\\" | jq .[] -r\nstop slave io_thread;\nstop slave sql_thread;\nchange master to auto_position=1;\nstart slave sql_thread;\nstart slave io_thread;\n# orchestrator-client -c restart-replica-statements -i test3:3307 -query \\\"change master to master_auto_position=1\\\" | jq .[] -r  |  mysql -urep -p -htest3 -P3307\nEnter password:<\/pre>\n<div><\/div>\n<\/div>\n<p>54.\u6839\u636e\u590d\u5236\u89c4\u5219\u68c0\u67e5\u5b9e\u4f8b\u662f\u5426\u53ef\u4ee5\u4ece\u53e6\u4e00\u4e2a\u5b9e\u4f8b\u590d\u5236(GTID\u548c\u975eGTID\uff09\uff1a<br \/>\n\u975eGTID\uff0ccan-replicate-from\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c can-replicate-from -i test3:3307 -d test1:3307\ntest1:3307<\/pre>\n<\/div>\n<p>GTID\uff1acan-replicate-from-gtid<\/p>\n<div>\n<pre># orchestrator-client -c can-replicate-from-gtid -i test3:3307 -d test1:3307\ntest1:3307<\/pre>\n<\/div>\n<p>55. \u68c0\u67e5\u6307\u5b9a\u5b9e\u4f8b\u662f\u5426\u5728\u590d\u5236\uff1ais-replicating<\/p>\n<div>\n<pre>#\u6709\u8fd4\u56de\u5728\u590d\u5236\n# orchestrator-client -c is-replicating -i test2:3307\ntest2:3307\n#\u6ca1\u6709\u8fd4\u56de\uff0c\u4e0d\u5728\u590d\u5236\n# orchestrator-client -c is-replicating -i test1:3307<\/pre>\n<\/div>\n<p>56.\u68c0\u67e5\u6307\u5b9a\u5b9e\u4f8b\u7684IO\u548cSQL\u9650\u5236\u662f\u5426\u90fd\u505c\u6b62\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c is-replicating -i test2:3307<\/pre>\n<\/div>\n<p>57.\u5c06\u6307\u5b9a\u5b9e\u4f8b\u8bbe\u7f6e\u4e3a\u53ea\u8bfb\uff0c\u901a\u8fc7SET GLOBAL read_only=1\uff0cset-read-only\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c set-read-only -i test2:3307\ntest2:3307<\/pre>\n<\/div>\n<p>58.\u5c06\u6307\u5b9a\u5b9e\u4f8b\u8bbe\u7f6e\u4e3a\u8bfb\u5199\uff0c\u901a\u8fc7SET GLOBAL read_only=0\uff0cset-writeable<\/p>\n<div>\n<pre># orchestrator-client -c set-writeable -i test2:3307\ntest2:3307<\/pre>\n<\/div>\n<p>59. \u8f6e\u8be2\u6307\u5b9a\u5b9e\u4f8b\u7684binary log\uff0cflush-binary-logs<\/p>\n<div>\n<pre># orchestrator-client -c flush-binary-logs -i test1:3307\ntest1:3307<\/pre>\n<\/div>\n<p>60. \u624b\u52a8\u6267\u884c\u6062\u590d\uff0c\u6307\u5b9a\u4e00\u4e2a\u6b7b\u673a\u7684\u5b9e\u4f8b\uff0crecover\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c recover -i test2:3307\ntest3:3307<\/pre>\n<\/div>\n<p>\u6d4b\u8bd5\u4e0b\u6765\uff0c\u8be5\u53c2\u6570\u4f1a\u8ba9\u5904\u7406\u505c\u673a\u6216\u5219\u7ef4\u62a4\u72b6\u6001\u4e0b\u7684\u5b9e\u4f8b\u8fdb\u884c\u5f3a\u5236\u6062\u590d\u3002\u7ed3\u6784\uff1a<br \/>\ntest1:3307 -&gt; test2:3307 -&gt; test3:3307(downtimed)\u00a0 \u5f53test2:3307\u6b7b\u6389\u4e4b\u540e\uff0c\u6b64\u65f6test3:3307\u5904\u4e8e\u505c\u673a\u72b6\u6001\uff0c\u4e0d\u4f1a\u8fdb\u884cFailover\uff0c\u6267\u884c\u540e\u53d8\u6210<br \/>\ntest1:3307 -&gt; test2:3307<br \/>\n-&gt; test3:3307<br \/>\n61. \u4f18\u96c5\u7684\u8fdb\u884c\u4e3b\u548c\u6307\u5b9a\u4ece\u5207\u6362\uff0cgraceful-master-takeover\uff1a<\/p>\n<div>\n<pre># orchestrator-client -c graceful-master-takeover -a test1:3307 -d test2:3307\ntest2:3307<\/pre>\n<\/div>\n<p>\u7ed3\u6784\u4ecetest1:3307 -&gt; test2:3307 \u53d8\u6210 test2:3307 -&gt; test1:3307\u3002\u65b0\u4e3b\u6307\u5b9a\u53d8\u6210\u8bfb\u5199\uff0c\u65b0\u4ece\u53d8\u6210\u53ea\u8bfb\uff0c\u8fd8\u9700\u8981\u624b\u52a8start slave\u3002<br \/>\n\u6ce8\u610f\u9700\u8981\u914d\u7f6e\uff1a\u9700\u8981\u4ece\u5143\u8868\u91cc\u627e\u5230\u590d\u5236\u7684\u8d26\u53f7\u548c\u5bc6\u7801\u3002<\/p>\n<div>\n<pre>\\\"ReplicationCredentialsQuery\\\":\\\"SELECT repl_user, repl_pass from meta.cluster where anchor=1\\\"<\/pre>\n<\/div>\n<p>62. \u624b\u52a8\u5f3a\u5236\u6267\u884c\u6062\u590d\uff0c\u5373\u4f7forch\u6ca1\u6709\u53d1\u73b0\u95ee\u9898\uff0cforce-master-failover\uff1a\u8f6c\u79fb\u4e4b\u540e\u8001\u4e3b\u72ec\u7acb\uff0c\u9700\u8981\u624b\u52a8\u52a0\u5165\u5230\u96c6\u7fa4\u3002<\/p>\n<div>\n<pre># orchestrator-client -c force-master-failover -i test1:3307\ntest3:3307<\/pre>\n<\/div>\n<p>63.\u5f3a\u884c\u4e22\u5f03master\u5e76\u6307\u5b9a\u7684\u4e00\u4e2a\u5b9e\u4f8b\uff0cforce-master-takeover\uff1a\u8001\u4e3b(test1)\u72ec\u7acb\uff0c\u6307\u5b9a\u4ece(test2)\u63d0\u5347\u4e3amaster<\/p>\n<div>\n<pre># orchestrator-client -c force-master-takeover -i test1:3307 -d test2:3307\ntest2:3307<\/pre>\n<\/div>\n<p>64. \u786e\u8ba4\u96c6\u7fa4\u6062\u590d\u7406\u7531\uff0c\u5728web\u4e0a\u7684Audit-&gt;Recovery-&gt;Acknowledged \u6309\u94ae\u786e\u8ba4\uff0c\/ack-all-recoveries<br \/>\n\u786e\u8ba4\u6307\u5b9a\u96c6\u7fa4\uff1aack-cluster-recoveries<\/p>\n<div>\n<pre># orchestrator-client -c ack-cluster-recoveries  -i test2:3307 -reason=\\'\\'\ntest1:3307<\/pre>\n<\/div>\n<p>\u786e\u8ba4\u6240\u6709\u96c6\u7fa4\uff1aack-all-recoveries<\/p>\n<div>\n<pre># orchestrator-client -c ack-all-recoveries  -reason=\\'OOOPPP\\'\neason=XYZ<\/pre>\n<\/div>\n<p>65.\u68c0\u67e5\u3001\u7981\u6b62\u3001\u5f00\u542forchestrator\u6267\u884c\u5168\u5c40\u6062\u590d\uff1a<br \/>\n\u68c0\u67e5\uff1acheck-global-recoveries<\/p>\n<div>\n<pre># orchestrator-client -c check-global-recoveries\nenabled<\/pre>\n<\/div>\n<p>\u7981\u6b62\uff1adisable-global-recoveries<\/p>\n<div>\n<pre># orchestrator-client -c disable-global-recoveries\ndisabled<\/pre>\n<\/div>\n<p>\u5f00\u542f\uff1aenable&#8211;global-recoveries<\/p>\n<div>\n<pre># orchestrator-client -c enable-global-recoveries\nenabled<\/pre>\n<\/div>\n<p>66. \u68c0\u67e5\u5206\u6790\u590d\u5236\u62d3\u6251\u4e2d\u5b58\u5728\u7684\u95ee\u9898\uff1areplication-analysis<\/p>\n<div>\n<pre># orchestrator-client -c replication-analysis\ntest1:3307 (cluster test1:3307): ErrantGTIDStructureWarning<\/pre>\n<\/div>\n<p>67. raft\u68c0\u6d4b\uff1aleader\u67e5\u770b\u3001\u5065\u5eb7\u76d1\u6d4b\u3001\u8fc1\u79fbleader\uff1a<\/p>\n<div>\n<pre>\u67e5\u770bleader\u8282\u70b9\n# orchestrator-client -c raft-leader\n192.168.163.131:10008\n\u5065\u5eb7\u76d1\u6d4b\n# orchestrator-client -c raft-health\nhealthy\nleader \u4e3b\u673a\u540d\n# orchestrator-client -c  raft-leader-hostname\ntest1\n\u6307\u5b9a\u4e3b\u673a\u9009\u4e3eleader\n# orchestrator-client -c raft-elect-leader -hostname test3\ntest3<\/pre>\n<div><\/div>\n<\/div>\n<p>68.\u4f2aGTID\u76f8\u5173\u53c2\u6570\uff1a<\/p>\n<div>\n<pre>match      #\u4f7f\u7528Pseudo-GTID\u6307\u5b9a\u4e00\u4e2a\u4ece\u5339\u914d\u5230\u6307\u5b9a\u7684\u53e6\u4e00\u4e2a\uff08\u76ee\u6807\uff09\u5b9e\u4f8b\u4e0b\nmatch-up #Transport the replica one level up the hierarchy, making it child of its grandparent, using Pseudo-GTID\nmatch-up-replicas  #Matches replicas of the given instance one level up the topology, making them siblings of given instance, using Pseudo-GTID\nlast-pseudo-gtid #Dump last injected Pseudo-GTID entry on a server<\/pre>\n<\/div>\n<p>\u5230\u6b64\u5173\u4e8e<a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\u7684\u4f7f\u7528\u4ee5\u53ca\u547d\u4ee4\u884c\u8bf4\u660e\u5df2\u7ecf\u4ecb\u7ecd\u5b8c\u6bd5\uff0cWeb API\u53ef\u4ee5\u5728<a href=\\\"https:\/\/github.com\/github\/orchestrator\/blob\/master\/docs\/topology-recovery.md#web-api-command-line\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator\u00a0API<\/a>\u67e5\u770b\uff0c\u901a\u8fc7\u547d\u4ee4\u884c\u548cAPI\u4e0a\u7684\u64cd\u4f5c\u53ef\u4ee5\u66f4\u597d\u7684\u8fdb\u884c\u81ea\u52a8\u5316\u5f00\u53d1\u3002<\/p>\n<h2>\u603b\u7ed3\uff1a<\/h2>\n<p><a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\u662f\u4e00\u6b3e\u5f00\u6e90(go\u7f16\u5199)\u7684MySQL\u590d\u5236\u62d3\u6251\u7ba1\u7406\u5de5\u5177\uff0c\u652f\u6301MySQL\u4e3b\u4ece\u590d\u5236\u62d3\u6251\u5173\u7cfb\u7684\u8c03\u6574\u3001\u4e3b\u5e93\u6545\u969c\u81ea\u52a8\u5207\u6362\u3001\u624b\u52a8\u4e3b\u4ece\u5207\u6362\u7b49\u529f\u80fd\u3002\u63d0\u4f9bWeb\u754c\u9762\u5c55\u793aMySQL\u96c6\u7fa4\u7684\u62d3\u6251\u5173\u7cfb\u53ca\u72b6\u6001\uff0c\u53ef\u4ee5\u66f4\u6539MySQL\u5b9e\u4f8b\u7684\u90e8\u5206\u914d\u7f6e\u4fe1\u606f\uff0c\u4e5f\u63d0\u4f9b\u547d\u4ee4\u884c\u548capi\u63a5\u53e3\u3002\u76f8\u5bf9\u6bd4MHA\uff0c<a href=\\\"https:\/\/github.com\/github\/orchestrator\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">Orchestrator<\/a>\u81ea\u8eab\u53ef\u4ee5\u90e8\u7f72\u591a\u4e2a\u8282\u70b9\uff0c\u901a\u8fc7raft\u5206\u5e03\u5f0f\u4e00\u81f4\u6027\u534f\u8bae\u6765\u4fdd\u8bc1\u81ea\u8eab\u7684\u9ad8\u53ef\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6d4b\u8bd5\u8bf4\u660e \u73af\u5883\u4ecb\u7ecd \u670d\u52a1\u5668\u73af\u5883\uff1a \u4e09\u53f0\u670d\u52a1\u5668 1\uff1aMySQL\u5b9e\u4f8b\uff083306\u662forch\u7684\u540e\u7aef\u6570\u636e\u5e93\uff0c3307\u662fM &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/www.weijing.co\/?p=1843\"> <span class=\"screen-reader-text\">MySQL\u9ad8\u53ef\u7528\u590d\u5236\u7ba1\u7406\u5de5\u5177 \u2014\u2014 Orchestrator\u4f7f\u7528<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[90,88],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"mailpoet_newsletter_max":false,"woocommerce_thumbnail":false,"woocommerce_single":false,"woocommerce_gallery_thumbnail":false,"shop_catalog":false,"shop_single":false,"shop_thumbnail":false},"uagb_author_info":{"display_name":"weijing","author_link":"http:\/\/www.weijing.co\/?author=4"},"uagb_comment_info":0,"uagb_excerpt":"\u6d4b\u8bd5\u8bf4\u660e \u73af\u5883\u4ecb\u7ecd \u670d\u52a1\u5668\u73af\u5883\uff1a \u4e09\u53f0\u670d\u52a1\u5668 1\uff1aMySQL\u5b9e\u4f8b\uff083306\u662forch\u7684\u540e\u7aef\u6570\u636e\u5e93\uff0c3307\u662fM&hellip;","_links":{"self":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/1843"}],"collection":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1843"}],"version-history":[{"count":0,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/1843\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1843"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}