listeners.tcp.conf.example 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. ## false to disable this
  11. enable = true
  12. ## Port or Address to listen on
  13. bind = 1883 ## or with an IP e.g. "127.0.0.1:1883"
  14. ## Enable the Proxy Protocol V1/2 if the EMQX cluster is deployed behind HAProxy or Nginx
  15. proxy_protocol = false
  16. ## Timeout for proxy protocol
  17. proxy_protocol_timeout = 8
  18. ## When publishing or subscribing, prefix all topics with a mountpoint string
  19. mountpoint = "mqtt" ## Do not set this unless you know what is it for
  20. ## Client authentication
  21. ## Type:
  22. ## - true :: enable
  23. ## - false :: disable
  24. ## - quick_deny_anonymous :: denied immediately without if username is not provided
  25. enable_authn = true
  26. ## The access control rules for this listener
  27. ## Type: See: https://github.com/emqtt/esockd#allowdeny
  28. access_rules = ["allow all"]
  29. ## Socket acceptor pool size for TCP protocols
  30. acceptors = 16
  31. ## Maximum number of simultaneous connections
  32. ## Type: infinity | Integer
  33. max_connections = infinity
  34. ## TCP backlog defines the maximum length that the queue of pending connections can grow to
  35. backlog = 1024
  36. ## The TCP send timeout for the connections
  37. send_timeout = 15s
  38. ## Timeout for proxy protocol
  39. send_timeout_close = true
  40. ## The TCP receive buffer (OS kernel) for the connections
  41. recbuf = 2KB
  42. ## The TCP send buffer (OS kernel) for the connections
  43. sndbuf = 4KB
  44. ## The size of the user-space buffer used by the driver
  45. buffer = 4KB
  46. ## The socket is set to a busy state when the amount of data queued internally by the VM socket implementation reaches this limit
  47. high_watermark = 1MB
  48. ## The TCP_NODELAY flag for the connections
  49. nodelay = true
  50. ## The SO_REUSEADDR flag for the connections
  51. reuseaddr = true
  52. ## Enable TCP keepalive for MQTT connections over TCP or SSL
  53. ## Type: three comma separated numbers in the format of 'Idle,Interval,Probes'
  54. ## - Idle: The number of seconds a connection needs to be idle before the server begins to send out keep-alive probes (Linux default 7200).
  55. ## - Interval: The number of seconds between TCP keep-alive probes (Linux default 75).
  56. ## - 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).
  57. ## 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
  58. keepalive = "none"
  59. }