使用环境:
测试
zookeeper:3.8.0
shardingsphere:5.3.1
MySQL:8.0.27
尝试用DistSQL在shardingsphere里创建MySQL MGR发现规则,配置如下:
第一步:
#登录shardingsphere
create database lpc_ss;
use lpc_ss;
第二步:
REGISTER STORAGE UNIT ds_0 (
HOST="10.208.67.111",
PORT=3306,
DB="lpc_ss",
USER="xha_dba",
PASSWORD="xxx"
),ds_1 (
HOST="10.208.67.112",
PORT=3306,
DB="lpc_ss",
USER="xha_dba",
PASSWORD="xxx"
),ds_2 (
HOST="10.208.67.113",
PORT=3306,
DB="lpc_ss",
USER="xha_dba",
PASSWORD="xxx"
);
第三步:
CREATE DB_DISCOVERY RULE db_lpc_group_0 (
STORAGE_UNITS(ds_0,ds_1,ds_2),
TYPE(NAME='MySQL.MGR',PROPERTIES('group-name'='18cc1f8a-b34a-11ed-a4c1-fa163e29227d')),
HEARTBEAT(PROPERTIES('keep-alive-cron'='0/5 * * * * ?'))
);
stdout.log里直接报错:
[ERROR] 2023-03-08 14:47:09.421 [Curator-SafeNotifyService-0] c.g.common.eventbus.EventBus.default - Exception thrown by subscriber method renew(org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.config.event.rule.RuleConfigurationsChangedEvent) on subscriber org.apache.shardingsphere.mode.manager.cluster.coordinator.subscriber.ConfigurationChangedSubscriber@45acdd11 when dispatching event: org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.config.event.rule.RuleConfigurationsChangedEvent@7031dd44
java.util.concurrent.CompletionException: org.apache.shardingsphere.dbdiscovery.mysql.exception.mgr.InvalidMGRReplicationGroupMemberException: `jdbc:mysql://10.208.67.113:3306/lpc_ss` is not in MGR replication group member in database `lpc_ss`.
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1807)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.apache.shardingsphere.dbdiscovery.mysql.exception.mgr.InvalidMGRReplicationGroupMemberException: `jdbc:mysql://10.208.67.113:3306/lpc_ss` is not in MGR replication group member in database `lpc_ss`.
at org.apache.shardingsphere.dbdiscovery.mysql.type.MGRMySQLDatabaseDiscoveryProviderAlgorithm.checkMemberInstanceURL(MGRMySQLDatabaseDiscoveryProviderAlgorithm.java:133)
at org.apache.shardingsphere.dbdiscovery.mysql.type.MGRMySQLDatabaseDiscoveryProviderAlgorithm.checkSingleDataSourceEnvironment(MGRMySQLDatabaseDiscoveryProviderAlgorithm.java:102)
at org.apache.shardingsphere.dbdiscovery.mysql.type.MGRMySQLDatabaseDiscoveryProviderAlgorithm.lambda$runAsyncCheckEnvironment$0(MGRMySQLDatabaseDiscoveryProviderAlgorithm.java:88)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
... 3 common frames omitted
有什么排查思路吗?还是说我配置方式不对?
通过3306端口可以访问,group name也没问题
mysql> show variables like 'group_replication_group_name';
+------------------------------+--------------------------------------+
| Variable_name | Value |
+------------------------------+--------------------------------------+
| group_replication_group_name | 18cc1f8a-b34a-11ed-a4c1-fa163e29227d |
+------------------------------+--------------------------------------+
1 row in set (0.00 sec)