szhjb88 发表于 2023-12-3 17:53:52

MySQL Router构建读写分离,提示schemadoes not exist.

各位好,

GreatSQL MGR集群使用ansible一键部署,然后再参照https://gitee.com/GreatSQL/GreatSQL-Doc/blob/master/deep-dive-mgr/deep-dive-mgr-07.md安装完MySQL Router,在执行 mysqlrouter --bootstrap root@192.168.3.244:3306 --user=mysqlrouter时提示:


Error: Expected MySQL Server '192.168.3.244:3306' to contain the metadata of MySQL InnoDB Cluster, but the schema does not exist.
Checking version of the metadata schema failed with: Error executing MySQL query "SELECT * FROM mysql_innodb_cluster_metadata.schema_version": Unknown database 'mysql_innodb_cluster_metadata' (1049)

See https://dev.mysql.com/doc/mysql-shell/en/deploying-production-innodb-cluster.html for instructions on setting up a MySQL Server to act as an InnoDB Cluster Metadata server


请问怎么解决该问题?谢谢大家!

szhjb88 发表于 2023-12-3 18:03:44

GreatSQL版本:8.0.32-24。
MySQL Router版本:Ver 8.0.32 for Linux on x86_64 (MySQL Community - GPL)

yejr 发表于 2023-12-4 08:12:03

szhjb88 发表于 2023-12-3 18:03
GreatSQL版本:8.0.32-24。
MySQL Router版本:Ver 8.0.32 for Linux on x86_64 (MySQL Community - GPL) ...

用MySQL Shell接管MGR后,就会创建mysql_innodb_cluster_metadata这个元数据Schema,然后就可以用Router接入了

szhjb88 发表于 2023-12-8 01:09:56

yejr 发表于 2023-12-4 08:12
用MySQL Shell接管MGR后,就会创建mysql_innodb_cluster_metadata这个元数据Schema,然后就可以用Router ...

请问用MySQL Shell接管MGR,是不是通过以下命令?

MySQLlocalhost:33060+ sslJS > var c=dba.createCluster('MGR1');
A new InnoDB Cluster will be created on instance '192.168.3.244:3306'.

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
Creating InnoDB Cluster 'MGR1' on '192.168.3.244:3306'...

Adding Seed Instance...
Adding Instance '192.168.3.245:3306'...
Adding Instance '192.168.3.246:3306'...
Adding Instance '192.168.3.244:3306'...
Resetting distributed recovery credentials across the cluster...
Dba.createCluster: Access denied; you need SYSTEM_VARIABLES_ADMIN and PERSIST_RO_VARIABLES_ADMIN privileges for this operation (MYSQLSH 3630)

szhjb88 发表于 2023-12-8 01:21:42

szhjb88 发表于 2023-12-8 01:09
请问用MySQL Shell接管MGR,是不是通过以下命令?

MySQLlocalhost:33060+ sslJS > var c=dba.cre ...

mysql mysqlrouter --bootstrap root@192.168.3.244:3306 --user=mysqlrouter
Please enter MySQL password for root:
# Bootstrapping system MySQL Router instance...

- Creating account(s) (only those that are needed, if any)
- Verifying account (using it to run SQL queries that would be run by Router)
- Storing account in keyring
- Adjusting permissions of generated files
- Creating configuration /etc/mysqlrouter/mysqlrouter.conf

Existing configuration backed up to '/etc/mysqlrouter/mysqlrouter.conf.bak'

# MySQL Router configured for the InnoDB Cluster 'MGR1'

After this MySQL Router has been started with the generated configuration

    $ /etc/init.d/mysqlrouter restart
or
    $ systemctl start mysqlrouter
or
    $ mysqlrouter -c /etc/mysqlrouter/mysqlrouter.conf

InnoDB Cluster 'MGR1' can be reached by connecting to:

## MySQL Classic protocol

- Read/Write Connections: localhost:6446
- Read/Only Connections:localhost:6447

## MySQL X protocol

- Read/Write Connections: localhost:6448
- Read/Only Connections:localhost:6449

yejr 发表于 2023-12-8 09:15:15

szhjb88 发表于 2023-12-8 01:09
请问用MySQL Shell接管MGR,是不是通过以下命令?

MySQLlocalhost:33060+ sslJS > var c=dba.cre ...

参考:https://mp.weixin.qq.com/s/fqI3GQjcHMBtRsUeG3AE8Q
页: [1]
查看完整版本: MySQL Router构建读写分离,提示schemadoes not exist.