十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
1、trove MySQL replica 一些限制
站在用户的角度思考问题,与客户深入沟通,找到安宁网站设计与安宁网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:网站设计、成都做网站、企业官网、英文网站、手机端网站、网站推广、域名注册、虚拟主机、企业邮箱。业务覆盖安宁地区。
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