v5.0.21.conf 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. node {
  2. name = "emqx@127.0.0.1"
  3. cookie = "emqxsecretcookie"
  4. data_dir = "data"
  5. }
  6. log {
  7. file_handlers.default {
  8. level = warning
  9. file = "log/emqx.log"
  10. }
  11. }
  12. cluster {
  13. name = emqxcl
  14. discovery_strategy = manual
  15. }
  16. dashboard {
  17. listeners.http {
  18. bind = 18083
  19. }
  20. default_username = "admin"
  21. default_password = "public"
  22. }
  23. authentication = [
  24. {
  25. backend = "built_in_database"
  26. mechanism = "password_based"
  27. password_hash_algorithm {name = "sha256", salt_position = "suffix"}
  28. user_id_type = "username"
  29. },
  30. {
  31. algorithm = "hmac-based"
  32. from = "password"
  33. mechanism = "jwt"
  34. secret = "emqxsecret"
  35. "secret_base64_encoded" = false
  36. use_jwks = false
  37. },
  38. {
  39. backend = "http"
  40. body {password = "${password}", username = "${username}"}
  41. connect_timeout = "15s"
  42. enable_pipelining = 100
  43. headers {"content-type" = "application/json"}
  44. mechanism = "password_based"
  45. method = "post"
  46. pool_size = 8
  47. request_timeout = "5s"
  48. ssl {enable = false, verify = "verify_peer"}
  49. url = "http://127.0.0.1:8080"
  50. }
  51. ]
  52. authorization {
  53. cache {enable = true}
  54. deny_action = "ignore"
  55. no_match = "allow"
  56. sources = [
  57. {
  58. cmd = "HGETALL mqtt_acl:${username}"
  59. database = 0
  60. pool_size = 8
  61. redis_type = "single"
  62. server = "127.0.0.1:6379"
  63. ssl {enable = false, verify = "verify_peer"}
  64. type = "redis"
  65. },
  66. {
  67. database = "mqtt_acl"
  68. pool_size = 8
  69. query = "SELECT action, permission, topic FROM mqtt_acl where username = ${username}"
  70. server = "127.0.0.1:5432"
  71. ssl {enable = false, verify = "verify_peer"}
  72. type = "postgresql"
  73. username = "root"
  74. },
  75. {
  76. collection = "users"
  77. database = "mqtt"
  78. filter {username = "${username}"}
  79. mongo_type = "single"
  80. pool_size = 8
  81. server = "127.0.0.1:27017"
  82. ssl {enable = false, verify = "verify_peer"}
  83. topology {connect_timeout_ms = "20s"}
  84. type = "mongodb"
  85. },
  86. {
  87. database = "mqtt_acl"
  88. pool_size = 8
  89. query = "SELECT action, permission, topic FROM mqtt_acl where username = ${username}"
  90. server = "127.0.0.1:3306"
  91. ssl {enable = false, verify = "verify_peer"}
  92. type = "mysql"
  93. username = "root"
  94. },
  95. {
  96. body {username = "${username}"}
  97. connect_timeout = "15s"
  98. enable_pipelining = 100
  99. headers {"content-type" = "application/json"}
  100. method = "post"
  101. pool_size = 8
  102. request_timeout = "30s"
  103. ssl {enable = false, verify = "verify_peer"}
  104. type = "http"
  105. url = "http://127.0.0.1:8080"
  106. },
  107. {
  108. enable = true
  109. path = "etc/acl.conf"
  110. type = "file"
  111. }
  112. ]
  113. }
  114. bridges {
  115. webhook {
  116. test {
  117. connect_timeout = "15s"
  118. enable_pipelining = 100
  119. headers {"content-type" = "application/json"}
  120. method = "post"
  121. pool_size = 8
  122. pool_type = "random"
  123. request_timeout = "15s"
  124. resource_opts {
  125. async_inflight_window = 100
  126. auto_restart_interval = "60s"
  127. health_check_interval = "15s"
  128. max_queue_bytes = "1GB"
  129. query_mode = "async"
  130. request_timeout = "15s"
  131. worker_pool_size = 4
  132. }
  133. ssl {enable = false, verify = "verify_peer"}
  134. url = "http://127.0.0.1:8080/test"
  135. }
  136. }
  137. }
  138. conn_congestion {enable_alarm = true, min_alarm_sustain_duration = "1m"}
  139. delayed {enable = true, max_delayed_messages = 10}
  140. exhook {
  141. servers = [
  142. {
  143. auto_reconnect = "60s"
  144. enable = false
  145. failed_action = "deny"
  146. name = "testx"
  147. pool_size = 16
  148. request_timeout = "5s"
  149. ssl {enable = false, verify = "verify_peer"}
  150. url = "http://127.0.0.1:8080/exhook"
  151. }
  152. ]
  153. }
  154. flapping_detect {
  155. ban_time = "5m"
  156. enable = false
  157. max_count = 15
  158. window_time = "1m"
  159. }
  160. force_gc {
  161. bytes = "16MB"
  162. count = 16000
  163. enable = true
  164. }
  165. force_shutdown {
  166. enable = true
  167. max_heap_size = "32MB"
  168. max_message_queue_len = 1000
  169. }
  170. gateway {
  171. coap {
  172. connection_required = false
  173. enable_stats = true
  174. listeners {
  175. udp {
  176. default {
  177. bind = "5683"
  178. max_conn_rate = 1000
  179. max_connections = 1024000
  180. }
  181. }
  182. }
  183. mountpoint = ""
  184. notify_type = "qos"
  185. publish_qos = "coap"
  186. subscribe_qos = "coap"
  187. }
  188. exproto {
  189. enable_stats = true
  190. handler {
  191. address = "http://127.0.0.1:9001"
  192. ssl_options {enable = false}
  193. }
  194. idle_timeout = "30s"
  195. listeners {
  196. tcp {
  197. default {
  198. acceptors = 16
  199. bind = "7993"
  200. max_conn_rate = 1000
  201. max_connections = 1024000
  202. }
  203. }
  204. }
  205. mountpoint = ""
  206. server {
  207. bind = "127.0.0.1:9100"
  208. ssl_options {verify = "verify_none"}
  209. }
  210. }
  211. "lwm2m" {
  212. auto_observe = true
  213. enable_stats = true
  214. idle_timeout = "30s"
  215. lifetime_max = "86400s"
  216. lifetime_min = "1s"
  217. listeners {
  218. udp {
  219. default {
  220. bind = "5783"
  221. max_conn_rate = 1000
  222. max_connections = 1024000
  223. }
  224. }
  225. }
  226. mountpoint = ""
  227. qmode_time_window = "22s"
  228. translators {
  229. command {qos = 0, topic = "dn/#"}
  230. notify {qos = 0, topic = "up/notify"}
  231. register {qos = 0, topic = "up/resp"}
  232. response {qos = 0, topic = "up/resp"}
  233. update {qos = 0, topic = "up/update"}
  234. }
  235. update_msg_publish_condition = "contains_object_list"
  236. xml_dir = "etc/lwm2m_xml/"
  237. }
  238. mqttsn {
  239. broadcast = true
  240. "enable_qos3" = true
  241. enable_stats = true
  242. gateway_id = 1
  243. idle_timeout = "30s"
  244. listeners {
  245. udp {
  246. default {
  247. bind = "1884"
  248. max_conn_rate = 1000
  249. max_connections = 1024000
  250. }
  251. }
  252. }
  253. mountpoint = ""
  254. predefined = []
  255. }
  256. stomp {
  257. enable_stats = true
  258. frame {
  259. max_body_length = 8192
  260. max_headers = 10
  261. max_headers_length = 1024
  262. }
  263. idle_timeout = "30s"
  264. listeners {
  265. tcp {
  266. default {
  267. bind = "61613"
  268. max_conn_rate = 1000
  269. max_connections = 1024000
  270. }
  271. }
  272. }
  273. mountpoint = ""
  274. }
  275. }
  276. listeners {
  277. ssl {
  278. default {
  279. bind = "0.0.0.0:8883"
  280. max_connections = 512000
  281. ssl_options {
  282. cacertfile = "etc/certs/cacert.pem"
  283. certfile = "etc/certs/cert.pem"
  284. keyfile = "etc/certs/key.pem"
  285. }
  286. }
  287. }
  288. tcp {
  289. default {
  290. acceptors = 32
  291. bind = "0.0.0.0:1883"
  292. enable_authn = true
  293. enabled = true
  294. limiter {
  295. bytes_in {
  296. capacity = "infinity"
  297. initial = "0"
  298. rate = "infinity"
  299. }
  300. client {
  301. bytes_in {
  302. capacity = "infinity"
  303. divisible = false
  304. failure_strategy = "force"
  305. initial = "0"
  306. low_watermark = "0"
  307. max_retry_time = "10s"
  308. rate = "infinity"
  309. }
  310. connection {
  311. capacity = "infinity"
  312. divisible = false
  313. failure_strategy = "force"
  314. initial = "0"
  315. low_watermark = "0"
  316. max_retry_time = "10s"
  317. rate = "infinity"
  318. }
  319. message_in {
  320. capacity = "infinity"
  321. divisible = false
  322. failure_strategy = "force"
  323. initial = "0"
  324. low_watermark = "0"
  325. max_retry_time = "10s"
  326. rate = "infinity"
  327. }
  328. message_routing {
  329. capacity = "infinity"
  330. divisible = false
  331. failure_strategy = "force"
  332. initial = "0"
  333. low_watermark = "0"
  334. max_retry_time = "10s"
  335. rate = "infinity"
  336. }
  337. }
  338. connection {
  339. capacity = "1000"
  340. initial = "0"
  341. rate = "1000/s"
  342. }
  343. message_in {
  344. capacity = "infinity"
  345. initial = "0"
  346. rate = "infinity"
  347. }
  348. message_routing {
  349. capacity = "infinity"
  350. initial = "0"
  351. rate = "infinity"
  352. }
  353. }
  354. max_connections = 1024000
  355. proxy_protocol = false
  356. proxy_protocol_timeout = "3s"
  357. tcp_options {
  358. active_n = 100
  359. backlog = 1024
  360. buffer = "4KB"
  361. high_watermark = "1MB"
  362. nodelay = true
  363. reuseaddr = true
  364. send_timeout = "15s"
  365. send_timeout_close = true
  366. }
  367. zone = "default"
  368. }
  369. }
  370. ws {
  371. default {
  372. bind = "0.0.0.0:8083"
  373. max_connections = 1024000
  374. websocket {mqtt_path = "/mqtt"}
  375. }
  376. }
  377. wss {
  378. default {
  379. bind = "0.0.0.0:8084"
  380. max_connections = 512000
  381. ssl_options {
  382. cacertfile = "etc/certs/cacert.pem"
  383. certfile = "etc/certs/cert.pem"
  384. keyfile = "etc/certs/key.pem"
  385. }
  386. websocket {mqtt_path = "/mqtt"}
  387. }
  388. }
  389. }
  390. mqtt {
  391. await_rel_timeout = "300s"
  392. exclusive_subscription = false
  393. idle_timeout = "15s"
  394. ignore_loop_deliver = false
  395. keepalive_backoff = 0.75
  396. max_awaiting_rel = 100
  397. max_clientid_len = 65535
  398. max_inflight = 320
  399. max_mqueue_len = 1000
  400. max_packet_size = "10MB"
  401. max_qos_allowed = 2
  402. max_subscriptions = "infinity"
  403. max_topic_alias = 65535
  404. max_topic_levels = 128
  405. mqueue_default_priority = "lowest"
  406. mqueue_priorities = "disabled"
  407. "mqueue_store_qos0" = true
  408. peer_cert_as_clientid = "disabled"
  409. peer_cert_as_username = "disabled"
  410. response_information = ""
  411. retain_available = true
  412. retry_interval = "30s"
  413. server_keepalive = "disabled"
  414. session_expiry_interval = "2h"
  415. shared_subscription = true
  416. strict_mode = false
  417. upgrade_qos = false
  418. use_username_as_clientid = false
  419. wildcard_subscription = true
  420. }
  421. overload_protection {
  422. backoff_delay = 1
  423. backoff_gc = false
  424. backoff_hibernation = true
  425. backoff_new_conn = true
  426. enable = false
  427. }
  428. retainer {
  429. backend {
  430. index_specs = [
  431. [1, 2, 3],
  432. [1, 3],
  433. [2, 3],
  434. [3]
  435. ]
  436. max_retained_messages = 0
  437. storage_type = "ram"
  438. type = "built_in_database"
  439. }
  440. enable = true
  441. flow_control {
  442. batch_deliver_limiter {
  443. capacity = "infinity"
  444. client {
  445. capacity = "infinity"
  446. divisible = false
  447. failure_strategy = "force"
  448. initial = "0"
  449. low_watermark = "0"
  450. max_retry_time = "10s"
  451. rate = "infinity"
  452. }
  453. initial = "0"
  454. rate = "infinity"
  455. }
  456. batch_deliver_number = 0
  457. batch_read_number = 0
  458. }
  459. max_payload_size = "10MB"
  460. msg_clear_interval = "0s"
  461. msg_expiry_interval = "0s"
  462. stop_publish_clear_msg = false
  463. }
  464. rule_engine {
  465. ignore_sys_message = true
  466. jq_function_default_timeout = "10s"
  467. jq_implementation_module = "jq_nif"
  468. rules {
  469. rule_plna {
  470. actions = ["webhook:test"]
  471. description = ""
  472. metadata {created_at = 1684226199152}
  473. sql = "SELECT\n *\nFROM\n \"t/#\""
  474. }
  475. }
  476. }
  477. slow_subs {
  478. enable = true
  479. expire_interval = "300s"
  480. stats_type = "whole"
  481. threshold = "500ms"
  482. top_k_num = 10
  483. }
  484. stats {enable = true}
  485. sys_topics {
  486. sys_event_messages {
  487. client_connected = true
  488. client_disconnected = true
  489. client_subscribed = true
  490. client_unsubscribed = true
  491. }
  492. sys_heartbeat_interval = "30s"
  493. sys_msg_interval = "1m"
  494. }