背景

在上一篇「MySQL高可用复制管理工具 —— Orchestrator介绍」中大致介绍了Orchestrator的功能、配置和部署,当然最详细的说明可以查阅官方文档。本文开始对Orchestrator的各方面进行测试和说明。

测试说明

环境介绍

服务器环境:

  1. 三台服务器
  2. MySQL实例3306orch的后端数据库,3307MySQL主从架构「开启GTID」)
  3. Master 192.168.163.131:
  4. Slave 192.168.163.132:
  5. Slave 192.168.163.133:
  6.  
  7. hostsetc/hosts):
  8. 192.168.163.131 test1
  9. 192.168.163.132 test2
  10. 192.168.163.133 test3

这里需要注意的是,orch检测主库宕机依赖从库的IO线程(本身连不上主库后,还会通过从库再去检测主库是否异常),所以默认change搭建的主从感知主库宕机的等待时间过长,需要需要稍微改下:

  1. change master to master_host='192.168.163.131',master_port=,master_user='rep',master_password='rep',master_auto_position=,MASTER_HEARTBEAT_PERIOD=,MASTER_CONNECT_RETRY=, MASTER_RETRY_COUNT=;
  1. set global slave_net_timeout=;

slave_net_timeout(全局变量):MySQL5.7.7之后,默认改成60秒。该参数定义了从库从主库获取数据等待的秒数,超过这个时间从库会主动退出读取,中断连接,并尝试重连。

master_heartbeat_period:复制心跳的周期。默认是slave_net_timeout的一半。Master在没有数据的时候,每master_heartbeat_period秒发送一个心跳包,这样 Slave 就能知道 Master 是不是还正常。

slave_net_timeout是设置在多久没收到数据后认为网络超时,之后 Slave 的 IO 线程会重新连接 Master 。结合这两个设置就可以避免由于网络问题导致的复制延误。master_heartbeat_period 单位是秒,可以是个带上小数,如 10.5,最高精度为 1 毫秒。

  1. 重试策略为
    备库过了slave-net-timeout秒还没有收到主库来的数据,它就会开始第一次重试。然后每过 master-connect-retry 秒,备库会再次尝试重连主库。直到重试了 master-retry-count 次,它才会放弃重试。如果重试的过程中,连上了主库,那么它认为当前主库是好的,又会开始 slave-net-timeout 秒的等待。
  2. slave-net-timeout 的默认值是 秒, master-connect-retry 默认为 秒, master-retry-count 默认为 次。也就是说,如果主库一分钟都没有任何数据变更发送过来,备库才会尝试重连主库。

这样,主库宕机之后,约8~10秒感知主库异常,Orchestrator开始切换。另外还需要注意的是,orch默认是用主机名来进行管理的,需要在mysql的配置文件里添加:report_host和report_port参数。

数据库环境:

  1. Orchestrator后端数据库:
  2. 在启动Orchestrator程序的时候,会自动在数据库里创建orchestrator数据库,保存orchestrator的一些数据信息。
  3.  
  4. Orchestrator管理的数据库:
  5. 在配置文件里配置的一些query参数,需要在每个被管理的目标库里有meta库来保留一些元信息(类似cmdb功能),比如用pt-heartbeat来验证主从延迟;用cluster表来保存别名、数据中心等。

如下面是测试环境的cluster表信息:

  1. > CREATE TABLE `cluster` (
  2. `anchor` tinyint() NOT NULL,
  3. `cluster_name` varchar() CHARACTER SET ascii NOT NULL DEFAULT '',
  4. `cluster_domain` varchar() CHARACTER SET ascii NOT NULL DEFAULT '',
  5. `data_center` varchar() NOT NULL,
  6. PRIMARY KEY (`anchor`)
  7. ) ENGINE=InnoDB DEFAULT CHARSET=utf8
  8.  
  9. >select * from cluster;
  10. +--------+--------------+----------------+-------------+
  11. | anchor | cluster_name | cluster_domain | data_center |
  12. +--------+--------------+----------------+-------------+
  13. | | test | CaoCao | BJ |
  14. +--------+--------------+----------------+-------------+

测试说明

开启Orchestrator进程:

  1. ./orchestrator --config=/etc/orchestrator.conf.json http

