当redis 中为空时,两个topic均能订阅上,此时应该是走到了default配置
127.0.0.1:6379> keys *
(empty list or set)
127.0.0.1:6379>
2021-05-24 10:01:32.512 [debug] 10.176.118.154:49851 [MQTT] RECV <<16,235,1,0,4,77,81,84,84,4,194,0,100,0,4,103,116,106,97,0,4,121,100,112,116,0,211,101,121,74,104,98,71,99,105,79,105,74,73,85,122,73,49,78,105,73,115,73,110,82,53,99,67,73,54,73,107,112,88,86,67,74,57,46,101,121,74,107,89,88,82,104,73,106,112,55,73,109,70,49,100,71,104,118,99,105,73,54,73,110,100,112,100,110,100,112,100,105,73,115,73,110,78,112,100,71,85,105,79,105,74,111,100,72,82,119,99,122,111,118,76,51,100,112,100,110,100,112,100,105,53,106,98,50,48,105,102,83,119,105,90,88,104,119,73,106,111,120,78,84,103,121,77,106,85,49,77,122,89,119,78,106,81,121,77,68,65,119,77,67,119,105,97,87,70,48,73,106,111,120,78,84,103,121,77,106,85,49,77,122,89,119,102,81,46,70,100,121,65,120,50,102,89,97,104,109,54,104,51,103,52,55,109,56,56,116,116,121,73,78,122,112,116,122,75,121,95,115,112,101,105,109,121,85,99,109,97,52>>
2021-05-24 10:01:32.513 [debug] 10.176.118.154:49851 [MQTT] RECV CONNECT(Q0, R0, D0, ClientId=gtja, ProtoName=MQTT, ProtoVsn=4, CleanStart=true, KeepAlive=100, Username=ydpt, Password=******)
2021-05-24 10:01:32.514 [debug] <<"gtja">>@10.176.118.154:49851 [MQTT] SEND CONNACK(Q0, R0, D0, AckFlags=0, ReasonCode=0)
2021-05-24 10:01:32.518 [debug] <<"gtja">>@10.176.118.154:49851 [MQTT] RECV <<130,9,0,1,0,4,116,101,115,116,1,130,14,0,2,0,9,116,101,115,116,47,103,116,106,97,1>>
2021-05-24 10:01:32.518 [debug] <<"gtja">>@10.176.118.154:49851 [MQTT] RECV SUBSCRIBE(Q1, R0, D0, PacketId=1, TopicFilters=[{<<"test">>,#{nl => 0,qos => 1,rap => 0,rh => 0}}])
2021-05-24 10:01:32.520 [debug] <<"gtja">>@10.176.118.154:49851 [MQTT] RECV SUBSCRIBE(Q1, R0, D0, PacketId=2, TopicFilters=[{<<"test/gtja">>,#{nl => 0,qos => 1,rap => 0,rh => 0}}])
2021-05-24 10:01:32.522 [debug] <<"gtja">>@10.176.118.154:49851 [MQTT] SEND SUBACK(Q0, R0, D0, PacketId=1, ReasonCodes=[1])
2021-05-24 10:01:32.522 [debug] <<"gtja">>@10.176.118.154:49851 [MQTT] SEND SUBACK(Q0, R0, D0, PacketId=2, ReasonCodes=[1])
当redis中增加ACL规则时,只能订阅匹配的topic,"test"这个topic就订阅不上了
127.0.0.1:6379> HSET mqtt_acl:gtja test/gtja 1
(integer) 1
127.0.0.1:6379> HGETALL mqtt_acl:gtja
1) "test/gtja"
2) "1"
127.0.0.1:6379>
2021-05-24 10:05:43.955 [debug] 10.176.118.154:49880 [MQTT] RECV <<16,235,1,0,4,77,81,84,84,4,194,0,100,0,4,103,116,106,97,0,4,121,100,112,116,0,211,101,121,74,104,98,71,99,105,79,105,74,73,85,122,73,49,78,105,73,115,73,110,82,53,99,67,73,54,73,107,112,88,86,67,74,57,46,101,121,74,107,89,88,82,104,73,106,112,55,73,109,70,49,100,71,104,118,99,105,73,54,73,110,100,112,100,110,100,112,100,105,73,115,73,110,78,112,100,71,85,105,79,105,74,111,100,72,82,119,99,122,111,118,76,51,100,112,100,110,100,112,100,105,53,106,98,50,48,105,102,83,119,105,90,88,104,119,73,106,111,120,78,84,103,121,77,106,85,49,77,122,89,119,78,106,81,121,77,68,65,119,77,67,119,105,97,87,70,48,73,106,111,120,78,84,103,121,77,106,85,49,77,122,89,119,102,81,46,70,100,121,65,120,50,102,89,97,104,109,54,104,51,103,52,55,109,56,56,116,116,121,73,78,122,112,116,122,75,121,95,115,112,101,105,109,121,85,99,109,97,52>>
2021-05-24 10:05:43.956 [debug] 10.176.118.154:49880 [MQTT] RECV CONNECT(Q0, R0, D0, ClientId=gtja, ProtoName=MQTT, ProtoVsn=4, CleanStart=true, KeepAlive=100, Username=ydpt, Password=******)
2021-05-24 10:05:43.958 [debug] <<"gtja">>@10.176.118.154:49880 [MQTT] SEND CONNACK(Q0, R0, D0, AckFlags=0, ReasonCode=0)
2021-05-24 10:05:43.961 [debug] <<"gtja">>@10.176.118.154:49880 [MQTT] RECV <<130,9,0,1,0,4,116,101,115,116,1>>
2021-05-24 10:05:43.961 [debug] <<"gtja">>@10.176.118.154:49880 [MQTT] RECV SUBSCRIBE(Q1, R0, D0, PacketId=1, TopicFilters=[{<<"test">>,#{nl => 0,qos => 1,rap => 0,rh => 0}}])
2021-05-24 10:05:43.963 [debug] <<"gtja">>@10.176.118.154:49880 [MQTT] SEND SUBACK(Q0, R0, D0, PacketId=1, ReasonCodes=[128])
2021-05-24 10:05:43.963 [debug] <<"gtja">>@10.176.118.154:49880 [MQTT] RECV <<130,14,0,2,0,9,116,101,115,116,47,103,116,106,97,1>>
2021-05-24 10:05:43.964 [debug] <<"gtja">>@10.176.118.154:49880 [MQTT] RECV SUBSCRIBE(Q1, R0, D0, PacketId=2, TopicFilters=[{<<"test/gtja">>,#{nl => 0,qos => 1,rap => 0,rh => 0}}])
2021-05-24 10:05:43.965 [debug] <<"gtja">>@10.176.118.154:49880 [MQTT] SEND SUBACK(Q0, R0, D0, PacketId=2, ReasonCodes=[1])
启动的modules和plugins如下:
[root@publish data]# cat loaded_plugins
emqx_management.
emqx_recon.
emqx_rule_engine.
emqx_dashboard.
emqx_retainer.
emqx_auth_jwt.
{emqx_auth_redis,true}.
[root@publish data]# cat loaded_modules
{emqx_mod_delayed,false}.
{emqx_mod_topic_metrics,false}.
{emqx_mod_subscription,false}.
{emqx_mod_acl_internal,true}.
{emqx_mod_rewrite,false}.
{emqx_mod_presence,true}.