【MySQL Shell】9.5 采用一个现有的复制设置

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6

作为从头开始创建复制集的替代方案您可以使用 dba.createReplicaSet() 中的 adoptFromAR 选项采用现有的复制设置。复制设置将被扫描如果它与 InnoDB ReplicaSet 限制 兼容AdminAPI 将创建必要的元数据。采用复制设置后您只能使用 AdminAPI 来管理 InnoDB ReplicaSet。

要将现有复制设置转换为 InnoDB ReplicaSet 请连接到主复制设置(也称为源复制设置。从 MySQL Shell 全局会话连接到实例开始复制拓扑将自动扫描和验证。在采用过程中检查所有实例的配置以确保它们与 InnoDB ReplicaSet 用法兼容:

  • 所有复制通道都必须处于活动状态并且通过 GTID 集验证的事务集必须一致。
  • 假设实例具有相同的状态或能够趋同。

    注意
    从 8.0.32 开始所有新的复制通道都是在启用 SSL 的情况下创建的。对于 MySQL Shell 8.0.32 采用的复制组情况并非如此。它们的复制通道保持未加密。

从 MySQL Shell 的全局会话连接到的实例开始复制拓扑将自动扫描和验证。此操作对采用的 ReplicaSet 所做的唯一更改是元数据架构的创建。现有复制通道在采用过程中不会更改但您可以在后续的切换主(实例操作中更改它们。

例如将由 example1example2 上的 MySQL 服务器实例组成的复制拓扑应用于 InnoDB ReplicaSet。

连接到在 example1 上的主服务器并执行:

mysql-js> rs = dba.createReplicaSet('testadopt', {'adoptFromAR':1})
A new replicaset with the topology visible from 'example1:3306' will be created.

* Scanning replication topology...
** Scanning state of instance example1:3306
** Scanning state of instance example2:3306

* Discovering async replication topology starting with example1:3306
Discovered topology:
- example1:3306: uuid=00371d66-3c45-11ea-804b-080027337932 read_only=no
- example2:3306: uuid=59e4f26e-3c3c-11ea-8b65-080027337932 read_only=no
    - replicates from example1:3306
	source="localhost:3310" channel= status=ON receiver=ON applier=ON

* Checking configuration of discovered instances...

This instance reports its own address as example1:3306
example1:3306: Instance configuration is suitable.

This instance reports its own address as example2:3306
example2:3306: Instance configuration is suitable.

* Checking discovered replication topology...
example1:3306 detected as the PRIMARY.
Replication state of example2:3306 is OK.

Validations completed successfully.

* Updating metadata...

ReplicaSet object successfully created for example1:3306.
Use rs.addInstance() to add more asynchronously replicated instances to
this replicaset and rs.status() to check its status.

一旦采用了 InnoDB ReplicaSet 您就可以以与创建的 ReplicaSet 相同的方式使用它。

警告
此时您必须仅使用 AdminAPI 管理 InnoDB ReplicaSet 。

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
标签: mysqlshell