在浏览器里输入三台主机的任意主机的IP加端口(http://192.168.163.131:3000)进入到Web管理界面,在Clusters导航的Discover里输入任意一台被管理MySQL实例的信息。添加完成之后,Web界面效果:

在web上可以进行相关的管理,关于Web上的相关按钮的说明,下面会做相关说明:

1.  部分可修改的参数(点击Web上需要被修改实例的任意图标):

说明

  1. Instance Alias :实例别名
  2. Last seen : 最后检测时间
  3. Self coordinates :自身的binlog位点信息
  4. Num replicas :有几个从库
  5. Server ID MySQL server_id
  6. Server UUID MySQL UUID
  7. Version 版本
  8. Read only 是否只读
  9. Has binary logs :是否开启binlog
  10. Binlog format binlog 模式
  11. Logs slave updates :是否开启log_slave_updates
  12. GTID supported :是否支持GTID
  13. GTID based replication :是否是基于GTID的复制
  14. GTID mode :复制是否开启了GTID
  15. Executed GTID set :复制中执行过的GTID列表
  16. Uptime :启动时间
  17. Allow TLS :是否开启TLS
  18. Cluster :集群别名
  19. Audit :审计实例
  20. Agent Agent实例

说明:上面图中,后面有按钮的都是可以在Web上进行修改的功能,如:是否只读,是否开启GTID的复制等。其中Begin Downtime 会将实例标记为已停用,此时如果发生Failover,该实例不会参与。

2.  任意改变主从的拓扑结构:可以直接在图上拖动变更复制,会自动恢复拓扑关系:

3.  主库挂了之后自动Failover,如:

图中显示,当主挂掉之后,拓扑结构里自动剔除该主节点,选择一个最合适的从库提升成主库,并修复复制拓扑。在Failover过程当中,可以查看/tmp/recovery.log文件(配置文件里定死),里面包含了在Failover过程中Hooks执行的外部脚本,类似MHA的master_ip_failover_script参数。可以通过外部脚本进行相应的如:VIP切换、Proxy修改、DNS修改、中间件修改、LVS修改等等,具体的执行脚本可以根据自己的实际情况编写。

4.  Orchestrator高可用。因为在一开始就已经部署了3台,通过配置文件里的Raft参数进行通信。只要有2个节点的Orchestrator正常,就不会影响使用,如果出现2个节点的Orchestrator异常,则Failover会失败。2个节点异常的图如下:

图中的各个节点全部显示灰色,此时Raft算法失效,导致Orch的Failover功能失败。相对比MHA的Manager的单点,Orchestrator通过Raft算法解决了本身的高可用性以及解决网络隔离问题,特别是跨数据中心网络异常。这里说明下Raft,通过共识算法:

Orchestrator节点能够选择具有仲裁的领导者(leader)。如有3个orch节点,其中一个可以成为leader(3节点仲裁大小为2,5节点仲裁大小为3)。只允许leader进行修改,每个MySQL拓扑服务器将由三个不同的orchestrator节点独立访问,在正常情况下,三个节点将看到或多或少相同的拓扑图,但他们每个都会独立分析写入其自己的专用后端数据库服务器:

① 所有更改都必须通过leader。

② 在启用raft模式上禁止使用orchestrator客户端。

③ 在启用raft模式上使用orchestrator-client,orchestrator-client可以安装在没有orchestrator上的服务器。

④ 单个orchestrator节点的故障不会影响orchestrator的可用性。在3节点设置上,最多一个服务器可能会失败。在5节点设置上,2个节点可能会失败。

⑤ Orchestrator节点异常关闭,然后再启动。它将重新加入Raft组,并接收遗漏的任何事件,只要有足够的Raft记录。

⑥ 要加入比日志保留允许的更长/更远的orchestrator节点或者数据库完全为空的节点,需要从另一个活动节点克隆后端DB

关于Raft更多的信息见:https://github.com/github/orchestrator/blob/master/docs/raft.md

Orchestrator高可用有2种方式,第一种就是上面说的通过Raft(推荐),另一种是通过后端数据库的同步。详细信息见文档。文档里详细比较了两种高可用性部署方法。两种方法的图如下:

到这里,Orchestrator的基本功能已经实现,包括主动Failover、修改拓扑结构以及Web上的可视化操作。

5. Web上各个按钮的功能说明

①:Home下的status:查看orch的状态:包括运行时间、版本、后端数据库以及各个Raft节点的状态。

②:Cluster下的dashboard:查看orch下的所有被管理的MySQL实例。

③:Cluster下的Failure analysis:查看故障分析以及包括记录的故障类型列表。

④:Cluster下的Discover:用来发现被管理的MySQL实例。

⑤:Audit下的Failure detection:故障检测信息,包含历史信息。

⑥:Audit下的Recovery:故障恢复信息以及故障确认。

⑦:Audit下的Agent:是一个在MySQL主机上运行并与orchestrator通信的服务,能够向orch提供操作系统,文件系统和LVM信息,以及调用某些命令和脚本。

⑧:导航栏里的图标,对应左边导航栏的图标:

第1行:集群别名的查看修改。

第2行:pools。

第3行:Compact display,紧凑展示。

第4行:Pool indicator,池指示器。

第5行:Colorize DC,每个数据中心用不同颜色展示。

第6行:Anonymize,匿名集群中的主机名。

注意:左边导航栏里的图标,表示实例的概括:实例名、别名、故障检测和恢复等信息。

⑧:导航栏里的图标,表示是否禁止全局恢复。禁止掉的话不会进行Failover。

⑨:导航栏里的图标,表示是否开启刷新页面(默认60一次)。

⑩:导航栏里的图标,表示MySQL实例迁移模式。

  1. Smart mode:自动选择迁移模式,让Orch自己选择迁移模式。
  2. Classic mode:经典迁移模式,通过binlogposition进行迁移。
  3. GTID modeGTID迁移模式。
  4. Pseudo GTID mode:伪GTID迁移模式。

到此,Orchestrator的基本测试和Web说明已经介绍完毕。和MHA比已经有很大的体验提升,不仅在Web进行部分参数的设置修改,还可以改变复制拓扑,最重要的是解决MHA Manager单点的问题。还有什么理由不替换MHA呢?:)

工作流程说明

Orchestrator实现了自动Failover,现在来看看自动Failover的大致流程是怎么样的。

1. 检测流程

① orchestrator利用复制拓扑,先检查主本身,并观察其slaves。

② 如果orchestrator本身连不上主,可以连上该主的从,则通过从去检测,若在从上也看不到主(IO Thread)「2次检查」,判断Master宕机。

该检测方法比较合理,当从都连不上主了,则复制肯定有出问题,故会进行切换。所以在生产中非常可靠。

检测发生故障后并不都会进行自动恢复,比如:禁止全局恢复、设置了shutdown time、上次恢复离本次恢复时间在RecoveryPeriodBlockSeconds设置的时间内、失败类型不被认为值得恢复等。检测与恢复无关,但始终启用。 每次检测都会执行OnFailureDetectionProcesses Hooks。

配置故障检测

  1. {
  2. "FailureDetectionPeriodBlockMinutes": ,
  3. }
  4.  
  5. Hooks相关参数:
  6. {
  7. "OnFailureDetectionProcesses": [
  8. "echo 'Detected {failureType} on {failureCluster}. Affected replicas: {countReplicas}' >> /tmp/recovery.log"
  9. ],
  10. }
  11.  
  12. MySQL复制相关调整:
  13. slave_net_timeout
  14. MASTER_CONNECT_RETRY

2. 恢复流程

恢复的实例需要支持:GTID、伪GTID、开启Binlog。恢复的配置如下:

  1. {
  2. "RecoveryPeriodBlockSeconds": ,
  3. "RecoveryIgnoreHostnameFilters": [],
  4. "RecoverMasterClusterFilters": [
  5. "thiscluster",
  6. "thatcluster"
  7. ],
  8. "RecoverMasterClusterFilters": ["*"],
  9. "RecoverIntermediateMasterClusterFilters": [
  10. "*"
  11. ],
  12. }
  13.  
  14. {
  15. "ApplyMySQLPromotionAfterMasterFailover": true,
  16. "PreventCrossDataCenterMasterFailover": false,
  17. "FailMasterPromotionIfSQLThreadNotUpToDate": true,
  18. "MasterFailoverLostInstancesDowntimeMinutes": ,
  19. "DetachLostReplicasAfterMasterFailover": true,
  20. }
  21.  
  22. Hooks
  23. {
  24. "PreGracefulTakeoverProcesses": [
  25. "echo 'Planned takeover about to take place on {failureCluster}. Master will switch to read_only' >> /tmp/recovery.log"
  26. ],
  27. "PreFailoverProcesses": [
  28. "echo 'Will recover from {failureType} on {failureCluster}' >> /tmp/recovery.log"
  29. ],
  30. "PostFailoverProcesses": [
  31. "echo '(for all types) Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Successor: {successorHost}:{successorPort}' >> /tmp/recovery.log"
  32. ],
  33. "PostUnsuccessfulFailoverProcesses": [],
  34. "PostMasterFailoverProcesses": [
  35. "echo 'Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:
 {failedPort}; Promoted: {successorHost}:{successorPort}' >> /tmp/recovery.log"
  36. ],
  37. "PostIntermediateMasterFailoverProcesses": [],
  38. "PostGracefulTakeoverProcesses": [
  39. "echo 'Planned takeover complete' >> /tmp/recovery.log"
  40. ],
  41. }

