采用组复制部署
如果您已经有组复制的现有部署,并且想要使用它来创建群集,请将adoptFromGR
选项传递给该dba.createCluster()
功能。创建的InnoDB集群与复制组以单主数据库还是多主数据库运行相匹配。
要采用现有的组复制组,请使用MySQL Shell连接到组成员。在下面的示例中,采用了单主要组。我们连接到gr-member-2
,gr-member-1
作为该组的主要实例的辅助实例。使用dba.createCluster()
传入adoptFromGR
选项创建集群。例如:
mysql-js>注意var cluster = dba.createCluster('prodCluster', {adoptFromGR: true}); Anew InnoDB cluster will be created on instance 'root@gr-member-2:3306'. Creating InnoDB cluster 'prodCluster' on 'root@gr-member-2:3306'... Adding Seed Instance... Cluster successfully created. Use cluster.addInstance() to add MySQL instances. At least 3 instances are neededfor the cluster to be able to withstand up to one server failure.
如果实例具有,super_read_only=ON
则可能需要确认AdminAPI可以设置super_read_only=OFF
。有关更多信息,请参见超级只读和实例。
新群集与组的模式匹配。如果采用的组以单主要模式运行,则将创建一个单主要集群。如果采用的组以多主要模式运行,则将创建一个多主要群集。