MySQL router failed to set destination by metadata cache

196 views Asked by At

I have a 1 primary 1 secondary mysql innodb cluster with both node have mysql server version 8.0.35-0ubuntu0.22.04.1 .

I route to the cluster by mysql router, and hope to always visit the primary server with mode ready-write.

I install mysql router by dpkg.

$ sudo dpkg -i mysql-shell_8.0.35-1ubuntu22.04_amd64.deb
$ sudo apt-get install -f
$ mysqlsh -V
mysqlsh   Ver 8.0.35 for Linux on x86_64 - for MySQL 8.0.35 (MySQL Community Server (GPL))

When I set destinations by hosts, things works properly and I can access the database through port 33061:

[routing:read_writer]
bind_address=0.0.0.0
bind_port=33061
mode=read-write
destinations=192.168.9.16:3306,192.168.9.249:3306
max_connections=1024

When I set destinations by metadata-cache, though mysqlrouter still starts up, I cannot visit the database, and /var/logs/mysqlrouter/mysqlrouter.log does not print new messages.

[metadata_cache:testCluster]
cluster_type=gr
router_id=1
user=router
metadata_cluster=testCluster
ttl=0.5

[routing:read_writer]
bind_address=0.0.0.0
bind_port=33061
mode=read-write
# destinations=192.168.9.16:3306,192.168.9.249:3306
max_connections=1024
destinations=metadata-cache://testCluster/?role=PRIMARY

Nothing wrong in journalctl -xeu mysqlrouter, it just tells me service has been started by successfully.

Could anyone tell me what do I missed?

I mainly refer to the official document as this.

There is a related change for this version of mysqlrouter, but I tried and nothing changed.

In Addition

When I tested and tried to run mysqlrouter with --bootstrap, I get the following error:

$ mysqlrouter --bootstrap [email protected]:3306 --directory /home/tmp --user=root
Please enter MySQL password for spinq:
Error: Can't set ownership of file '/home/tmp' to the user 'root'. error: Permission denied.
One possible reason can be that the root user does not have proper rights because of root_squash on the NFS share.

I simply use a fresh new VMWare machine with Ubuntu22.04. Please tell me why this issue comes up and how to solve it.

0

There are 0 answers