具体的参数含义请参考「MySQL高可用复制管理工具 —— Orchestrator介绍」。在执行故障检测和恢复的时候都可以执行外部自定义脚本(hooks),来配合使用(VIP、Proxy、DNS)。

可以恢复中继主库(DeadIntermediateMaster)和主库:

中继主库:恢复会找其同级的节点进行做主从。匹配副本按照哪些实例具有log-slave-updates、实例是否延迟、它们是否具有复制过滤器、哪些版本的MySQL等等

主库:恢复可以指定提升特定的从库「提升规则」(register-candidate),提升的从库不一定是最新的,而是选择最合适的,设置完提升规则之后,有效期为1个小时。

提升规则选项有:

  1. prefer --比较喜欢
  2. neutral --中立(默认)
  3. prefer_not --比较不喜欢
  4. must_not --拒绝

恢复支持的类型有:自动恢复优雅的恢复手动恢复手动强制恢复,恢复的时候也可以执行相应的Hooks参数。具体的恢复流程可以看恢复流程的说明。关于恢复的配置可以官方说明

补充:每次恢复除了自动的Failover之外,都需要配合执行自己定义的Hooks的脚本来处理外部的一些操作:VIP修改、DNS修改、Proxy修改等等。所以这么多Hooks的参数该如何设置呢?哪个参数需要执行,哪个参数不需要执行,以及Hooks的执行顺序是怎么样的?虽然文章里有介绍,但为了更好的进行说明,下面进行各种恢复场景执行Hooks的顺序:

  1. "OnFailureDetectionProcesses": [ #检测故障时执行
  2. "echo '② Detected {failureType} on {failureCluster}. Affected replicas: {countSlaves}' >> /tmp/recovery.log"
  3. ],
  4. "PreGracefulTakeoverProcesses": [ #在主变为只读之前立即执行
  5. "echo '① Planned takeover about to take place on {failureCluster}. Master will switch to read_only' >> /tmp/recovery.log"
  6. ],
  7. "PreFailoverProcesses": [ #在执行恢复操作之前立即执行
  8. "echo '③ Will recover from {failureType} on {failureCluster}' >> /tmp/recovery.log"
  9. ],
  10. "PostMasterFailoverProcesses": [ #在主恢复成功结束时执行
  11. "echo '④ Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Promoted: {successorHost}:{successorPort}' >> /tmp/recovery.log"
  12. ],
  13. "PostFailoverProcesses": [ #在任何成功恢复结束时执行
  14. "echo '⑤ (for all types) Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Successor: {successorHost}:{successorPort}' >> /tmp/recovery.log"
  15. ],
  16. "PostUnsuccessfulFailoverProcesses": [ #在任何不成功的恢复结束时执行
  17. "echo '⑧ >> /tmp/recovery.log'"
  18. ],
  19. "PostIntermediateMasterFailoverProcesses": [ #在成功的中间主恢复结束时执行
  20. "echo '⑥ Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Successor: {successorHost}:{successorPort}' >> /tmp/recovery.log"
  21. ],
  22. "PostGracefulTakeoverProcesses": [ #在旧主位于新晋升的主之后执行
  23. "echo '⑦ Planned takeover complete' >> /tmp/recovery.log"
  24. ],
  1. 主库宕机,自动Failover
  2. Detected UnreachableMaster on test1:. Affected replicas:
  3. Detected DeadMaster on test1:. Affected replicas:
  4. Will recover from DeadMaster on test1:
  5. Recovered from DeadMaster on test1:. Failed: test1:; Promoted: test2:
  6. (for all types) Recovered from DeadMaster on test1:. Failed: test1:; Successor: test2:
  7.  
  8. 优雅的主从切换:test2:3307优雅的切换到test1:,切换之后需要手动执行start slave
  9. orchestrator-client -c graceful-master-takeover -a test2: -d test1:
  10. Planned takeover about to take place on test2:. Master will switch to read_only
  11. Detected DeadMaster on test2:. Affected replicas:
  12. Will recover from DeadMaster on test2:
  13. Recovered from DeadMaster on test2:. Failed: test2:; Promoted: test1:
  14. (for all types) Recovered from DeadMaster on test2:. Failed: test2:; Successor: test1:
  15. Planned takeover complete
  16.  
  17. 手动恢复,当从库进入停机或则维护模式,此时主库宕机,不会自动Failover,需要手动执行恢复,指定死掉的主实例:
  18. orchestrator-client -c recover -i test1:
  19. Detected UnreachableMaster on test1:. Affected replicas:
  20. Detected DeadMaster on test1:. Affected replicas:
  21. Will recover from DeadMaster on test1:
  22. Recovered from DeadMaster on test1:. Failed: test1:; Promoted: test2:
  23. (for all types) Recovered from DeadMaster on test1:. Failed: test1:; Successor: test2:
  24.  
  25. 手动强制恢复,不管任何情况,都进行恢复:
  26. orchestrator-client -c force-master-failover -i test2:
  27. Detected DeadMaster on test2:. Affected replicas:
  28. Will recover from DeadMaster on test2:
  29. Detected AllMasterSlavesNotReplicating on test2:. Affected replicas:
  30. Recovered from DeadMaster on test2:. Failed: test2:; Promoted: test1:
  31. (for all types) Recovered from DeadMaster on test2:. Failed: test2:; Successor: test1:

其中上面的情况下,⑥和⑧都没执行。因为⑥是执行中间主库时候执行的,没有中间主库(级联复制)可以不用设置。⑧是恢复失败的时候执行的,上面恢复没有出现失败,可以定义一些告警提醒。

生产环境上部署

在生产上部署Orchestrator,可以参考文档

1.  Orchestrator首先需要确认本身高可用的后端数据库是用单个MySQL,MySQL复制还是本身的Raft。

2. 运行发现服务(web、orchestrator-client)

  1. orchestrator-client -c discover -i this.hostname.com

3. 确定提升规则(某些服务器更适合被提升)

  1. orchestrator -c register-candidate -i ${::fqdn} --promotion-rule ${promotion_rule}

4. 如果服务器出现问题,将在Web界面上的问题下拉列表中显示。使用Downtiming则不会在问题列表里显示,并且也不会进行恢复,处于维护模式。

  1. orchestrator -c begin-downtime -i ${::fqdn} --duration=5m --owner=cron --reason=continuous_downtime"
  2.  
  3. 也可以用API:
  4. curl -s "http://my.orchestrator.service:80/api/begin-downtime/my.hostname/3306/wallace/experimenting+failover/45m"

5. 伪GTID,如果MySQL没有开启GTID,则可以开启伪GTID实现类似GTID的功能。

