EMQ 问答社区

使用Client ID 认证,经常出现验证信息被删

问题描述

使用Client ID 认证,会出现验证信息莫名其妙被删的情况,导致客户端无法再连接上

环境信息

  • EMQ X 版本:4.2.2
  • 操作系统及版本:CentOS Linux release 7.7.1908 (Core)
  • 其他: 内核版本Linux 3.10.0-1062.18.1.el7.x86_64

配置文件及日志

2021-05-19 20:40:45.735 [debug] <<"1918BD00035F">>@39.144.11.202:23451 [MQTT] RECV PUBLISH(Q1, R0, D0, Topic=BGT1/1918BD00035F/PeriodReportBin, PacketId=13846, Payload=<<192,57,0,1,2,0,189,0,3,95,20,1,1,1,1,6,54,22,16,0,1,159,11,231,20,43,194,43,194,43,194,43,194,43,195,141,6,7,33,251,200,1,235,14,145,0,0,0,27,96,165,7,79,96,164,183,165,232,25>>)
2021-05-19 20:40:45.735 [info] <<"1918BD00035F">>@39.144.11.202:23451 PUBLISH to BGT1/1918BD00035F/PeriodReportBin: <<192,57,0,1,2,0,189,0,3,95,20,1,1,1,1,6,54,22,16,0,1,159,11,231,20,43,194,43,194,43,194,43,194,43,195,141,6,7,33,251,200,1,235,14,145,0,0,0,27,96,165,7,79,96,164,183,165,232,25>>
2021-05-19 20:40:45.736 [debug] <<"1918BD00035F">>@39.144.11.202:23451 [MQTT] SEND PUBACK(Q0, R0, D0, PacketId=13846, ReasonCode=0)
2021-05-19 20:40:45.736 [debug] <<"open212192.168.0.212">>@221.224.213.228:37044 [MQTT] SEND PUBLISH(Q1, R0, D0, Topic=BGT1/1918BD00035F/PeriodReportBin, PacketId=58986, Payload=<<192,57,0,1,2,0,189,0,3,95,20,1,1,1,1,6,54,22,16,0,1,159,11,231,20,43,194,43,194,43,194,43,194,43,195,141,6,7,33,251,200,1,235,14,145,0,0,0,27,96,165,7,79,96,164,183,165,232,25>>)
2021-05-19 20:40:45.736 [debug] <<"cloud_pre_172.16.166.79">>@47.114.177.143:50298 [MQTT] SEND PUBLISH(Q1, R0, D0, Topic=BGT1/1918BD00035F/PeriodReportBin, PacketId=23164, Payload=<<192,57,0,1,2,0,189,0,3,95,20,1,1,1,1,6,54,22,16,0,1,159,11,231,20,43,194,43,194,43,194,43,194,43,195,141,6,7,33,251,200,1,235,14,145,0,0,0,27,96,165,7,79,96,164,183,165,232,25>>)
2021-05-19 20:41:19.257 [debug] 39.144.2.100:20683 [MQTT] RECV CONNECT(Q0, R0, D0, ClientId=1918BD00035F, ProtoName=MQTT, ProtoVsn=4, CleanStart=true, KeepAlive=300, Username=1918BD00035F, Password=******)
2021-05-19 20:41:19.257 [warning] <<"1918BD00035F">>@39.144.2.100:20683 [Channel] Client 1918BD00035F (Username: '1918BD00035F') login failed for not_authorized
2021-05-19 20:41:19.257 [debug] <<"1918BD00035F">>@39.144.2.100:20683 [MQTT] SEND CONNACK(Q0, R0, D0, AckFlags=0, ReasonCode=5)
2021-05-19 20:41:19.257 [debug] <<"1918BD00035F">>@39.144.2.100:20683 [MQTT] Terminated due to {shutdown,not_authorized}

你使用的认证插件是?

emqx_auth_clientid

目前日志中看起来1918BD00035F设备publish消息后,没有离线的信息,但是收到了 RECV CONNECT 消息,debug一下设备的情况;并检查在业务期间有没有对EMQX其他的操作

业务期间没有对emqx做其他操作的,emqx会有什么情况下,会去主动删除emqx_auth_clientid里面添加的验证信息吗

EMQ X不会自己删除设备认证信息,确认下你的设备行为,没有看到离线消息的日志,但是publish消息后是该设备CONNECT的消息,有点不正常

好的,感谢