• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • 采用组复制部署

    如果您已经有组复制的现有部署,并且想要使用它来创建群集,请将adoptFromGR选项传递给该dba.createCluster()功能。创建的InnoDB集群与复制组以单主数据库还是多主数据库运行相匹配。

    要采用现有的组复制组,请使用MySQL Shell连接到组成员。在下面的示例中,采用了单主要组。我们连接到gr-member-2gr-member-1作为该组的主要实例的辅助实例。使用dba.createCluster()传入adoptFromGR选项创建集群。例如:

    mysql-js> var cluster = dba.createCluster('prodCluster', {adoptFromGR: true});
    
    A new 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 needed for the cluster to be able to withstand up to
    one server failure.
    
    注意

    如果实例具有,super_read_only=ON则可能需要确认AdminAPI可以设置super_read_only=OFF。有关更多信息,请参见超级只读和实例。

    新群集与组的模式匹配。如果采用的组以单主要模式运行,则将创建一个单主要集群。如果采用的组以多主要模式运行,则将创建一个多主要群集。