2.(MySQL Router+MGR)MySQL InnoDB Cluster配置

本文档详细介绍了如何创建和部署MySQL InnoDB Cluster,包括设置seed节点、添加实例、持久化配置、用户权限管理和集群创建等步骤,确保生产环境的安全和稳定。
摘要由CSDN通过智能技术生成

1. Creating the Sandbox InnoDB Cluster

需要安装MySQL shell,否则不能进行。

1.1 创建集群的cluster seed

\connect root@192.168.136.128:13306 
\connect root@192.168.136.129:13306 
\connect root@192.168.136.130:13306
MySQL  localhost:13306  JS > \connect root@192.168.136.128:13306
 MySQL  192.168.136.128:13306  JS > var cluster = dba.createCluster('testCluster')
You are connected to an instance that belongs to an unmanaged replication group.
Do you want to setup an InnoDB cluster based on this replication group? [Y/n]: y
A new InnoDB cluster will be created based on the existing replication group on instance 'root@192.168.136.128:13306'.

Creating InnoDB cluster 'testCluster' on 'root@192.168.136.128:13306'...
Adding Seed Instance...
Adding Instance 'wn19testcdb1002:13306'...

Cluster successfully created based on existing replication group.

问题1:

MySQL  JS > \connect root@192.168.136.128:13306
Creating a session to 'root@192.168.136.128:13306'
Please provide the password for 'root@192.168.136.128:13306': ********
MySQL Error 1045 (28000): Access denied for user 'root'@'wn19testcdb1001' (using password: YES)

解决方法:

create user 'root'@'192.168.136.%' identified by 'Root@111';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.136.%' WITH GRANT OPTION  ;
GRANT PROXY ON ''@'' TO 'root'@'192.168.136.%' WITH GRANT OPTION ;


var cluster = dba.createCluster('testCluster')

1.2 添加instance到InnoDB Cluster

MySQL  192.168.136.128:13306  JS > cluster.addInstance('root@192.168.136.129:13306')


MySQL  192.168.136.130:13306  JS > cluster.addInstance('root@192.168.136.130:13306')


 MySQL  192.168.136.130:13306  JS > cluster.rescan()
Rescanning the cluster...

Result of the rescanning operation:
{
    "defaultReplicaSet": {
        "name": "default", 
        "newlyDiscoveredInstances": [
            {
                "host": "wn19testcdb1003:13306", 
                "member_id": "360bfb62-db39-11e8-b641-000c29beb130", 
                "name": null
            }
        ], 
        "unavailableInstances": []
    }
}

A new instance 'wn19testcdb1003:13306' was discovered in the HA setup. Would you like to add it to the cluster metadata? [Y/n]: y Adding instance to the cluster metadata...

Please provide the password for 'root@wn19testcdb1003:13306': ******** Save password for 'root@wn19testcdb1003:13306'? [Y]es/[N]o/Ne[v]er (default No): The instance 'root@wn19testcdb1003:13306' was successfully added to the cluster metadata.

MySQL  192.168.136.130:13306  JS > cluster.rescan()
Rescanning the cluster...

Result of the rescanning 
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值