lb8125 发表于 2024-2-27 21:31:22

MGR 配置第二节点用户显示只读

第二节点创建用户时提示只读,在安装文档中提到“重启GreatSQL实例后(report-host 是只读选项,需要重启才能生效),创建MGR服务专用账号及配置MGR服务通道:” ,重启该怎么操作?

mysql> select * from performance_schema.replication_group_members;
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+----------------------------+
| CHANNEL_NAME            | MEMBER_ID                            | MEMBER_HOST   | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK |
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+----------------------------+
| group_replication_applier | 960fbf06-ce2e-11ee-84b4-000c29759f14 | 192.168.2.182 |      3306 | ERROR      |             | 8.0.32         | XCom                     |
| group_replication_applier | 9ff7b4bd-ce2e-11ee-b76e-000c29721c48 | 192.168.2.181 |      3306 | ONLINE       | PRIMARY   | 8.0.32         | XCom                     |
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+----------------------------+
2 rows in set (0.00 sec)
mysql> set session sql_log_bin=0;
Query OK, 0 rows affected (0.00 sec)
mysql> create user repl@'%' identified with mysql_native_password by 'repl';
ERROR 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement
mysql> select * from performance_schema.replication_group_members;
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+----------------------------+
| CHANNEL_NAME            | MEMBER_ID                            | MEMBER_HOST   | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION | MEMBER_COMMUNICATION_STACK |

+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+----------------------------+
| group_replication_applier | 960fbf06-ce2e-11ee-84b4-000c29759f14 | 192.168.2.182 |      3306 | ERROR      |             | 8.0.32         | XCom                     |
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+----------------------------+
1 row in set (0.00 sec)


另外第二个节点还需要设置如下两条吗?
SET GLOBAL group_replication_group_seeds= "192.168.2.181:33061,192.168.2.182:33061,192.168.2.183:33061";

SET GLOBAL group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa1";



my.cnf 配置如下:
# cat /etc/my.cnf

user = mysql
basedir=/usr/local/GreatSQL-8.0.32-25-Linux-glibc2.28-x86_64
datadir=/data/GreatSQL
port=3306
server_id=33062
log-bin
log_slave_updates=1
gtid_mode=ON
enforce_gtid_consistency=ON
log_error = /data/GreatSQL/error.log
plugin_load_add='group_replication.so'
group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa1"
group_replication_local_address= "192.168.2.182:33061"
group_replication_group_seeds= "192.168.2.181:33061,192.168.2.182:33061,192.168.2.183:33061"
report-host=192.168.2.182

yejr 发表于 2024-2-28 09:12:43

参考这篇文档用MySQL Shell构建MGR:https://greatsql.cn/docs/8032-25/user-manual/4-install-guide/2-install-with-rpm.html#_9-%E5%87%86%E5%A4%87%E6%9E%84%E5%BB%BAmgr%E9%9B%86%E7%BE%A4

也可以用手工方式部署:https://gitee.com/GreatSQL/GreatSQL-Doc/blob/master/deep-dive-mgr/deep-dive-mgr-03.md

创建MGR专属用户、修改report-host这些都应该在启动MGR服务前先准备好,而不是等MGR服务启动后再创建用户。启动MGR服务后,如果是非primary节点,都默认是read only保护状态。
页: [1]
查看完整版本: MGR 配置第二节点用户显示只读