6. 保存元数据,元数据大部分通过参数的query来获取,比如在自的表cluster里获取集群的别名(DetectClusterAliasQuery)、数据中心(DetectDataCenterQuery)、域名(DetectClusterDomainQuery)等,以及复制的延迟(pt-heartbeat)、是否半同步(DetectSemiSyncEnforcedQuery)。以及可以通过正则匹配:DataCenterPattern、PhysicalEnvironmentPattern等。

7. 可以给实例打标签

命令行、API的使用

Orchestrator不仅有Web界面来进行查看和管理,还可以通过命令行(orchestrator-client)和API(curl)来执行更多的管理命令,现在来说明几个比较常用方法。

通过help来看下有哪些可以执行的命令:./orchestrator-client --help,命令的说明可以看手册说明

  1. Usage: orchestrator-client -c <command> [flags...]
  2. Example: orchestrator-client -c which-master -i some.replica
  3. Options:
  4.  
  5. -h, --help
  6. print this help
  7. -c <command>, --command <command>
  8. indicate the operation to perform (see listing below)
  9. -a <alias>, --alias <alias>
  10. cluster alias
  11. -o <owner>, --owner <owner>
  12. name of owner for downtime/maintenance commands
  13. -r <reason>, --reason <reason>
  14. reason for downtime/maintenance operation
  15. -u <duration>, --duration <duration>
  16. duration for downtime/maintenance operations
  17. -R <promotion rule>, --promotion-rule <promotion rule>
  18. rule for 'register-candidate' command
  19. -U <orchestrator_api>, --api <orchestrator_api>
  20. override $orchestrator_api environemtn variable,
  21. indicate where the client should connect to.
  22. -P <api path>, --path <api path>
  23. With '-c api', indicate the specific API path you wish to call
  24. -b <username:password>, --auth <username:password>
  25. Specify when orchestrator uses basic HTTP auth.
  26. -q <query>, --query <query>
  27. Indicate query for 'restart-replica-statements' command
  28. -l <pool name>, --pool <pool name>
  29. pool name for pool related commands
  30. -H <hostname> -h <hostname>
  31. indicate host for resolve and raft operations
  32.  
  33. help Show available commands
  34. which-api Output the HTTP API to be used
  35. api Invoke any API request; provide --path argument
  36. async-discover Lookup an instance, investigate it asynchronously. Useful for bulk loads
  37. discover Lookup an instance, investigate it
  38. forget Forget about an instance's existence
  39. forget-cluster Forget about a cluster
  40. topology Show an ascii-graph of a replication topology, given a member of that topology
  41. topology-tabulated Show an ascii-graph of a replication topology, given a member of that topology, in tabulated format
  42. clusters List all clusters known to orchestrator
  43. clusters-alias List all clusters known to orchestrator
  44. search Search for instances matching given substring
  45. instance"|"which-instance Output the fully-qualified hostname:port representation of the given instance, or error if unknown
  46. which-master Output the fully-qualified hostname:port representation of a given instance's master
  47. which-replicas Output the fully-qualified hostname:port list of replicas of a given instance
  48. which-broken-replicas Output the fully-qualified hostname:port list of broken replicas of a given instance
  49. which-cluster-instances Output the list of instances participating in same cluster as given instance
  50. which-cluster Output the name of the cluster an instance belongs to, or error if unknown to orchestrator
  51. which-cluster-master Output the name of a writable master in given cluster
  52. all-clusters-masters List of writeable masters, one per cluster
  53. all-instances The complete list of known instances
  54. which-cluster-osc-replicas Output a list of replicas in a cluster, that could serve as a pt-online-schema-change operation control replicas
  55. which-cluster-osc-running-replicas Output a list of healthy, replicating replicas in a cluster, that could serve as a pt-online-schema-change operation control replicas
  56. downtimed List all downtimed instances
  57. dominant-dc Name the data center where most masters are found
  58. submit-masters-to-kv-stores Submit a cluster's master, or all clusters' masters to KV stores
  59. relocate Relocate a replica beneath another instance
  60. relocate-replicas Relocates all or part of the replicas of a given instance under another instance
  61. match Matches a replica beneath another (destination) instance using Pseudo-GTID
  62. match-up Transport the replica one level up the hierarchy, making it child of its grandparent, using Pseudo-GTID
  63. match-up-replicas Matches replicas of the given instance one level up the topology, making them siblings of given instance, using Pseudo-GTID
  64. move-up Move a replica one level up the topology
  65. move-below Moves a replica beneath its sibling. Both replicas must be actively replicating from same master.
  66. move-equivalent Moves a replica beneath another server, based on previously recorded "equivalence coordinates"
  67. move-up-replicas Moves replicas of the given instance one level up the topology
  68. make-co-master Create a master-master replication. Given instance is a replica which replicates directly from a master.
  69. take-master Turn an instance into a master of its own master; essentially switch the two.
  70. move-gtid Move a replica beneath another instance via GTID
  71. move-replicas-gtid Moves all replicas of a given instance under another (destination) instance using GTID
  72. repoint Make the given instance replicate from another instance without changing the binglog coordinates. Use with care
  73. repoint-replicas Repoint all replicas of given instance to replicate back from the instance. Use with care
  74. take-siblings Turn all siblings of a replica into its sub-replicas.
  75. tags List tags for a given instance
  76. tag-value List tags for a given instance
  77. tag Add a tag to a given instance. Tag in "tagname" or "tagname=tagvalue" format
  78. untag Remove a tag from an instance
  79. untag-all Remove a tag from all matching instances
  80. tagged List instances tagged by tag-string. Format: "tagname" or "tagname=tagvalue" or comma separated "tag0,tag1=val1,tag2" for intersection of all.
  81. submit-pool-instances Submit a pool name with a list of instances in that pool
  82. which-heuristic-cluster-pool-instances List instances of a given cluster which are in either any pool or in a specific pool
  83. begin-downtime Mark an instance as downtimed
  84. end-downtime Indicate an instance is no longer downtimed
  85. begin-maintenance Request a maintenance lock on an instance
  86. end-maintenance Remove maintenance lock from an instance
  87. register-candidate Indicate the promotion rule for a given instance
  88. register-hostname-unresolve Assigns the given instance a virtual (aka "unresolved") name
  89. deregister-hostname-unresolve Explicitly deregister/dosassociate a hostname with an "unresolved" name
  90. stop-replica Issue a STOP SLAVE on an instance
  91. stop-replica-nice Issue a STOP SLAVE on an instance, make effort to stop such that SQL thread is in sync with IO thread (ie all relay logs consumed)
  92. start-replica Issue a START SLAVE on an instance
  93. restart-replica Issue STOP and START SLAVE on an instance
  94. reset-replica Issues a RESET SLAVE command; use with care
  95. detach-replica Stops replication and modifies binlog position into an impossible yet reversible value.
  96. reattach-replica Undo a detach-replica operation
  97. detach-replica-master-host Stops replication and modifies Master_Host into an impossible yet reversible value.
  98. reattach-replica-master-host Undo a detach-replica-master-host operation
  99. skip-query Skip a single statement on a replica; either when running with GTID or without
  100. gtid-errant-reset-master Remove errant GTID transactions by way of RESET MASTER
  101. gtid-errant-inject-empty Apply errant GTID as empty transactions on cluster's master
  102. enable-semi-sync-master Enable semi-sync (master-side)
  103. disable-semi-sync-master Disable semi-sync (master-side)
  104. enable-semi-sync-replica Enable semi-sync (replica-side)
  105. disable-semi-sync-replica Disable semi-sync (replica-side)
  106. restart-replica-statements Given `-q "<query>"` that requires replication restart to apply, wrap query with stop/start slave statements as required to restore instance to same replication state. Print out set of statements
  107. can-replicate-from Check if an instance can potentially replicate from another, according to replication rules
  108. can-replicate-from-gtid Check if an instance can potentially replicate from another, according to replication rules and assuming Oracle GTID
  109. is-replicating Check if an instance is replicating at this time (both SQL and IO threads running)
  110. is-replication-stopped Check if both SQL and IO threads state are both strictly stopped.
  111. set-read-only Turn an instance read-only, via SET GLOBAL read_only :=
  112. set-writeable Turn an instance writeable, via SET GLOBAL read_only :=
  113. flush-binary-logs Flush binary logs on an instance
  114. last-pseudo-gtid Dump last injected Pseudo-GTID entry on a server
  115. recover Do auto-recovery given a dead instance, assuming orchestrator agrees there's a problem. Override blocking.
  116. graceful-master-takeover Gracefully promote a new master. Either indicate identity of new master via '-d designated.instance.com' or setup replication tree to have a single direct replica to the master.
  117. force-master-failover Forcibly discard master and initiate a failover, even if orchestrator doesn't see a problem. This command lets orchestrator choose the replacement master
  118. force-master-takeover Forcibly discard master and promote another (direct child) instance instead, even if everything is running well
  119. ack-cluster-recoveries Acknowledge recoveries for a given cluster; this unblocks pending future recoveries
  120. ack-all-recoveries Acknowledge all recoveries
  121. disable-global-recoveries Disallow orchestrator from performing recoveries globally
  122. enable-global-recoveries Allow orchestrator to perform recoveries globally
  123. check-global-recoveries Show the global recovery configuration
  124. replication-analysis Request an analysis of potential crash incidents in all known topologies
  125. raft-leader Get identify of raft leader, assuming raft setup
  126. raft-health Whether node is part of a healthy raft group
  127. raft-leader-hostname Get hostname of raft leader, assuming raft setup
  128. raft-elect-leader Request raft re-elections, provide hint for new leader's identity

