{"id":1806,"date":"2020-07-01T05:36:27","date_gmt":"2020-06-30T21:36:27","guid":{"rendered":"http:\/\/39.97.231.10\/?p=1806"},"modified":"2020-07-01T05:36:27","modified_gmt":"2020-06-30T21:36:27","slug":"mysql%e5%a4%8d%e5%88%b6%e6%8b%93%e6%89%91%e7%ae%a1%e7%90%86%e5%b7%a5%e5%85%b7orchestrator","status":"publish","type":"post","link":"http:\/\/www.weijing.co\/?p=1806","title":{"rendered":"MySQL\u590d\u5236\u62d3\u6251\u7ba1\u7406\u5de5\u5177Orchestrator"},"content":{"rendered":"<div>\n<div>\n<h2>1. \u7b80\u4ecb<\/h2>\n<p>Orchestrator\u662f\u4e00\u6b3e\u5f00\u6e90\u7684MySQL\u590d\u5236\u62d3\u6251\u7ba1\u7406\u5de5\u5177\uff0c\u91c7\u7528go\u8bed\u8a00\u7f16\u5199\uff0c\u652f\u6301MySQL\u4e3b\u4ece\u590d\u5236\u62d3\u6251\u5173\u7cfb\u7684\u8c03\u6574\u3001\u652f\u6301MySQL\u4e3b\u5e93\u6545\u969c\u81ea\u52a8\u5207\u6362\u3001\u624b\u52a8\u4e3b\u4ece\u5207\u6362\u7b49\u529f\u80fd\u3002<br \/>\nOrchestrator\u540e\u53f0\u4f9d\u8d56\u4e8eMySQL\u6216\u8005SQLite\u5b58\u50a8\u5143\u6570\u636e\uff0c\u80fd\u591f\u63d0\u4f9bWeb\u754c\u9762\u5c55\u793aMySQL\u96c6\u7fa4\u7684\u62d3\u6251\u5173\u7cfb\u53ca\u5b9e\u4f8b\u72b6\u6001\uff0c\u901a\u8fc7Web\u754c\u9762\u53ef\u66f4\u6539MySQL\u5b9e\u4f8b\u7684\u90e8\u5206\u914d\u7f6e\u4fe1\u606f\uff0c\u540c\u65f6\u4e5f\u63d0\u4f9b\u547d\u4ee4\u884c\u548capi\u63a5\u53e3\uff0c\u4ee5\u4fbf\u66f4\u52a0\u7075\u6d3b\u7684\u81ea\u52a8\u5316\u8fd0\u7ef4\u7ba1\u7406\u3002<br \/>\n\u76f8\u6bd4\u4e8eMHA\uff0cOrchestrator\u66f4\u52a0\u504f\u91cd\u4e8e\u590d\u5236\u62d3\u6251\u5173\u7cfb\u7684\u7ba1\u7406\uff0c\u80fd\u591f\u5b9e\u73b0MySQL\u4efb\u4e00\u590d\u5236\u62d3\u6251\u5173\u7cfb\u7684\u8c03\u6574\uff0c\u5e76\u5728\u6b64\u57fa\u7840\u4e0a\uff0c\u5b9e\u73b0MySQL\u9ad8\u53ef\u7528\uff0c\u53e6\u5916Orchestrator\u81ea\u8eab\u53ef\u4ee5\u90e8\u7f72\u591a\u4e2a\u8282\u70b9\uff0c\u901a\u8fc7raft\u5206\u5e03\u5f0f\u4e00\u81f4\u6027\u534f\u8bae\uff0c\u4fdd\u8bc1\u81ea\u8eab\u7684\u9ad8\u53ef\u7528\u3002<\/p>\n<h2>2. \u6e90\u7801\u7f16\u8bd1<\/h2>\n<p>\u6e90\u7801\u5730\u5740\uff1a<a href=\\\"https:\/\/github.com\/github\/orchestrator.git\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer\\\">https:\/\/github.com\/github\/orchestrator.git<\/a><br \/>\n\u76ee\u524d\u6700\u65b0\u7248\uff1av3.0.11<br \/>\n\u7f16\u8bd1\uff08\u9700\u8981\u8054\u7f51\uff09\uff1a<br \/>\ngit clone <a href=\\\"https:\/\/github.com\/github\/orchestrator.git\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer\\\">https:\/\/github.com\/github\/orchestrator.git<\/a><br \/>\ncd orchestrator<br \/>\nscript\/build<br \/>\n\u7f16\u8bd1\u5b8c\u6210\u540e\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\uff1a .\/bin\/orchestrator<\/p>\n<h2>3. \u73af\u5883\u642d\u5efa<\/h2>\n<h3>3.1 \u914d\u7f6e\u6587\u4ef6<\/h3>\n<p>\u5728\u6e90\u7801\u7684orchestrator\/conf\u76ee\u5f55\u4e2d\u67093\u4e2a\u914d\u7f6e\u6587\u4ef6\u6a21\u677f\uff0c\u53ef\u53c2\u8003\u4f7f\u7528\u3002<\/p>\n<ul>\n<li>orchestrator-sample.conf.json<\/li>\n<li>orchestrator-sample-sqlite.conf.json<\/li>\n<li>orchestrator-simple.conf.json<\/li>\n<\/ul>\n<p>\u8fd9\u91cc\u5217\u51fa\u4e00\u4e2a\u7b80\u5316\u7684\u53c2\u6570\u914d\u7f6eorchestrator.conf.json<\/p>\n<div>\n<pre>{\n    \\\"Debug\\\": true,\n    \\\"ListenAddress\\\": \\\":3000\\\",                       #http\u5f00\u653e\u7aef\u53e3\n    \\\"MySQLTopologyUser\\\": \\\"admin\\\",                   #mysql\u7ba1\u7406\u8d26\u53f7\uff0c\u6240\u6709\u88ab\u7ba1\u7406\u7684MySQL\u96c6\u7fa4\u90fd\u9700\u8981\u6709\u8be5\u8d26\u53f7\n    \\\"MySQLTopologyPassword\\\": \\\"123456\\\",              #mysql\u7ba1\u7406\u8d26\u53f7\u5bc6\u7801\n    \\\"MySQLOrchestratorHost\\\": \\\"127.0.0.1\\\",            #\u540e\u53f0mysql\u6570\u636e\u5e93\u5730\u5740\uff0corchestrator\u4f9d\u8d56MySQL\u6216\u8005SQLite\u5b58\u50a8\u7ba1\u7406\u6570\u636e\n    \\\"MySQLOrchestratorPort\\\": 3306,                   #\u540e\u53f0mysql\u6570\u636e\u5e93\u7aef\u53e3\n    \\\"MySQLOrchestratorDatabase\\\": \\\"orchestrator\\\",     #\u540e\u53f0mysql\u6570\u636e\u5e93\u540d\n    \\\"MySQLOrchestratorUser\\\": \\\"root\\\",                 #\u540e\u53f0mysql\u6570\u636e\u5e93\u8d26\u53f7\n    \\\"MySQLOrchestratorPassword\\\": \\\"123456\\\"            #\u540e\u53f0mysql\u6570\u636e\u5e93\u5bc6\u7801\n    \\\"BackendDB\\\": \\\"sqlite\\\",\n    \\\"SQLite3DataFile\\\": \\\"\/root\/orchestrator\/orchestrator.sqlite3\\\",\n    \\\"RecoverMasterClusterFilters\\\": [\\\"*\\\"],\n    \\\"RecoverIntermediateMasterClusterFilters\\\": [\\\"*\\\"],\n}\n<\/pre>\n<\/div>\n<p>MySQLTopologyUser \u8fd9\u4e2a\u914d\u7f6e\u9879\u4e3a\u88ab\u7ba1\u7406\u7684MySQL\u96c6\u7fa4\u7684admin\u8d26\u53f7\uff0c\u8be5\u8d26\u53f7\u9700\u8981\u6709super,process,reload,select,replicatiopn slave,replicatiopn client \u6743\u9650\u3002<\/p>\n<h3>3.2 \u540e\u53f0\u6570\u636e\u5e93<\/h3>\n<p>orchestrator\u540e\u53f0\u4f9d\u8d56MySQL\u6216\u8005SQLite\u5b58\u50a8\u7ba1\u7406\u6570\u636e\uff0c\u4ee5MySQL\u4e3a\u4f8b\uff0c\u642d\u5efaOrchestrator\u73af\u5883\uff0c\u9700\u8981\u5148\u642d\u5efa\u4e00\u4e2aMySQL\u540e\u53f0\u6570\u636e\u5e93\uff0cMySQL\u5177\u4f53\u642d\u5efa\u8fc7\u7a0b\u4e0d\u518d\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u642d\u5efa\u5b8c\uff0c\u5c06MySQL\u8d26\u53f7\u5bc6\u7801\u7b49\u4fe1\u606f\u5199\u5165\u914d\u7f6e\u6587\u4ef6\uff0c\u5982\u4e0b\uff1a<br \/>\n\\&#8221;MySQLOrchestratorHost\\&#8221;: \\&#8221;127.0.0.1\\&#8221;,<br \/>\n\\&#8221;MySQLOrchestratorPort\\&#8221;: 3306,<br \/>\n\\&#8221;MySQLOrchestratorDatabase\\&#8221;: \\&#8221;orchestrator\\&#8221;,<br \/>\n\\&#8221;MySQLOrchestratorUser\\&#8221;: \\&#8221;root\\&#8221;,<br \/>\n\\&#8221;MySQLOrchestratorPassword\\&#8221;: \\&#8221;123456\\&#8221;,<br \/>\n\u5982\u679c\u89c9\u5f97\u5b89\u88c5MySQL\u592a\u9ebb\u70e6\uff0c\u53ea\u60f3\u5feb\u901f\u4f53\u9a8c\u4e00\u4e0bOrchestrator\uff0c\u5efa\u8bae\u4f7f\u7528SQLite\uff0c\u53ea\u9700\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u5199\u5165\u5982\u4e0b\u914d\u7f6e\uff1a<br \/>\n\\&#8221;BackendDB\\&#8221;: \\&#8221;sqlite\\&#8221;,<br \/>\n\\&#8221;SQLite3DataFile\\&#8221;: \\&#8221;\/root\/orchestrator\/orchestrator.sqlite3\\&#8221;,<\/p>\n<h2>4. \u6267\u884c\u547d\u4ee4<\/h2>\n<p>orchestrator \u901a\u8fc7 -c \u6765\u6267\u884c\u5177\u4f53\u7684\u547d\u4ee4\uff0c\u901a\u8fc7 orchestrator help \u67e5\u770b\u6240\u6709\u547d\u4ee4\u7684\u5e2e\u52a9\u6587\u6863\uff0c orchestrator help relocate \u67e5\u770b\u5177\u4f53\u547d\u4ee4relocate\u7684\u5e2e\u52a9\u6587\u6863\u3002<br \/>\norchestrator \u63d0\u4f9b\u7684\u547d\u4ee4\u5f88\u591a\uff0c\u8fd9\u91cc\u63d0\u4e00\u4e9b\u6bd4\u8f83\u91cd\u8981\u548c\u5e38\u7528\u7684\u547d\u4ee4\uff0c\u6ca1\u6709\u63d0\u5230\u7684\u53ef\u81ea\u884c\u53bb\u6587\u6863\u6216\u8005\u6e90\u7801\u4e2d\u67e5\u770b\u3002<br \/>\n\u6bd4\u5982\u6267\u884c\u4e00\u4e2a\u547d\u4ee4\uff1a<br \/>\n.\/orchestrator &#8211;config=.\/orchestrator.conf.json -c discover -i mysql_host_name<\/p>\n<h3>4.1 MySQL\u5b9e\u4f8b\u7ba1\u7406\u547d\u4ee4<\/h3>\n<p>discover<br \/>\nforget<br \/>\nbegin-maintenance<br \/>\nend-maintenance<br \/>\nin-maintenance<br \/>\nbegin-downtime<br \/>\nend-downtime<br \/>\ndiscover<br \/>\n\u7528\u4e8e\u53d1\u73b0\u5b9e\u4f8b\u4ee5\u53ca\u8be5\u5b9e\u4f8b\u7684\u4e3b\u3001\u4ece\u5e93\u4fe1\u606f\uff0c\u5c06\u83b7\u53d6\u5230\u7684\u4fe1\u606f\u5199\u5165\u540e\u53f0\u6570\u636e\u5e93database_instance\u7b49\u76f8\u5173\u8868<br \/>\norchestrator &#8211;config=.\/orchestrator.conf.json -c discover -i host_name<br \/>\nforget<br \/>\n\u79fb\u9664\u5b9e\u4f8b\u4fe1\u606f\uff0c\u5373\u4ecedatabase_instance\u8868\u4e2d\u5220\u9664\u76f8\u5173\u8bb0\u5f55<br \/>\norchestrator &#8211;config=.\/orchestrator.conf.json -c forget -i host_name<br \/>\nbegin-maintenance<br \/>\n\u6807\u8bb0\u4e00\u4e2a\u5b9e\u4f8b\u8fdb\u5165\u7ef4\u62a4\u6a21\u5f0f\uff0c\u5728database_instance_maintenance\u8868\u4e2d\u63d2\u5165\u8bb0\u5f55<br \/>\norchestrator -c begin-maintenance -i instance.to.lock.com &#8211;duration=3h &#8211;reason=\\&#8221;load testing; do not disturb\\&#8221;<br \/>\nend-maintenance<br \/>\n\u6807\u8bb0\u4e00\u4e2a\u5b9e\u4f8b\u9000\u51fa\u7ef4\u62a4\u6a21\u5f0f\uff0c\u5373\u66f4\u65b0 database_instance_maintenance \u8868\u4e2d\u76f8\u5173\u8bb0\u5f55<br \/>\norchestrator -c end-maintenance -i locked.instance.com<br \/>\nin-maintenance<br \/>\n\u67e5\u8be2\u5b9e\u4f8b\u662f\u5426\u5904\u4e8e\u7ef4\u62a4\u6a21\u5f0f\uff0c\u4ece\u8868database_instance_maintenance\u4e2d\u67e5\u8be2<br \/>\norchestrator -c in-maintenance -i locked.instance.com<br \/>\nbegin-downtime<br \/>\n\u6807\u8bb0\u4e00\u4e2a\u5b9e\u4f8b\u8fdb\u5165\u4e0b\u7ebf\u6a21\u5f0f\uff0c\u5728database_instance_downtime\u8868\u4e2d\u63d2\u5165\u8bb0\u5f55<br \/>\norchestrator -c begin-downtime -i instance.to.downtime.com &#8211;duration=3h &#8211;reason=\\&#8221;dba handling; do not do recovery\\&#8221;<br \/>\nend-downtime<br \/>\n\u6807\u8bb0\u4e00\u4e2a\u5b9e\u4f8b\u9000\u51fa\u4e0b\u7ebf\u6a21\u5f0f\uff0c\u5728database_instance_downtime\u8868\u4e2d\u5220\u9664\u8bb0\u5f55<br \/>\norchestrator -c end-downtime -i downtimed.instance.com<\/p>\n<h3>4.2 MySQL\u5b9e\u4f8b\u4fe1\u606f\u67e5\u8be2\u547d\u4ee4<\/h3>\n<p>find<br \/>\nsearch<br \/>\nclusters<br \/>\nclusters-alias<br \/>\nall-clusters-masters<br \/>\ntopology<br \/>\ntopology-tabulated<br \/>\nall-instances<br \/>\nwhich-instance<br \/>\nwhich-cluster<br \/>\nwhich-cluster-domain<br \/>\nwhich-heuristic-domain-instance<br \/>\nwhich-cluster-master<br \/>\nwhich-cluster-instances<br \/>\nwhich-cluster-osc-replicas<br \/>\nwhich-cluster-gh-ost-replicas<br \/>\nwhich-master<br \/>\nwhich-downtimed-instances<br \/>\nwhich-replicas<br \/>\nwhich-lost-in-recovery<br \/>\ninstance-status<br \/>\nget-cluster-heuristic-lag<br \/>\nfind<br \/>\n\u901a\u8fc7\u6b63\u5219\u8868\u8fbe\u5f0f\u641c\u7d22\u5b9e\u4f8b\u540d<br \/>\norchestrator -c find -pattern \\&#8221;backup.*us-east\\&#8221;<br \/>\nsearch<br \/>\n\u901a\u8fc7\u5173\u952e\u5b57\u5339\u914d\u641c\u7d22\u5b9e\u4f8b\u540d<br \/>\norchestrator -c search -pattern \\&#8221;search string\\&#8221;<br \/>\nclusters<br \/>\n\u8f93\u51fa\u6240\u6709\u7684MySQL\u96c6\u7fa4\u540d\u79f0\uff0c\u901a\u8fc7sql\u67e5\u8be2database_instance\u76f8\u5173\u8868\u83b7\u53d6<br \/>\norchestrator -c clusters<br \/>\nclusters-alias<br \/>\n\u8f93\u51fa\u6240\u6709MySQL\u96c6\u7fa4\u540d\u79f0\u4ee5\u53ca\u522b\u540d<br \/>\norchestrator -c clusters-alias<br \/>\nall-clusters-masters<br \/>\n\u8f93\u51fa\u6240\u6709MySQL\u96c6\u7fa4\u53ef\u5199\u7684\u4e3b\u5e93\u4fe1\u606f<br \/>\norchestrator -c all-clusters-masters<br \/>\ntopology<br \/>\n\u8f93\u51fa\u5b9e\u4f8b\u6240\u5c5e\u96c6\u7fa4\u7684\u62d3\u6251\u4fe1\u606f<br \/>\norchestrator -c topology -i instance.belonging.to.a.topology.com<br \/>\ntopology-tabulated<br \/>\n\u8f93\u51fa\u5b9e\u4f8b\u6240\u5c5e\u96c6\u7fa4\u7684\u62d3\u6251\u4fe1\u606f\uff0c\u7c7b\u4f3ctopology\u547d\u4ee4\uff0c\u8f93\u51fa\u683c\u5f0f\u7a0d\u6709\u4e0d\u540c<br \/>\norchestrator -c topology-tabulated -i instance.belonging.to.a.topology.com<br \/>\nall-instances<br \/>\n\u8f93\u51fa\u6240\u6709\u5df2\u77e5\u7684\u5b9e\u4f8b<br \/>\norchestrator -c all-instances<br \/>\nwhich-instance<br \/>\n\u8f93\u51fa\u5b9e\u4f8b\u7684\u5b8c\u6574\u7684\u4fe1\u606f<br \/>\norchestrator -c which-instance -i instance.to.check.com<br \/>\nwhich-cluster<br \/>\n\u8f93\u51faMySQL\u5b9e\u4f8b\u6240\u5c5e\u7684\u96c6\u7fa4\u540d\u79f0<br \/>\norchestrator -c which-cluster -i instance.to.check.com<br \/>\nwhich-cluster-domain<br \/>\n\u8f93\u51faMySQL\u5b9e\u4f8b\u6240\u5c5e\u96c6\u7fa4\u7684\u57df\u540d<br \/>\norchestrator -c which-cluster-domain -i instance.to.check.com<br \/>\nwhich-heuristic-domain-instance<br \/>\n\u7ed9\u5b9a\u4e00\u4e2a\u96c6\u7fa4\u57df\u540d\uff0c\u8f93\u51fa\u4e0e\u5176\u5173\u8054\u7684\u53ef\u5199\u7684\u5b9e\u4f8b<br \/>\norchestrator -c which-heuristic-domain-instance -alias some_alias<br \/>\nwhich-cluster-master<br \/>\n\u8f93\u51fa\u5b9e\u4f8b\u6240\u5c5e\u96c6\u7fa4\u7684\u4e3b\u5e93\u4fe1\u606f<br \/>\norchestrator -c which-cluster-master -i instance.to.check.com<br \/>\nwhich-cluster-instances<br \/>\n\u8f93\u51fa\u5b9e\u4f8b\u6240\u5c5e\u96c6\u7fa4\u7684\u6240\u6709\u5b9e\u4f8b\u4fe1\u606f<br \/>\norchestrator -c which-cluster-instances -i instance.to.check.com<br \/>\nwhich-master<br \/>\n\u5217\u51fa\u5b9e\u4f8b\u6240\u5c5e\u96c6\u7fa4\u7684\u4e3b\u5e93\u4fe1\u606f\uff0c\u4e0ewhich-cluster-master\u7c7b\u4f3c<br \/>\norchestrator -c which-master -i a.known.replica.com<br \/>\nwhich-downtimed-instances<br \/>\n\u5217\u51fa\u5904\u4e8e\u4e0b\u7ebf\u72b6\u6001\u7684\u5b9e\u4f8b<br \/>\norchestrator -c which-downtimed-instances<br \/>\nwhich-replicas<br \/>\n\u8f93\u51fa\u5b9e\u4f8b\u7684\u4ece\u5e93\u4fe1\u606f<br \/>\norchestrator -c which-replicas -i a.known.instance.com<br \/>\nwhich-lost-in-recovery<br \/>\n\u8f93\u51fa\u5904\u4e8e\u4e0b\u7ebf\u72b6\u6001\uff0c\u5728\u6545\u969c\u6062\u590d\u8fc7\u7a0b\u4e2d\u4e22\u5931\u7684\u5b9e\u4f8b<br \/>\norchestrator -c which-lost-in-recovery<br \/>\ninstance-status<br \/>\n\u8f93\u51fa\u5b9e\u4f8b\u7684\u72b6\u6001\u4fe1\u606f<br \/>\norchestrator -c instance-status -i instance.to.investigate.com<br \/>\nget-cluster-heuristic-lag<br \/>\n\u8f93\u51fa\u5b9e\u4f8b\u6240\u5c5e\u96c6\u7fa4\u7684\u6700\u5927\u5ef6\u8fdf\u4fe1\u606f<br \/>\norchestrator -c get-cluster-heuristic-lag -i instance.that.is.part.of.cluster.com<\/p>\n<h3>4.3 \u6545\u969c\u6062\u590d\u547d\u4ee4<\/h3>\n<p>recover<br \/>\nrecover-lite<br \/>\nforce-master-failover<br \/>\nforce-master-takeover<br \/>\ngraceful-master-takeover<br \/>\nreplication-analysis<br \/>\nack-all-recoveries<br \/>\nack-cluster-recoveries<br \/>\nack-instance-recoveries<br \/>\nrelocate<br \/>\nrecover<br \/>\n\u4e3b\u5e93\u6545\u969c\u5207\u6362\uff0c\u4e3b\u5e93\u5fc5\u987b\u5173\u95ed\uff0c\u6267\u884c\u624d\u6709\u6548\u679c\uff0c -i \u53c2\u6570\u5fc5\u987b\u662f\u5df2\u7ecf\u5173\u95ed\u7684\u4e3b\u5e93\uff0c \u65b0\u4e3b\u5e93\u4e0d\u9700\u8981\u6307\u5b9a\uff0c\u7531orchestrator\u81ea\u5df1\u9009\u62e9\u3002<br \/>\norchestrator -c recover -i dead.instance.com &#8211;debug<br \/>\nrecover-lite<br \/>\n\u4e3b\u5e93\u6545\u969c\u5207\u6362\uff0c\u4e0erecover\u7c7b\u4f3c\uff0c\u7b80\u5316\u7684\u90e8\u5206\u64cd\u4f5c\uff0c\u66f4\u52a0\u8f7b\u91cf\u5316\u3002<br \/>\norchestrator -c recover-lite -i dead.instance.com &#8211;debug<br \/>\nforce-master-failover<br \/>\n\u4e0d\u7ba1\u4e3b\u5e93\u662f\u5426\u6b63\u5e38\uff0c\u5f3a\u5236\u6545\u969c\u5207\u6362\uff0c\u5207\u6362\u540e\u4e3b\u5e93\u4e0d\u5173\u95ed\uff0c\u65b0\u4e3b\u5e93\u4e0d\u9700\u8981\u6307\u5b9a\uff0c\u7531orchestrator\u9009\u62e9\u3002\u8fd9\u4e2a\u64cd\u4f5c\u6bd4\u8f83\u5371\u9669\uff0c\u8c28\u614e\u4f7f\u7528\u3002<br \/>\norchestrator -c force-master-failover<br \/>\nforce-master-takeover<br \/>\n\u4e0d\u7ba1\u4e3b\u5e93\u662f\u5426\u6b63\u5e38\uff0c\u5f3a\u5236\u4e3b\u4ece\u5207\u6362\uff0c-i\u6307\u5b9a\u96c6\u7fa4\u4e2d\u4efb\u4e00\u5b9e\u4f8b\uff0c-d \u6307\u5b9a\u65b0\u4e3b\u5e93\uff0c \u6ce8\u610f \u5207\u6362\u540e\u65e7\u4e3b\u5e93\u4e0d\u4f1a\u6307\u5411\u65b0\u4e3b\u5e93\uff0c\u9700\u8981\u624b\u52a8\u64cd\u4f5c\u3002<br \/>\norchestrator -c force-master-takeover -i instance.in.relevant.cluster.com -d immediate.child.of.master.com<br \/>\ngraceful-master-takeover<br \/>\n\u4e3b\u4ece\u5207\u6362\uff0c\u65e7\u4e3b\u5e93\u4f1a\u6307\u5411\u65b0\u4e3b\u5e93\uff0c\u4f46\u662f\u590d\u5236\u7ebf\u7a0b\u662f\u505c\u6b62\u7684\uff0c\u9700\u8981\u4eba\u5de5\u624b\u52a8\u6267\u884cstart slave\uff0c\u6062\u590d\u590d\u5236\u3002<br \/>\norchestrator -c graceful-master-takeover -i instance.in.relevant.cluster.com -d immediate.child.of.master.com<br \/>\nreplication-analysis<br \/>\n\u6839\u636e\u5df2\u6709\u7684\u62d3\u6251\u5173\u7cfb\u5206\u6790\u6f5c\u5728\u7684\u6545\u969c\u4e8b\u4ef6\uff0c\u5206\u6790\u7ed3\u679c\u8f93\u51fa\u683c\u5f0f\u4e0d\u7a33\u5b9a\uff0c\u672a\u6765\u53ef\u80fd\u6539\u53d8\uff0c\u5efa\u8bae\u4e0d\u8981\u4f7f\u7528\u8be5\u529f\u80fd\u3002<br \/>\norchestrator -c replication-analysis<br \/>\nack-all-recoveries<br \/>\nack-cluster-recoveries<br \/>\nack-instance-recoveries<br \/>\n\u786e\u8ba4\u5df2\u6709\u7684\u6545\u969c\u6062\u590d\uff0c\u9632\u6b62\u672a\u6765\u518d\u6b21\u53d1\u751f\u6545\u969c\u65f6\uff0c\u4f1a\u963b\u585e\u6545\u969c\u5207\u6362<br \/>\norchestrator -c ack-all-recoveries &#8211;reason=\\&#8221;dba has taken taken necessary steps\\&#8221;<br \/>\norchestrator -c ack-cluster-recoveries -i instance.in.a.cluster.com &#8211;reason=\\&#8221;reson message\\&#8221;<br \/>\norchestrator -c ack-instance-recoveries -i instance.that.failed.com &#8211;reason=\\&#8221;reson message\\&#8221;<br \/>\nrelocate<br \/>\n\u8c03\u6574\u62d3\u6251\u7ed3\u6784\uff0c-i \u6307\u5b9a\u7684\u5b9e\u4f8b\u66f4\u6539\u4e3a -d \u6307\u5b9a\u5b9e\u4f8b\u7684\u4ece\u5e93\u3002<br \/>\norchestrator -c relocate -i replica.to.relocate.com -d instance.that.becomes.its.master<\/p>\n<h2>5. \u81ea\u52a8\u6545\u969c\u5207\u6362<\/h2>\n<p>Orchestrator\u80fd\u591f\u914d\u7f6e\u6210\u81ea\u52a8\u68c0\u6d4b\u4e3b\u5e93\u6545\u969c\uff0c\u5e76\u5b8c\u6210\u6545\u969c\u5207\u6362\u3002<\/p>\n<ol>\n<li>\u4ee5http\u65b9\u5f0f\u542f\u52a8\u540e\u53f0Web\u670d\u52a1<br \/>\norchestrator &#8211;config=.\/orchestrator.conf.json &#8211;debug http<br \/>\n\u6210\u529f\u542f\u52a8\u540e\uff0c\u53ef\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95eeWeb\u9875\u9762\uff1a<br \/>\nhttp:\/\/192.168.56.110:3000<\/li>\n<li>\u53c2\u6570\u914d\u7f6e<\/li>\n<\/ol>\n<div>\n<pre>\\\"RecoverMasterClusterFilters\\\": [\\\"*\\\"],\n\\\"RecoverIntermediateMasterClusterFilters\\\": [\\\"*\\\"],\n\\\"FailureDetectionPeriodBlockMinutes\\\": 60,\n\\\"RecoveryPeriodBlockSeconds\\\": 3600\n<\/pre>\n<\/div>\n<p>RecoverMasterClusterFilters \u548c RecoverIntermediateMasterClusterFilters \u5fc5\u987b\u914d\u7f6e\u4e3a[\\&#8221;*\\&#8221;]\uff0c\u5426\u5219\u81ea\u52a8\u5207\u6362\u4e0d\u4f1a\u89e6\u53d1\u3002<br \/>\nFailureDetectionPeriodBlockMinutes \u548c RecoveryPeriodBlockSeconds \u53c2\u6570\u9ed8\u8ba4\u503c\u4e3a1\u4e2a\u5c0f\u65f6\uff0c\u4e5f\u5c31\u662f\u5982\u679c\u53d1\u751f\u4e86\u6545\u969c\u5207\u6362\uff0c\u57281\u4e2a\u5c0f\u65f6\u4e4b\u5185\uff0c\u8be5\u4e3b\u5e93\u518d\u6b21\u51fa\u73b0\u6545\u969c\uff0c\u5c06\u4e0d\u4f1a\u88ab\u76d1\u6d4b\u5230\uff0c\u4e5f\u4e0d\u4f1a\u89e6\u53d1\u6545\u969c\u5207\u6362\u3002<\/p>\n<h2>6. Orchestrator \u9ad8\u53ef\u7528<\/h2>\n<p>Orchestrator\u591a\u8282\u70b9\u90e8\u7f72\uff0c\u901a\u8fc7raft\u4e00\u81f4\u6027\u534f\u8bae\u5b9e\u73b0\u81ea\u8eab\u9ad8\u53ef\u7528\u3002<br \/>\n\u4f8b\u5982\u5728\u5982\u4e0b3\u53f0\u673a\u5668\u90e8\u7f72Orchestrator\u8282\u70b9\uff1a<\/p>\n<ul>\n<li>192.168.56.110<\/li>\n<li>192.168.56.111<\/li>\n<li>192.168.56.112<\/li>\n<\/ul>\n<p>\u5728\u6bcf\u4e2a\u8282\u70b9\u4e0a\u4fee\u6539orchestrator.conf.json\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<div>\n<pre>\\\"RaftEnabled\\\": true,\n\\\"RaftDataDir\\\": \\\"\/var\/lib\/orchestrator\\\",\n\\\"RaftBind\\\": \\\"192.168.56.110\\\",\n\\\"DefaultRaftPort\\\": 10008,\n\\\"RaftNodes\\\": [ \\\"192.168.56.110\\\", \\\"192.168.56.111\\\", \\\"192.168.56.112\\\" ],\n<\/pre>\n<\/div>\n<p>RaftBind\u914d\u7f6e\u4e3a\u5f53\u524d\u8282\u70b9ip\uff0c\u5728\u6bcf\u4e2a\u8282\u70b9\u4e0a\u542f\u52a8orchestrator\u670d\u52a1\uff1a<br \/>\n.\/orchestrator &#8211;config=.\/orchestrator.conf.json &#8211;debug http<br \/>\n\u5728\u6d4f\u89c8\u5668\u4e2d\u8bbf\u95ee\uff1a<br \/>\n<a href=\\\"http:\/\/192.168.56.110:3000\/api\/leader-check\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer\\\">http:\/\/192.168.56.110:3000\/api\/leader-check<\/a><br \/>\n\u8fd4\u56de \\&#8221;OK\\&#8221;\uff0c\u5f53\u524dleader\u4e3a192.168.56.110<br \/>\n<a href=\\\"http:\/\/192.168.56.110:3000\/api\/raft-health\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer\\\">http:\/\/192.168.56.110:3000\/api\/raft-health<\/a><br \/>\n\u8fd4\u56de \\&#8221;healthy\\&#8221;<br \/>\n<a href=\\\"http:\/\/192.168.56.111:3000\/api\/leader-check\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer\\\">http:\/\/192.168.56.111:3000\/api\/leader-check<\/a><br \/>\n\u8fd4\u56de \\&#8221;Not leader\\&#8221;<br \/>\n<a href=\\\"http:\/\/192.168.56.111:3000\/api\/raft-health\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer\\\">http:\/\/192.168.56.111:3000\/api\/raft-health<\/a><br \/>\n\u8fd4\u56de \\&#8221;healthy\\&#8221;<br \/>\n\u5173\u95ed192.168.56.110\u8282\u70b9\u4e0a\u7684orchestrator\u670d\u52a1\uff0cleader\u81ea\u52a8\u5207\u6362\u5230192.168.56.111\u6216\u8005192.168.56.112\uff0c\u5982\u679c192.168.56.110\u91cd\u65b0\u542f\u52a8\u540e\uff0c\u52a0\u5165\u96c6\u7fa4\uff0c\u5b83\u5c06\u4f5c\u4e3afollower\u3002<\/p>\n<h2>7. \u6ce8\u610f\u4e8b\u9879<\/h2>\n<ol>\n<li>Orchestrator\u5b98\u65b9\u6587\u6863\u90e8\u5206\u5185\u5bb9\u4e0d\u51c6\u786e\uff0c\u6bd4\u5982 MySQLTopologyUser \u8d26\u53f7\u7684\u6743\u9650\u5e94\u8be5\u8bbe\u7f6e\u4e3asuper,process,reload,select,replicatiopn slave,replicatiopn client\uff0c\u6587\u6863\u4e2d\u7f3a\u5c11\u4e86select\u6743\u9650\uff0corchestrator\u5207\u6362\u8fc7\u7a0b\u4e2d\u9700\u8981\u901a\u8fc7\u8bfb\u53d6\u4ece\u5e93\u7684mysql.slave_master_info\u8868\uff0c\u83b7\u53d6\u590d\u5236\u8d26\u53f7\u548c\u5bc6\u7801\uff0c\u5982\u679c\u6ca1\u6709select\u6743\u9650\uff0c\u5c06\u5bfc\u81f4\u8bfb\u53d6\u5931\u8d25\uff0c\u5e76\u4e14\u4e0d\u4f1a\u6709\u4efb\u4f55\u9519\u8bef\u4fe1\u606f\u62a5\u51fa\u6765\u3002<\/li>\n<li>orchestrator \u5efa\u8bae\u4f7f\u7528\u673a\u5668\u540d\uff0c\u800c\u4e0d\u662fip\u6765\u7ba1\u7406MySQL\u5b9e\u4f8b\uff0c\u6bd4\u5982change master to \u4e2d\u7684 master_host \u5982\u679c\u6307\u5b9a\u7684\u662fip\uff0c\u6709\u53ef\u80fd\u5bfc\u81f4\u4e3b\u4ece\u5207\u6362\u6216\u8005\u6545\u969c\u5207\u6362\u51fa\u73b0\u95ee\u9898\u3002<\/li>\n<\/ol>\n<p>\u6700\u540e\u9644\u4e0aWeb\u9875\u9762\u56fe\uff1a<\/p>\n<div>\n<div>\n<div><\/div>\n<div data-width=\\\"865\\\" data-height=\\\"311\\\"><img src=\\\"\/\/upload-images.jianshu.io\/upload_images\/12192447-89184a818aeba925.png?imageMogr2\/auto-orient\/strip|imageView2\/2\/w\/865\/format\/webp\\\" data-original-src=\\\"\/\/upload-images.jianshu.io\/upload_images\/12192447-89184a818aeba925.png\\\" data-original-width=\\\"865\\\" data-original-height=\\\"311\\\" data-original-format=\\\"image\/png\\\" data-original-filesize=\\\"40336\\\" data-image-index=\\\"0\\\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div><\/div>\n<div>\n<div><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. \u7b80\u4ecb Orchestrator\u662f\u4e00\u6b3e\u5f00\u6e90\u7684MySQL\u590d\u5236\u62d3\u6251\u7ba1\u7406\u5de5\u5177\uff0c\u91c7\u7528go\u8bed\u8a00\u7f16\u5199\uff0c\u652f\u6301MySQL\u4e3b &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/www.weijing.co\/?p=1806\"> <span class=\"screen-reader-text\">MySQL\u590d\u5236\u62d3\u6251\u7ba1\u7406\u5de5\u5177Orchestrator<\/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":"1. \u7b80\u4ecb Orchestrator\u662f\u4e00\u6b3e\u5f00\u6e90\u7684MySQL\u590d\u5236\u62d3\u6251\u7ba1\u7406\u5de5\u5177\uff0c\u91c7\u7528go\u8bed\u8a00\u7f16\u5199\uff0c\u652f\u6301MySQL\u4e3b&hellip;","_links":{"self":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/1806"}],"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=1806"}],"version-history":[{"count":0,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/1806\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1806"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1806"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}