Error: Could not register this Router instance with the cluster

问题背景

  • MySQL 5.7.24
  • MySQL Shell 8.0.13
  • MySQL Router 8.0.13
    MySQL InnoDB Cluster(Group Replication)搭建成功。Single Primary模式,具体如下:
# 主服务器
192.168.233.136:3307
# 从服务器
192.168.233.136:3307
# 从服务器
192.168.233.136:3307

尝试利用官方推荐的MySQL Router进行集群的路由,但是在初始化Router命令式报错如下:

[root@xxx etc]# mysqlrouter --bootstrap 192.168.233.136:3307 --directory /usr/local/mysqlrouter --user root
Please enter MySQL password for root: 
WARNING: The MySQL server does not have SSL configured and metadata used by the router may be transmitted unencrypted.

Bootstrapping MySQL Router instance at '/usr/local/mysqlrouter'...
Error: Could not register this Router instance with the cluster because querying this host's hostname from OS failed:
  Could not get local hostname: Temporary failure in name resolution (ret: -3, errno: 0)
You may want to try --report-host option to manually supply this hostname.

解决方法

根据错误提示在命令行后添加主机名即可

[root@xxx etc]# mysqlrouter --bootstrap localhost:3307 --directory /usr/local/mysqlrouter --user root --report-host xxx
Please enter MySQL password for root: 
WARNING: The MySQL server does not have SSL configured and metadata used by the router may be transmitted unencrypted.

Bootstrapping MySQL Router instance at '/usr/local/mysqlrouter'...
Checking for old Router accounts
Creating account mysql_router1_f2o1wqkibyp2@'%'
MySQL Router  has now been configured for the InnoDB cluster 'myCluster'.

The following connection information can be used to connect to the cluster after MySQL Router has been started with generated configuration..

Classic MySQL protocol connections to cluster 'myCluster':
- Read/Write Connections: localhost:6446
- Read/Only Connections: localhost:6447
X protocol connections to cluster 'myCluster':
- Read/Write Connections: localhost:64460
- Read/Only Connections: localhost:64470
[root@cmiot1 etc]# cd /usr/local/mysqlrouter/
[root@cmiot1 mysqlrouter]# ll
total 28
drwx------ 2 root root 4096 Dec  4 14:39 data
drwx------ 2 root root 4096 Dec  4 14:39 log
-rw------- 1 root root 1286 Dec  4 14:39 mysqlrouter.conf
-rw------- 1 root root   93 Dec  4 14:39 mysqlrouter.key
drwx------ 2 root root 4096 Dec  4 14:39 run
-rwx------ 1 root root  290 Dec  4 14:39 start.sh
-rwx------ 1 root root  176 Dec  4 14:39 stop.sh
[root@cmiot1 mysqlrouter]# 

此时,初始化的文件均已生成在/usr/local/mysqlrouter文件夹中,若要启动Router直接在当前文件夹中执行

[root@cmiot1 mysqlrouter]# ./start.sh

即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值