orchestrator-client不需要和Orchestrator服务放一起,不需要访问后端数据库,在任意一台上都可以。

注意:因为配置了Raft,有多个Orchestrator,所以需要ORCHESTRATOR_API的环境变量,orchestrator-client会自动选择leader。如:

  1. export ORCHESTRATOR_API="test1:3000/api test2:3000/api test3:3000/api"

1. 列出所有集群:clusters

默认:

  1. # orchestrator-client -c clusters
  2. test2:

返回包含集群别名:clusters-alias

  1. # orchestrator-client -c clusters-alias
  2. test2:,test

2. 发现指定实例:discover/async-discover

同步发现:

  1. # orchestrator-client -c discover -i test1:
  2. test1:

异步发现:适用于批量

  1. # orchestrator-client -c async-discover -i test1:
  2. :null

3. 忘记指定对象:forget/forget-cluster

忘记指定实例:

  1. # orchestrator-client -c forget -i test1:

忘记指定集群:

  1. # orchestrator-client -c forget-cluster -i test

4. 打印指定集群的拓扑:topology/topology-tabulated

普通返回:

  1. # orchestrator-client -c topology -i test1:
  2. test2: [0s,ok,5.7.-0ubuntu0.16.04.-log,rw,ROW,>>,GTID]
  3. + test1: [0s,ok,5.7.-0ubuntu0.16.04.-log,ro,ROW,>>,GTID]
  4. + test3: [0s,ok,5.7.-log,ro,ROW,>>,GTID]

列表返回:

  1. # orchestrator-client -c topology-tabulated -i test1:
  2. test2: |0s|ok|5.7.-0ubuntu0.16.04.-log|rw|ROW|>>,GTID
  3. + test1:|0s|ok|5.7.-0ubuntu0.16.04.-log|ro|ROW|>>,GTID
  4. + test3:|0s|ok|5.7.-log |ro|ROW|>>,GTID

5. 查看使用哪个API:自己会选择出leader。which-api

  1. # orchestrator-client -c which-api
  2. test3:/api

也可以通过 http://192.168.163.133:3000/api/leader-check 查看。

6. 调用api请求,需要和 -path 参数一起:api..-path

  1. # orchestrator-client -c api -path clusters
  2. [ "test2:3307" ]
  3. # orchestrator-client -c api -path leader-check
  4. "OK"
  5. # orchestrator-client -c api -path status
  6. { "Code": "OK", "Message": "Application node is healthy"...}

7. 搜索实例:search

  1. # orchestrator-client -c search -i test
  2. test2:
  3. test1:
  4. test3:

8. 打印指定实例的主库:which-master

  1. # orchestrator-client -c which-master -i test1:
  2. test2:
  3. # orchestrator-client -c which-master -i test3:
  4. test2:
  5. # orchestrator-client -c which-master -i test2:3307 #自己本身是主库
  6. :

9. 打印指定实例的从库:which-replicas

  1. # orchestrator-client -c which-replicas -i test2:
  2. test1:
  3. test3:

10. 打印指定实例的实例名:which-instance

  1. # orchestrator-client -c instance -i test1:
  2. test1:

11. 打印指定主实例从库异常的列表:which-broken-replicas,模拟test3的复制异常:

  1. # orchestrator-client -c which-broken-replicas -i test2:
  2. test3:

12. 给出一个实例或则集群别名,打印出该实例所在集群下的所有其他实例。which-cluster-instances

  1. # orchestrator-client -c which-cluster-instances -i test
  2. test1:
  3. test2:
  4. test3:
  5. root@test1:~# orchestrator-client -c which-cluster-instances -i test1:
  6. test1:
  7. test2:
  8. test3:

13. 给出一个实例,打印该实的集群名称:默认是hostname:port。which-cluster

  1. # orchestrator-client -c which-cluster -i test1:
  2. test2:# orchestrator-client -c which-cluster -i test2:
  3. test2:# orchestrator-client -c which-cluster -i test3:
  4. test2:

14. 打印出指定实例/集群名或则所有所在集群的可写实例,:which-cluster-master

