GreatSQL社区

搜索

[已解决] MySQL Router构建读写分离,提示schemadoes not exist.

288 5 2023-12-3 17:53
各位好,

GreatSQL MGR集群使用ansible一键部署,然后再参照https://gitee.com/GreatSQL/Great ... 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- ... innodb-cluster.html for instructions on setting up a MySQL Server to act as an InnoDB Cluster Metadata server


请问怎么解决该问题?谢谢大家!
全部回复(5)
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,是不是通过以下命令?

MySQL  localhost:33060+ ssl  JS > 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/n]: 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,是不是通过以下命令?

MySQL  localhost:33060+ ssl  JS > 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,是不是通过以下命令?

MySQL  localhost:33060+ ssl  JS > var c=dba.cre ...

参考:https://mp.weixin.qq.com/s/fqI3GQjcHMBtRsUeG3AE8Q
szhjb88

3

主题

0

博客

15

贡献

新手上路

Rank: 1

积分
26

合作电话:010-64087828

社区邮箱:greatsql@greatdb.com

社区公众号
社区小助手
QQ群
GMT+8, 2024-3-3 00:57 , Processed in 0.018078 second(s), 13 queries , Redis On.
快速回复 返回顶部 返回列表