KingbaseES V8R3集群运维案例之---message length (8) in slot 1 does not match with slot 0(12)故障

发布时间 2023-05-09 19:41:51作者: KINGBASE研究院

案例说明:
在KingbaseES V8R3集群在连接kingbasecluster服务(9999端口)时,出现“message length (8) in slot 1 does not match with slot 0(12)”故障,通过复现,获取故障发生的原因。故障信息如下图所示:

适用版本:
KingbaseES V8R3

集群状态:

一、配置备库sys_hba.conf文件

1、主库sys_hba.conf文件

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
host    all             all             0.0.0.0/0               md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
host    all             all             ::0/0                   md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     SYSTEM                                md5
host    replication     SYSTEM        127.0.0.1/32            md5
#host    replication     SYSTEM        ::1/128                 md5
host           all                   SYSTEM            192.168.1.101/24                 md5
host           replication           SYSTEM            192.168.1.101/24                 md5
host           all                   SYSTEM            192.168.1.102/24                 md5
host           replication           SYSTEM            192.168.1.102/24                 md5

2、备库sys_hba.conf文件
如下图所示,当备库和主库的配置不同时:

二、连接备库9999端口服务
1、备库连接9999端口服务

[kingbase@node102 bin]$ ./sys_ctl reload -D ../data
server signaled

[kingbase@node102 bin]$ ./ksql -U SYSTEM -W 123456 TEST -p 9999
ksql: ERROR:  unable to read message length
DETAIL:  message length (8) in slot 1 does not match with slot 0(12)

在备库cluster.log日志中显示:

2、主库连接9999端口服务

[kingbase@node101 bin]$ ./ksql -U SYSTEM -W 123456 TEST -p 9999
ksql (V008R003C002B0370)
Type "help" for help.

TEST=#

---如上所示,主库连接9999端口正常。

---如上所示,备库在连接9999端口服务时,出现“message length (8) in slot 1 does not match with slot 0(12)“错误,主库可以正常连接。

三、配置主库sys_hba.conf文件

1、备库sys_hba.conf文件

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
host    all             all             0.0.0.0/0               md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
host    all             all             ::0/0                   md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     SYSTEM                                md5
host    replication     SYSTEM        127.0.0.1/32            md5
#host    replication     SYSTEM        ::1/128                 md5
host           all                   SYSTEM            192.168.1.101/24                 md5
host           replication           SYSTEM            192.168.1.101/24                 md5
host           all                   SYSTEM            192.168.1.102/24                 md5
host           replication           SYSTEM            192.168.1.102/24                 md5

2、主库sys_hba.conf文件
如下图所示,配置主库与备库sys_hba.conf:

四、连接主备库的9999(kingbasecluster)服务

1、备库连接9999

[kingbase@node102 bin]$ ./ksql -U SYSTEM -W 123456 TEST -p 9999
ksql: ERROR:  unable to read message length
DETAIL:  message length (12) in slot 1 does not match with slot 0(8)

2、主库连接9999

[kingbase@node101 bin]$ ./ksql -U SYSTEM -W 123456 TEST -p 9999
ksql: ERROR:  unable to read message length
DETAIL:  message length (12) in slot 1 does not match with slot 0(8)

---如上所示,主备库连接9999端口都出现了”message length (12) in slot 1 does not match with slot 0(8)“故障信息。

五、总结
当主备库的sys_hba.conf中,对用户连接集群的认证方式不同时,将会出现”message length (12) in slot 1 does not match with slot 0(8)“的故障,在生产环境中注意集群配置文件配置,主备库配置要一致。