Skip to content

request help: mqtt-proxy plugin cannot work #5909

Description

@weey007

Issue description

my apixis verison is: 2.11.0
my os version is : CentOS Linux release 8.1.1911 (Core)

I have turned on the stream_proxy function,as follow:

     stream_proxy:				 
      only: false				  
      tcp:					
       - 9100    

mqtt-proxy plugin config as follow:

{
  "plugins": {
    "mqtt-proxy": {
      "protocol_name": "MQTT",
      "protocol_level": 5,
      "upstream": {
        "host": "broker-cn.emqx.io",
        "port": 1883,
        "weight": 1
      }
    }
  }
}

But we access the mqtt proxy service and report an error,our access script as follow:

mqtt pub -h 127.0.0.1 -p 9100 -t "MQTT Examples" -m "a msg" -i "clintxxx-001" -d

respone is:

PUBLISH: Server closed connection without DISCONNECT

but My direct visit without apisix can be successful

mqtt pub -h broker-cn.emqx.io -p 1883 -t "MQTT Examples" -m "a msg" -i "clint-111" -d

resp is:

CLIENT clint-111: sending CONNECT
CLIENT clint-111: received CONNACK SUCCESS
CLIENT clint-111: sending PUBLISH: (Topic: MQTT Examples, QoS AT_MOST_ONCE, Message: 'a msg')
CLIENT clint-111: acknowledged PUBLISH: 'a msg' for PUBLISH to Topic:  MQTT Examples

and the error log as follow, These warn logs are output every second

021/12/24 10:58:51 [warn] 6727#6727: *10443643 stream [lua] mqtt-proxy.lua:123: phase_func(): plugin rewrite phase, conf: {"upstream":{"weight":1,"host":"broker-cn.emqx.io","port":1883},"protocol_name":"MQTT","protocol_level":5} while prereading client data, client: 100.127.12.66, server: 0.0.0.0:9100
2021/12/24 10:58:52 [warn] 6728#6728: *10443750 stream [lua] mqtt-proxy.lua:123: phase_func(): plugin rewrite phase, conf: {"upstream":{"weight":1,"host":"broker-cn.emqx.io","port":1883},"protocol_name":"MQTT","protocol_level":5} while prereading client data, client: 100.127.13.3, server: 0.0.0.0:9100
2021/12/24 10:58:53 [warn] 6727#6727: *10443801 stream [lua] mqtt-proxy.lua:123: phase_func(): plugin rewrite phase, conf: {"upstream":{"weight":1,"host":"broker-cn.emqx.io","port":1883},"protocol_name":"MQTT","protocol_level":5} while prereading client data, client: 100.127.12.66, server: 0.0.0.0:9100
2021/12/24 10:58:55 [warn] 6728#6728: *10443941 stream [lua] mqtt-proxy.lua:123: phase_func(): plugin rewrite phase, conf: {"upstream":{"weight":1,"host":"broker-cn.emqx.io","port":1883},"protocol_name":"MQTT","protocol_level":5} while prereading client data, client: 100.127.12.66, server: 0.0.0.0:9100
2021/12/24 10:58:56 [warn] 6728#6728: *10444049 stream [lua] mqtt-proxy.lua:123: phase_func(): plugin rewrite phase, conf: {"upstream":{"weight":1,"host":"broker-cn.emqx.io","port":1883},"protocol_name":"MQTT","protocol_level":5} while prereading client data, client: 100.127.13.3, server: 0.0.0.0:9100
2021/12/24 10:58:59 [warn] 6729#6729: *10444240 stream [lua] mqtt-proxy.lua:123: phase_func(): plugin rewrite phase, conf: {"upstream":{"weight":1,"host":"broker-cn.emqx.io","port":1883},"protocol_name":"MQTT","protocol_level":5} while prereading client data, client: 100.127.12.66, server: 0.0.0.0:9100
2021/12/24 10:59:00 [warn] 6728#6728: *10444340 stream [lua] mqtt-proxy.lua:123: phase_func(): plugin rewrite phase, conf: {"upstream":{"weight":1,"host":"broker-cn.emqx.io","port":1883},"protocol_name":"MQTT","protocol_level":5} while prereading client data, client: 100.127.13.3, server: 0.0.0.0:9100
2021/12/24 10:59:01 [warn] 6729#6729: *10444382 stream [lua] mqtt-proxy.lua:123: phase_func(): plugin rewrite phase, conf: {"upstream":{"weight":1,"host":"broker-cn.emqx.io","port":1883},"protocol_name":"MQTT","protocol_level":5} while prereading client data, client: 100.127.12.66, server: 0.0.0.0:9100
...

when i delete the mqtt-proxy config ,the warn log in error.log stop

Environment

  • apisix version (cmd: apisix version): 2.11.0
  • OS (cmd: uname -a): CentOS Linux release 8.1.1911 (Core) x86_64 x86_64 x86_64 GNU/Linux
  • OpenResty / Nginx version (cmd: nginx -V or openresty -V): nginx version: openresty/1.19.9.1
  • etcd version, if have (cmd: run curl http://127.0.0.1:9090/v1/server_info to get the info from server-info API): 3.5.0
  • apisix-dashboard version, if have:
  • the plugin runner version, if the issue is about a plugin runner (cmd: depended on the kind of runner):
  • luarocks version, if the issue is about installation (cmd: luarocks --version):

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions