资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

trovemysqlreplica使用-创新互联

1、trove mysql replica 一些限制

成都创新互联于2013年开始,先为高州等服务建站,高州等地企业,进行企业商务咨询服务。为高州企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
  • trove 可以同时支持binlog replica 和gtid replica

  • gtid 需要mysql5.6及其以上版本

  • newton trove 对mysql 的 binlog replica 支持不是很好

  • newton trove 对mysql的gtid replica 可以正常工作

  • newton trove 可以创建 mysql5.5 binlog replica

  • detach-replica:Mysql 5.5 binlog 模式可以正常工作

  • eject-replica-source:对binlog复制模式mysql5.5报错,binlog模式报错信息:Could not locate column in row for column 'Master_UUID'

  • promote-to-replica-source:Mysql5.5 binlog 模式报错,操作中会用到gtid

2、与replica 相关的命令

trove create # 创建复制 trove detach-replica # 从复制中移除slave trove promote-to-replica-source #master,slave都存活的情况下,将指定的slave提升为master,原master降为slave trove eject-replica-source # 当master失去心跳,可以移除master,trove在slave选择一个合适的节点作为master

3、创建复制

trove create ab 6 --size 5 --databases myDB \     --users userA:password --datastore_version mysql-5.6 \     --datastore mysql trove create ab-slave1 6 --size 5 --replica_of ab --replica_count 2 \     --datastore_version mysql-5.6     --datastore mysql

4、分离slave

trove show ab-slave2-2 +-------------------+--------------------------------------+ | Property          | Value                                | +-------------------+--------------------------------------+ | created           | 2017-03-31T03:29:20                  | | datastore         | mysql                                | | datastore_version | mysql-5.6                            | | flavor            | 6                                    | | id                | caa908f1-5e14-4c65-ac0e-a9ba26536107 | | ip                | 172.168.10.6                         | | name              | ab-slave2-2                          | | replica_of        | 3d39a475-3277-4d24-9467-ebc254e9316f | | status            | ACTIVE                               | | updated           | 2017-03-31T06:19:30                  | | volume            | 5                                    | | volume_used       | 0.14                                 | +-------------------+--------------------------------------+ trove detach-replica  ab-slave2-2 trove show  ab-slave2-2 +-------------------+--------------------------------------+ | Property          | Value                                | +-------------------+--------------------------------------+ | created           | 2017-03-31T03:29:20                  | | datastore         | mysql                                | | datastore_version | mysql-5.6                            | | flavor            | 6                                    | | id                | caa908f1-5e14-4c65-ac0e-a9ba26536107 | | ip                | 172.168.10.6                         | | name              | ab-slave2-2                          | | status            | ACTIVE                               | | updated           | 2017-03-31T06:28:45                  | | volume            | 5                                    | | volume_used       | 0.14                                 | +-------------------+--------------------------------------+

5、提升slave为master

trove show ab-slave3-1 +-------------------+--------------------------------------+ | Property          | Value                                | +-------------------+--------------------------------------+ | created           | 2017-03-31T03:36:16                  | | datastore         | mysql                                | | datastore_version | mysql-5.6                            | | flavor            | 6                                    | | id                | f303fc8f-819b-47b5-b33a-38184c8aff90 | | ip                | 172.168.10.14                        | | name              | ab-slave3-1                          | | replica_of        | 3d39a475-3277-4d24-9467-ebc254e9316f | | status            | ACTIVE                               | | updated           | 2017-03-31T06:19:30                  | | volume            | 5                                    | | volume_used       | 0.14                                 | +-------------------+--------------------------------------+ trove promote-to-replica-source ab-slave3-1 # ab-slave3-1已提升为master trove show ab-slave3-1 +-------------------+----------------------------------------------------------------------------+ | Property          | Value                                                                      | +-------------------+----------------------------------------------------------------------------+ | created           | 2017-03-31T03:36:16                                                        | | datastore         | mysql                                                                      | | datastore_version | mysql-5.6                                                                  | | flavor            | 6                                                                          | | id                | f303fc8f-819b-47b5-b33a-38184c8aff90                                       | | ip                | 172.168.10.14                                                              | | name              | ab-slave3-1                                                                | | replicas          | 3d39a475-3277-4d24-9467-ebc254e9316f, f4b3be64-c204-439d-a9c4-e28cb543a3b9 | | status            | ACTIVE                                                                     | | updated           | 2017-03-31T06:33:39                                                        | | volume            | 5                                                                          | | volume_used       | 0.14                                                                       | +-------------------+----------------------------------------------------------------------------+ # master已降级为slave trove show 3d39a475-3277-4d24-9467-ebc254e9316f +-------------------+--------------------------------------+ | Property          | Value                                | +-------------------+--------------------------------------+ | created           | 2017-03-31T06:14:35                  | | datastore         | mysql                                | | datastore_version | mysql-5.6                            | | flavor            | 6                                    | | id                | 3d39a475-3277-4d24-9467-ebc254e9316f | | ip                | 172.168.10.8                         | | name              | ab                                   | | replica_of        | f303fc8f-819b-47b5-b33a-38184c8aff90 | | status            | ACTIVE                               | | updated           | 2017-03-31T06:33:39                  | | volume            | 5                                    | | volume_used       | 0.14                                 | +-------------------+--------------------------------------+

6、移除master

移除master需要在master已经失去心跳的情况下做,如果master尚有心跳是无法移除master的

可以通过停止master上的trove-guestagent模拟master失去心跳

service trove-guestagent stop trove eject-replica-source

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


当前文章:trovemysqlreplica使用-创新互联
分享网址:http://cdkjz.cn/article/cdijed.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220