指定实例:which-cluster-master

  1. # orchestrator-client -c which-cluster-master -i test2:
  2. test2:
  3. # orchestrator-client -c which-cluster-master -i test
  4. test2:

所有实例:all-clusters-masters,每个集群返回一个

  1. # orchestrator-client -c all-clusters-masters
  2. test1:

15. 打印出所有实例:all-instances

  1. # orchestrator-client -c all-instances
  2. test2:
  3. test1:
  4. test3:

16. 打印出集群中可以作为pt-online-schema-change操作的副本列表:which-cluster-osc-replicas

  1. ~# orchestrator-client -c which-cluster-osc-replicas -i test
  2. test1:
  3. test3:
  4. root@test1:~# orchestrator-client -c which-cluster-osc-replicas -i test2:
  5. test1:
  6. test3:

17. 打印出集群中可以作为pt-online-schema-change可以操作的健康的副本列表:which-cluster-osc-running-replicas

  1. # orchestrator-client -c which-cluster-osc-running-replicas -i test
  2. test1:
  3. test3:
  4. # orchestrator-client -c which-cluster-osc-running-replicas -i test1:
  5. test1:
  6. test3:

18. 打印出所有在维护(downtimed)的实例:downtimed

  1. # orchestrator-client -c downtimed
  2. test1:
  3. test3:

19. 打印出进群中主的数据中心:dominant-dc

  1. # orchestrator-client -c dominant-dc
  2. BJ

20. 将集群的主提交到KV存储。submit-masters-to-kv-stores

  1. # orchestrator-client -c submit-masters-to-kv-stores
  2. mysql/master/test:test2:
  3. mysql/master/test/hostname:test2
  4. mysql/master/test/port:
  5. mysql/master/test/ipv4:192.168.163.132
  6. mysql/master/test/ipv6:

21. 迁移从库到另一个实例上:relocate

  1. # orchestrator-client -c relocate -i test3: -d test1:3307 #迁移test3:3307作为test1:3307的从库
  2. test3:<test1:
  3.  
  4. 查看
  5. # orchestrator-client -c topology -i test2:
  6. test2: [0s,ok,5.7.-0ubuntu0.16.04.-log,rw,ROW,>>,GTID]
  7. + test1: [0s,ok,5.7.-0ubuntu0.16.04.-log,ro,ROW,>>,GTID]
  8. + test3: [0s,ok,5.7.-log,ro,ROW,>>,GTID]

22. 迁移一个实例的所有从库到另一个实例上:relocate-replicas

  1. # orchestrator-client -c relocate-replicas -i test1: -d test2:3307 #迁移test1:3307下的所有从库到test2:3307下,并列出被迁移的从库的实例名
  2. test3:

23. 将slave在拓扑上向上移动一级,对应web上的是在Classic Model下进行拖动:move-up

  1. # orchestrator-client -c move-up -i test3: -d test2:
  2. test3:<test2:

结构从 test2:3307 -> test1:3307 -> test3:3307 变成 test2:3307 -> test1:3307

                              -> test3:3307

24. 将slave在拓扑上向下移动一级(移到同级的下面),对应web上的是在Classic Model下进行拖动:move-below

  1. # orchestrator-client -c move-below -i test3: -d test1:
  2. test3:<test1:

结构从 test2:3307 -> test1:3307  变成  test2:3307 -> test1:3307 -> test3:3307

           -> test3:3307

25. 将给定实例的所有从库在拓扑上向上移动一级,基于Classic Model模式:move-up-replicas

  1. # orchestrator-client -c move-up-replicas -i test1:3307
  1. test3:

结构从 test2:3307 -> test1:3307 -> test3:3307 变成 test2:3307 -> test1:3307

                             -> test3:3307

26. 创建主主复制,将给定实例直接和当前主库做成主主复制:make-co-master

  1. # orchestrator-client -c make-co-master -i test1:
  2. test1:<test2:

27.将实例转换为自己主人的主人,切换两个:take-master

  1. # orchestrator-client -c take-master -i test3:
  2. test3:<test2:

结构从 test2:3307 -> test1:3307 -> test3:3307 变成 test2:3307 -> test3:3307 -> test1:3307

28. 通过GTID移动副本,move-gtid:

通过orchestrator-client执行报错:

  1. # orchestrator-client -c move-gtid -i test3: -d test1:
  2. parse error: Invalid numeric literal at line , column
  3. parse error: Invalid numeric literal at line , column
  4. parse error: Invalid numeric literal at line , column

通过orchestrator执行是没问题,需要添加--ignore-raft-setup参数:

  1. # orchestrator -c move-gtid -i test3: -d test2: --ignore-raft-setup
  2. test3:<test2:

29.通过GTID移动指定实例下的所有slaves到另一个实例,move-replicas-gtid

通过orchestrator-client执行报错:

  1. # orchestrator-client -c move-replicas-gtid -i test3: -d test1:
  2. jq: error (at <stdin>:): Cannot index string with string "Key"

通过orchestrator执行是没问题,需要添加--ignore-raft-setup参数:

  1. # ./orchestrator -c move-replicas-gtid -i test2: -d test1: --ignore-raft-setup
  2. test3:

30. 将给定实例的同级slave,变更成他的slave,take-siblings

  1. # orchestrator-client -c take-siblings -i test3:
  2. test3:<test1:

结构从 test1:3307 -> test2:3307  变成  test1:3307 -> test3:3307 -> test2:3307

           -> test3:3307

31. 给指定实例打上标签,tag

  1. # orchestrator-client -c tag -i test1: --tag 'name=AAA'
  2. test1: 

32. 列出指定实例的标签,tags:

  1. # orchestrator-client -c tags -i test1:
  2. name=AAA 

33. 列出给定实例的标签值:tag-value

  1. # orchestrator-client -c tag-value -i test1: --tag "name"
  2. AAA

34. 移除指定实例上的标签:untag

  1. # orchestrator-client -c untag -i test1: --tag "name=AAA"
  2. test1: 

35. 列出打过某个标签的实例,tagged:

  1. # orchestrator-client -c tagged -t name
  2. test3:
  3. test1:
  4. test2:

36. 标记指定实例进入停用模式,包括时间、操作人、和原因,begin-downtime:

  1. # orchestrator-client -c begin-downtime -i test1: -duration=10m -owner=zjy -reason 'test'
  2. test1:

37. 移除指定实例的停用模式,end--downtime:

  1. # orchestrator-client -c end-downtime -i test1:
  2. test1:

38. 请求指定实例上的维护锁:拓扑更改需要将锁放在最小受影响的实例上,以避免在同一个实例上发生两个不协调的操作,begin-maintenance :

  1. # orchestrator-client -c begin-maintenance -i test1: --reason "XXX"
  2. test1:

锁默认10分钟后过期,有参数MaintenanceExpireMinutes。

39. 移除指定实例上的维护锁:end-maintenance

  1. # orchestrator-client -c end-maintenance -i test1:
  2. test1:

40. 设置提升规则,恢复时可以指定一个实例进行提升:register-candidate:需要和promotion-rule一起使用

  1. # orchestrator-client -c register-candidate -i test3: --promotion-rule prefer
  2. test3:

提升test3:3307的权重,如果进行Failover,会成为Master。

41. 指定实例执行停止复制:

普通的:stop slave:stop-replica

  1. # orchestrator-client -c stop-replica -i test2:
  2. test2:

应用完relay log,在stop slave:stop-replica-nice

  1. # orchestrator-client -c stop-replica-nice -i test2:
  2. test2:

42.指定实例执行开启复制: start-replica

  1. # orchestrator-client -c start-replica -i test2:
  2. test2:

43. 指定实例执行复制重启:restart-replica

  1. # orchestrator-client -c restart-replica -i test2:
  2. test2:

44.指定实例执行复制重置:reset-replica

  1. # orchestrator-client -c reset-replica -i test2:
  2. test2:

45.分离副本:非GTID修改binlog position,detach-replica :

  1. # orchestrator-client -c detach-replica -i test2:

46.恢复副本:reattach-replica

  1. # orchestrator-client -c reattach-replica -i test2: 

47.分离副本:注释master_host来分离,detach-replica-master-host :如Master_Host: //test1

  1. # orchestrator-client -c detach-replica-master-host -i test2:
  2. test2:

48. 恢复副本:reattach-replica-master-host

  1. # orchestrator-client -c reattach-replica-master-host -i test2:
  2. test2:

49. 跳过SQL线程的Query,如主键冲突,支持在GTID和非GTID下:skip-query

  1. # orchestrator-client -c skip-query -i test2:
  2. test2:

50. 将错误的GTID事务当做空事务应用副本的主上:gtid-errant-inject-empty「web上的fix」

  1. # orchestrator-client -c gtid-errant-inject-empty -i test2:
  2. test2: 

51.  通过RESET MASTER删除错误的GTID事务:gtid-errant-reset-master

  1. # orchestrator-client -c gtid-errant-reset-master -i test2:
  2. test2:

52. 设置半同步相关的参数:

  1. orchestrator-client -c $variable -i test1:
  1. enable-semi-sync-master 主上执行开启半同步
  2. disable-semi-sync-master 主上执行关闭半同步
  3. enable-semi-sync-replica 从上执行开启半同步
  4. disable-semi-sync-replica 从上执行关闭半同步

53. 执行需要stop/start slave配合的SQL:restart-replica-statements

  1. # orchestrator-client -c restart-replica-statements -i test3: -query "change master to auto_position=1" | jq .[] -r
  2. stop slave io_thread;
  3. stop slave sql_thread;
  4. change master to auto_position=;
  5. start slave sql_thread;
  6. start slave io_thread;
  7.  
  8. # orchestrator-client -c restart-replica-statements -i test3: -query "change master to master_auto_position=1" | jq .[] -r | mysql -urep -p -htest3 -P3307
  9. Enter password:

54.根据复制规则检查实例是否可以从另一个实例复制(GTID和非GTID):

非GTID,can-replicate-from:

  1. # orchestrator-client -c can-replicate-from -i test3: -d test1:
  2. test1:

GTID:can-replicate-from-gtid

  1. # orchestrator-client -c can-replicate-from-gtid -i test3: -d test1:
  2. test1: 

55. 检查指定实例是否在复制:is-replicating

  1. #有返回在复制
  2. # orchestrator-client -c is-replicating -i test2:
  3. test2:
  4.  
  5. #没有返回,不在复制
  6. # orchestrator-client -c is-replicating -i test1:

56.检查指定实例的IO和SQL限制是否都停止:

  1. # orchestrator-client -c is-replicating -i test2:

57.将指定实例设置为只读,通过SET GLOBAL read_only=1,set-read-only:

  1. # orchestrator-client -c set-read-only -i test2:
  2. test2:

58.将指定实例设置为读写,通过SET GLOBAL read_only=0,set-writeable

  1. # orchestrator-client -c set-writeable -i test2:
  2. test2:

59. 轮询指定实例的binary log,flush-binary-logs

  1. # orchestrator-client -c flush-binary-logs -i test1:
  2. test1:

60. 手动执行恢复,指定一个死机的实例,recover:

  1. # orchestrator-client -c recover -i test2:
  2. test3:

测试下来,该参数会让处理停机或则维护状态下的实例进行强制恢复。结构:

test1:3307 -> test2:3307 -> test3:3307(downtimed)  当test2:3307死掉之后,此时test3:3307处于停机状态,不会进行Failover,执行后变成

test1:3307 -> test2:3307

     -> test3:3307

61. 优雅的进行主和指定从切换,graceful-master-takeover:

  1. # orchestrator-client -c graceful-master-takeover -a test1: -d test2:
  2. test2:

结构从test1:3307 -> test2:3307 变成 test2:3307 -> test1:3307。新主指定变成读写,新从变成只读,还需要手动start slave。

注意需要配置:需要从元表里找到复制的账号和密码。

  1. "ReplicationCredentialsQuery":"SELECT repl_user, repl_pass from meta.cluster where anchor=1"

62. 手动强制执行恢复,即使orch没有发现问题,force-master-failover:转移之后老主独立,需要手动加入到集群。

  1. # orchestrator-client -c force-master-failover -i test1:
  2. test3:

63.强行丢弃master并指定的一个实例,force-master-takeover:老主(test1)独立,指定从(test2)提升为master

  1. # orchestrator-client -c force-master-takeover -i test1: -d test2:
  2. test2:

64. 确认集群恢复理由,在web上的Audit->Recovery->Acknowledged 按钮确认,/ack-all-recoveries

确认指定集群:ack-cluster-recoveries

  1. # orchestrator-client -c ack-cluster-recoveries -i test2: -reason=''
  2. test1:

确认所有集群:ack-all-recoveries

  1. # orchestrator-client -c ack-all-recoveries -reason='OOOPPP'
  2. eason=XYZ

65.检查、禁止、开启orchestrator执行全局恢复:

检查:check-global-recoveries

  1. # orchestrator-client -c check-global-recoveries
  2. enabled

禁止:disable-global-recoveries

  1. # orchestrator-client -c disable-global-recoveries
  2. disabled

开启:enable--global-recoveries

  1. # orchestrator-client -c enable-global-recoveries
  2. enabled

66. 检查分析复制拓扑中存在的问题:replication-analysis

  1. # orchestrator-client -c replication-analysis
  2. test1: (cluster test1:): ErrantGTIDStructureWarning

