问题描述
MySQL InnoDB Cluster配置过程中出错,版本5.7.24
MySQL localhost:3307 JS > var cluster = dba.createCluster('myCluster');
A new InnoDB cluster will be created on instance 'root@localhost:3307'.
Validating instance at localhost:3307...
This instance reports its own address as cmiot1
Instance configuration is suitable.
Creating InnoDB cluster 'myCluster' on 'root@localhost:3307'...
Dba.createCluster: To add an instance to the cluster, please use a valid, non-local hostname or IP. localhost can only be used with sandbox MySQL instances. (RuntimeError)
根据错误提示,在使用shell时不可使用localhost连接,而应该使用有效的非localhost名和ip作为连接名,应为localhost只在沙箱环境实例中使用。
解决方法
退出MySQL Shell
MySQL localhost:3307 JS > \q
利用ip连接shell
[root@cmiot1 mysqlmaster]# mysqlsh
MySQL JS > shell.connect('root@192.168.233.136:3307');
再次按照创建集群的步骤即可