如何push MySQL new master 节点至注册中心

各位老师好:

我在github上面看到有人提出 MySQL高可用切换问题,其中有老师的回答是:
All the relationships of data sources and sharding rules are stored in registry center.
You or your program need to update the new master info on the registry center, and it will push this event online.
ShardingSphere can not handle the failover of MySQL, but it can push the info of new masters and slaves to all the proxy or JDBC clients online.

我的问题是:

  1. 如何 update the new master info on the registry center?
    – 直接修改zookeeper的值? 还是在shrding proxy中用 RDL修改

  2. 每个逻辑库都对应自己的 datasource,有无一个方法只修改一个公共的DataSource的
    /governance_ds/metadata/sharding_db/逻辑库1/versions/0/dataSources
    /governance_ds/metadata/sharding_db/逻辑库2/versions/0/dataSources

    /governance_ds/metadata/sharding_db/逻辑库n/versions/0/dataSources

  3. 当MySQL发生高可用切换,修改zookeeper或者使用RDL修改,sharding-proxy需要多久时间才能生效?是否有间隔等

您好, ShardingSphere 支持 MySQL 高可用, 如果您使用的是 MGR 集群的话, 那么可以直接使用, ShardingSphere 会自动的感知主从的关系.

非常感谢您的回复,我这边用的MySQL是主从架构,如果使用DataBase Discovery的SHOW_SLAVE_STATUS方式,Master节点不方便进行人为的控制。

我现在考虑的方案是:
Watch/Pull MySQL Master节点在ZK注册信息(由第三方的failover服务注册)变化,发生变化后,调度DistSQL实时更新注册中心中schema下的写节点

请帮忙评估这种方案是否可行,或者有没有更好的方案呢?

你好, 感觉没啥问题. 可以试试看

京ICP备2021015875号