67. raft检测:leader查看、健康监测、迁移leader:

  1. 查看leader节点
  2. # orchestrator-client -c raft-leader
  3. 192.168.163.131:
  4.  
  5. 健康监测
  6. # orchestrator-client -c raft-health
  7. healthy
  8.  
  9. leader 主机名
  10. # orchestrator-client -c raft-leader-hostname
  11. test1
  12.  
  13. 指定主机选举leader
  14. # orchestrator-client -c raft-elect-leader -hostname test3
  15. test3

68.伪GTID相关参数:

  1. match #使用Pseudo-GTID指定一个从匹配到指定的另一个(目标)实例下
  2. match-up #Transport the replica one level up the hierarchy, making it child of its grandparent, using Pseudo-GTID
  3. match-up-replicas #Matches replicas of the given instance one level up the topology, making them siblings of given instance, using Pseudo-GTID
  4. last-pseudo-gtid #Dump last injected Pseudo-GTID entry on a server

到此关于Orchestrator的使用以及命令行说明已经介绍完毕,Web API可以在Orchestrator API查看,通过命令行和API上的操作可以更好的进行自动化开发。

总结:

Orchestrator是一款开源(go编写)的MySQL复制拓扑管理工具,支持MySQL主从复制拓扑关系的调整、主库故障自动切换、手动主从切换等功能。提供Web界面展示MySQL集群的拓扑关系及状态,可以更改MySQL实例的部分配置信息,也提供命令行和api接口。相对比MHA,Orchestrator自身可以部署多个节点,通过raft分布式一致性协议来保证自身的高可用。

更多玩法MySQL High Availability at GitHub,翻译文 GitHub 的 MySQL 高可用性实践分享

MySQL高可用复制管理工具 —— Orchestrator使用的更多相关文章

  1. MySQL高可用复制管理工具 —— Orchestrator介绍

    背景 在MySQL高可用架构中,目前使用比较多的是Percona的PXC,Galera以及MySQL 5.7之后的MGR等,其他的还有的MHA,今天介绍另一个比较好用的MySQL高可用复制管理工具:O ...

  2. MHA实现mysql高可用复制集群

    MHA简述 MHA(Master High Availability)目前在MySQL高可用方面是一个相对成熟的解决方案,是一套优秀的作为MySQL高可用性环境下故障切换和主从提升的高可用软件.在My ...

  3. (5.10)mysql高可用系列——percona-toolkit工具下的pt-table-checksum 在线验证主从一致性【续写中】

    关键词:percona-toolkit 工具包中包含 pt-table-checksum工具,在线验证主从一致性 [1]percona-toolkit 工具包 [1.1]percona-toolkit ...

  4. MySQL高可用工具--orchestrator

    orchestrator是一款MySQL高可用工具,其支持: 集群拓扑探测 集群拓扑重塑 故障恢复 提供3种使用方式: 命令行 HTTP API web页面 orchestator github地址

  5. MySQL高可用之组复制(1):组复制技术简介

    MySQL组复制系列文章: MySQL组复制大纲 MySQL组复制(1):组复制技术简介 MySQL组复制(2):配置单主模型的组复制 MySQL组复制(3):配置多主模型的组复制 MySQL组复制( ...

  6. (5.8)mysql高可用系列——MySQL中的GTID复制(实践篇)

    一.基于GTID的异步复制(一主一从)无数据/少数据搭建 二.基于GTID的无损半同步复制(一主一从)(mysql5.7)基于大数据量的初始化 正文: [0]概念 [0.5]GTID 复制(mysql ...

  7. MySQL高可用架构之MySQL5.7组复制MGR

    MySQL高可用架构之MySQL5.7组复制MGR########################################################################### ...

  8. MySQL高可用基础之keepalived+双主复制【转】

    环境:MySQL-VIP:192.168.1.3MySQL-master1:192.168.1.1MySQL-master2:192.168.1.2 OS版本:CentOS release 6.4 ( ...

  9. (5.1)mysql高可用系列——高可用架构方案概述

    关键词:mysql高可用概述,mysql高可用架构 常用高可用方案 20190918 现在业内常用的MySQL高可用方案有哪些?目前来说,用的比较多的开源方案分内置高可用与外部实现,内置高可用有如下: ...

随机推荐

  1. Java基础-常用的String方法

    先从String的new的方式 说起 这是面试题里面经常出现的 算是老套路之一 就是 比较下列两个的变化 两种实例化的区别 第一种String name1 = "好人";Strin ...

  2. Angular2+ 使用 Protractor 与 Modify Header Value (HTTP Headers) 插件 完成 Windows Authorization 验证

    入职新公司第二周,接到了一个E2E测试的任务,两天的时间把所有的测试条件都写完了,结果剩下三天都卡在了Windows Authorization验证这里. 先说一下公司项目Authorize的逻辑 第 ...

  3. Postman----打开postman console控制台,查看接口测试打印log

    经常在脚本中使用变量时,你可能需要看到变量获取到的值,你可以使用Postman Console去实现的.操作步骤:应用菜单-->View--->Show Postman Console,去 ...

  4. 本地和svn都删除文件导致版本不同的问题

    想要删除一个项目中的文件,同是要删除svn上的文件. 自己操作 1.直接右键删除了本地项目中的一个目录的模块 2.右键删除了库中svn中的这个目录 3.同步本地和svn上的代码 4.问题出现了,本地和 ...

  5. golang从简单的即时聊天来看架构演变

    前言 俗话说的好,架构从来都不是一蹴而就的,没有什么架构一开始设计就是最终版本,其中需要经过很多步骤的变化,今天我们就从一个最简单的例子来看看,究竟架构这个东西是怎么变的. 我将从一个最简单的聊天室的 ...

  6. 安卓开发笔记(二十六):Splash实现首页快速开屏功能

    我们在进行安卓开发的时候,首页开有两种方式,一种是利用handler将一个活动进行延时,时间到达之后软件则会跳转到第二个活动当中.而另一种方法则是更加常用的方法,利用splash实现首页的快速开屏,这 ...

  7. redis一致性hash算法理解

    一般算法: 对对象先hash然后对redis数量取模,如果结果是0就存在0的节点上. 1.2同上,假设有0-3四个redis节点.20个数据: 进行取模后分布如下: 现在因为压力过大需要扩容,增加一台 ...

  8. [asp.net core 源码分析] 01 - Session

    1.Session文档介绍 毋庸置疑学习.Net core最好的方法之一就是学习微软.Net core的官方文档:https://docs.microsoft.com/zh-cn/aspnet/cor ...

  9. eureka服务搭建

    Server端 引入eureka server的maven依赖 引入依赖时无需给定eureka的版本号,maven会根据当前使用的SpringCloud版本来判断应该引入哪个版本的euraka ser ...

  10. go.js remove 特定part

    我想删除一个实际上是背景的部分. 假设这是我添加part的方式 myDiagram.add( scope.gj(go.Part,//此Part未绑定到任何模型数据 { layerName:“Backg ...