listeners.tcp.conf.example 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. ##--------------------------------------------------------------------
  2. ## TCP Listener
  3. ##
  4. ## Add a TCP Listener
  5. ##--------------------------------------------------------------------
  6. ## Note: This is an example of how to configure this feature
  7. ## you should copy and paste the below data into the emqx.conf for working
  8. ## Note: Modifying the 'tcpname' to what you need
  9. listeners.tcp.tcpname {
  10. ## Port or Address to listen on, 0 means disable
  11. bind = 1883 ## or with an IP e.g. "127.0.0.1:1883"
  12. ## Enable the Proxy Protocol V1/2 if the EMQX cluster is deployed behind HAProxy or Nginx
  13. proxy_protocol = false
  14. ## Timeout for proxy protocol
  15. proxy_protocol_timeout = 8
  16. ## When publishing or subscribing, prefix all topics with a mountpoint string
  17. mountpoint = "mqtt" ## Do not set this unless you know what is it for
  18. ## Client authentication
  19. ## Type:
  20. ## - true :: enable
  21. ## - false :: disable
  22. ## - quick_deny_anonymous :: denied immediately without if username is not provided
  23. enable_authn = true
  24. ## The access control rules for this listener
  25. ## Type: See: https://github.com/emqtt/esockd#allowdeny
  26. access_rules = ["allow all"]
  27. ## Socket acceptor pool size for TCP protocols
  28. acceptors = 16
  29. ## Maximum number of simultaneous connections
  30. ## Type: infinity | Integer
  31. max_connections = infinity
  32. tcp_options {
  33. ## TCP backlog defines the maximum length that the queue of pending connections can grow to
  34. backlog = 1024
  35. ## The TCP send timeout for the connections
  36. send_timeout = 15s
  37. ## Timeout for proxy protocol
  38. send_timeout_close = true
  39. ## The TCP receive buffer (OS kernel) for the connections
  40. recbuf = 2KB
  41. ## The TCP send buffer (OS kernel) for the connections
  42. sndbuf = 4KB
  43. ## The size of the user-space buffer used by the driver
  44. buffer = 4KB
  45. ## The socket is set to a busy state when the amount of data queued internally by the VM socket implementation reaches this limit
  46. high_watermark = 1MB
  47. ## The TCP_NODELAY flag for the connections
  48. nodelay = true
  49. ## The SO_REUSEADDR flag for the connections
  50. reuseaddr = true
  51. ## Enable TCP keepalive for MQTT connections over TCP or SSL
  52. ## Type: three comma separated numbers in the format of 'Idle,Interval,Probes'
  53. ## - Idle: The number of seconds a connection needs to be idle before the server begins to send out keep-alive probes (Linux default 7200).
  54. ## - Interval: The number of seconds between TCP keep-alive probes (Linux default 75).
  55. ## - Probes: The maximum number of TCP keep-alive probes to send before giving up and killing the connection if no response is obtained from the other end (Linux default 9).
  56. ## For example "240,30,5" means: EMQX should start sending TCP keepalive probes after the connection is in idle for 240 seconds, and the probes are sent every 30 seconds until a response is received from the MQTT client, if it misses 5 consecutive responses, EMQX should close the connection
  57. keepalive = "none"
  58. }
  59. }