{"id":25581,"date":"2025-04-19T13:06:19","date_gmt":"2025-04-19T05:06:19","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/25581.html"},"modified":"2025-04-19T13:06:19","modified_gmt":"2025-04-19T05:06:19","slug":"emqx%e7%89%a9%e8%81%94%e7%bd%91mqtt%e6%b6%88%e6%81%af%e6%9c%8d%e5%8a%a1%e5%99%a8%e9%9b%86%e7%be%a4%e6%90%ad%e5%bb%ba","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/25581.html","title":{"rendered":"EMQX\u7269\u8054\u7f51MQTT\u6d88\u606f\u670d\u52a1\u5668\u96c6\u7fa4\u642d\u5efa"},"content":{"rendered":"<h3>EMQX\u5b98\u65b9\u4ecb\u7ecd<\/h3>\n<h3>1 \u73af\u5883\u51c6\u5907<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4e24\u53f0Ubuntu 20.04\u00a0\u4f5c\u4e3aEMQX\u8282\u70b9<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4e00\u53f0Ubuntu 20.04\u5b89\u88c5MYSQL\u6570\u636e\u5e93<\/p>\n<h3 style=\"text-align:left\">2 \u642d\u5efaEMQX\u96c6\u7fa4<\/h3>\n<h4 style=\"text-align:left\">2.1 \u4e0b\u8f7dEMQX\u5f00\u6e90\u7248\u5b89\u88c5\u5305<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">1\u8bbf\u95eehttps:\/\/www.emqx.com\/zh\/try?product&#061;broker&#xff0c;\u9009\u62e9\u5bf9\u5e94\u7684EMQX\u7248\u672c<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050613-68032f45cb5ef.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">2 \u70b9\u51fb\u514d\u8d39\u4e0b\u8f7d&#xff0c;\u9009\u62e9\u5b89\u88c5\u65b9\u5f0f\u548cCPU\u67b6\u6784<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050614-68032f4683f03.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">3 \u4e0b\u8f7dEMQX\u5b89\u88c5\u5305\u5e76\u89e3\u538b<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u4e0b\u8f7dEMQX\u5b89\u88c5\u5305<\/p>\n<p>\u200b<br \/>\nwget https:\/\/www.emqx.com\/zh\/downloads\/broker\/4.4.5\/emqx-4.4.5-otp24.1.5-3-ubuntu20.04-amd64.zip <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u89e3\u538b\u5b89\u88c5\u5305<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050614-68032f46f3fc1.png\" \/><\/p>\n<h4 style=\"text-align:left\">2.2 \u4fee\u6539EMQX\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5b89\u88c5\u5305\u89e3\u538b\u540e\u8fdb\u5165emqx\u6587\u4ef6\u5939<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050615-68032f471c8d2.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4fee\u6539emqx.conf\u6587\u4ef6<\/p>\n<p>vim etc\/emqx.conf <\/p>\n<p style=\"text-align:justify\">&#xff08;1&#xff09;\u4fee\u6539\u8282\u70b9\u540d\u79f0<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8282\u70b91 node.name&#061;emqx1&#064;IP<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8282\u70b92 node.name&#061;emqx2&#064;IP<\/p>\n<p style=\"text-align:justify\">&#xff08;2&#xff09;\u4fee\u6539\u521b\u5efa\u96c6\u7fa4\u65b9\u5f0f<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u65b9\u5f0f\u4e00&#xff1a;\u4f7f\u7528 static\u6a21\u5f0f<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6839\u636e\u8282\u70b9\u5217\u8868\u81ea\u52a8\u521b\u5efa\u96c6\u7fa4<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4fee\u6539cluster.discovery &#061; static<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4fee\u6539cluster.static.seeds &#061; emqx1&#064;IP,emqx2&#064;IP&#xff08;\u591a\u4e2a\u8282\u70b9\u4ee5\u9017\u53f7\u5206\u5272&#xff09;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4fee\u6539\u5b8c\u6210\u540e\u4fdd\u5b58<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u65b9\u5f0f\u4e8c&#xff1a;<span style=\"background-color:#ffffff\"><span style=\"color:#343741\">\u624b\u52a8(manual) \u65b9\u5f0f\u7ba1\u7406\u96c6\u7fa4<\/span><\/span><\/p>\n<p># \u914d\u7f6e\u96c6\u7fa4\u540d\u79f0<br \/>\ncluster.name &#061; emqxcl<br \/>\n# \u914d\u7f6e\u96c6\u7fa4\u53d1\u73b0\u65b9\u5f0f<br \/>\ncluster.discovery &#061; manual<br \/>\n# \u914d\u7f6e\u8282\u70b9\u540d\u79f0&#xff0c;\u8282\u70b9\u540d\u683c\u5f0f\u4e3a\u00a0Name&#064;Host, Host \u5fc5\u987b\u662f IP \u5730\u5740\u6216 FQDN (\u4e3b\u673a\u540d\u3002\u57df\u540d)<br \/>\nnode.name &#061; emqx1&#064;IP <\/p>\n<h4 style=\"text-align:left\">2.3 \u9632\u706b\u5899\u914d\u7f6e<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u5728\u9632\u706b\u5899\u5f00\u653e\u7aef\u53e3\u53f7<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">sudo ufw allow \u7aef\u53e3\u53f7<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u9632\u706b\u5899\u5f00\u653e\u4ee5\u4e0b\u7aef\u53e3&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;1&#xff09;Dashboard\u8bbf\u95ee\u7aef\u53e318083<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;2&#xff09;ekka \u6a21\u5f0f&#xff08;4.0 \u7248\u672c\u4e4b\u540e\u7684\u9ed8\u8ba4\u6a21\u5f0f&#xff09;&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728ekka \u6a21\u5f0f\u4e0b&#xff0c;\u96c6\u7fa4\u53d1\u73b0\u7aef\u53e3\u7684\u6620\u5c04\u5173\u7cfb\u662f\u7ea6\u5b9a\u597d\u7684&#xff0c;\u800c\u4e0d\u662f\u52a8\u6001\u7684\u3002\u00a0node.dist_listen_min\u00a0\u548c\u00a0node.dist_listen_max\u00a0\u4e24\u4e2a\u914d\u7f6e\u5728ekka \u6a21\u5f0f\u4e0b\u4e0d\u8d77\u4f5c\u7528\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5982\u679c\u96c6\u7fa4\u8282\u70b9\u95f4\u5b58\u5728\u9632\u706b\u5899&#xff0c;\u9632\u706b\u5899\u9700\u8981\u653e\u5f00\u8fd9\u4e2a\u7ea6\u5b9a\u7684\u7aef\u53e3\u3002\u7ea6\u5b9a\u7aef\u53e3\u7684\u89c4\u5219\u5982\u4e0b&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">ListeningPort &#061; BasePort &#043; Offset<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5176\u4e2d\u00a0BasePort\u00a0\u4e3a 4370 (\u4e0d\u53ef\u914d\u7f6e),\u00a0Offset\u00a0\u4e3a\u8282\u70b9\u540d\u7684\u6570\u5b57\u540e\u7f00. \u5982\u679c\u8282\u70b9\u540d\u6ca1\u6709\u6570\u5b57\u540e\u7f00\u7684\u8bdd&#xff0c;\u00a0Offsset\u00a0\u4e3a 0\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4e3e\u4f8b\u6765\u8bf4, \u5982\u679c\u00a0emqx.conf\u00a0\u91cc\u914d\u7f6e\u4e86\u8282\u70b9\u540d&#xff1a;node.name &#061; emqx&#064;192.168.0.12&#xff0c;\u90a3\u4e48\u76d1\u542c\u7aef\u53e3\u4e3a\u00a04370&#xff0c; \u4f46\u5bf9\u4e8e\u00a0emqx1\u00a0(\u6216\u8005\u00a0emqx-1) \u7aef\u53e3\u5c31\u662f\u00a04371&#xff0c;\u4ee5\u6b64\u7c7b\u63a8\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">&#xff08;3&#xff09;<\/span><\/span>The Cluster RPC Port<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6bcf\u4e2a\u8282\u70b9\u8fd8\u9700\u8981\u76d1\u542c\u4e00\u4e2a RPC \u7aef\u53e3&#xff0c;\u4e5f\u9700\u8981\u88ab\u9632\u706b\u5899\u4e5f\u653e\u5f00\u3002\u8ddf\u4e0a\u9762\u8bf4\u7684ekka \u6a21\u5f0f\u4e0b\u7684\u96c6\u7fa4\u53d1\u73b0\u7aef\u53e3\u4e00\u6837&#xff0c;\u8fd9\u4e2a RPC \u7aef\u53e3\u4e5f\u662f\u7ea6\u5b9a\u5f0f\u7684\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">RPC \u7aef\u53e3\u7684\u89c4\u5219\u8ddfekka \u6a21\u5f0f\u4e0b\u7684\u96c6\u7fa4\u53d1\u73b0\u7aef\u53e3\u7c7b\u4f3c&#xff0c;\u53ea\u4e0d\u8fc7\u00a0BasePort &#061; 5370\u3002\u5c31\u662f\u8bf4&#xff0c;\u5982\u679c\u00a0emqx.conf\u00a0\u91cc\u914d\u7f6e\u4e86\u8282\u70b9\u540d&#xff1a;node.name &#061; emqx&#064;192.168.0.12&#xff0c;\u90a3\u4e48\u76d1\u542c\u7aef\u53e3\u4e3a\u00a05370&#xff0c; \u4f46\u5bf9\u4e8e\u00a0emqx1\u00a0(\u6216\u8005\u00a0emqx-1) \u7aef\u53e3\u5c31\u662f\u00a05371&#xff0c;\u4ee5\u6b64\u7c7b\u63a8\u3002<\/p>\n<h4 style=\"text-align:left\">2.4 \u542f\u52a8EMQX\u96c6\u7fa4<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;1&#xff09;\u5206\u522b\u542f\u52a8EMQX\u96c6\u7fa4\u7684\u6bcf\u4e2a\u8282\u70b9<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8fdb\u5165emqx\u6587\u4ef6\u5939\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u542f\u52a8EMQX Broker<\/p>\n<p>.\/bin\/emqx start <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4f7f\u7528 static\u6a21\u5f0f\u521b\u5efa\u96c6\u7fa4\u65f6&#xff0c;\u5f53\u8282\u70b9\u5168\u90e8\u542f\u52a8\u540e&#xff0c;\u4f1a\u81ea\u52a8\u521b\u5efa\u96c6\u7fa4<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4f7f\u7528<span style=\"background-color:#ffffff\"><span style=\"color:#343741\">\u624b\u52a8(manual) \u65b9\u5f0f\u7ba1\u7406\u96c6\u7fa4&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u8282\u70b91\u52a0\u5165\u8282\u70b92\u5f62\u6210\u96c6\u7fa4<\/p>\n<p># \u5728\u8282\u70b9emqx1&#064;IP\u4e0a\u6267\u884c<br \/>\n.\/bin\/emqx_ctl cluster join emqx2&#064;IP<br \/>\n# \u6216\u8005\u5728\u8282\u70b9\u5728\u8282\u70b9emqx2&#064;IP\u6267\u884c<br \/>\n.\/bin\/emqx_ctl cluster join emqx1&#064;IP <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">\u8282\u70b9\u9000\u51fa\u96c6\u7fa4&#xff1a;<\/span><\/span><\/p>\n<p># \u8ba9\u672c\u8282\u70b9\u9000\u51fa\u96c6\u7fa4<\/p>\n<p>.\/bin\/emqx_ctl\u00a0cluster\u00a0leave<\/p>\n<p># \u4ece\u96c6\u7fa4\u5220\u9664\u5176\u4ed6\u8282\u70b9<\/p>\n<p>.\/bin\/emqx_ctl\u00a0cluster\u00a0force-leave\u00a0emqx1&#064;IP <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;2&#xff09;\u67e5\u770b\u8282\u70b9\u72b6\u6001&#xff1a;<\/p>\n<p>.\/bin\/emqx_ctl status <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;3&#xff09;\u67e5\u770bemqx\u96c6\u7fa4\u72b6\u6001&#xff1a;<\/p>\n<p>.\/bin\/emqx_ctl cluster status <\/p>\n<h4 style=\"text-align:left\">2.5 \u8bbf\u95eeEMQX Dashboard<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8bbf\u95ee\u00a0http:\/\/ip:18083 \u6765\u67e5\u770bDashboard&#xff0c;\u9ed8\u8ba4\u7528\u6237\u540d\u662f\u00a0admin&#xff0c;\u5bc6\u7801\u662f\u00a0public<\/p>\n<h3 style=\"text-align:left\">3\u00a0EMQX\u8ba4\u8bc1<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">EMQX \u7684\u8ba4\u8bc1\u652f\u6301\u5305\u62ec\u4e24\u4e2a\u5c42\u9762&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">MQTT \u534f\u8bae\u672c\u8eab\u5728 CONNECT \u62a5\u6587\u4e2d\u6307\u5b9a\u7528\u6237\u540d\u548c\u5bc6\u7801&#xff0c;EMQX \u4ee5\u63d2\u4ef6\u5f62\u5f0f\u652f\u6301\u57fa\u4e8e Username\u3001ClientID\u3001HTTP\u3001JWT\u3001LDAP \u53ca\u5404\u7c7b\u6570\u636e\u5e93\u5982 MongoDB\u3001MySQL\u3001PostgreSQL\u3001Redis \u7b49\u591a\u79cd\u5f62\u5f0f\u7684\u8ba4\u8bc1\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u4f20\u8f93\u5c42\u4e0a&#xff0c;TLS \u53ef\u4ee5\u4fdd\u8bc1\u4f7f\u7528\u5ba2\u6237\u7aef\u8bc1\u4e66\u7684\u5ba2\u6237\u7aef\u5230\u670d\u52a1\u5668\u7684\u8eab\u4efd\u9a8c\u8bc1&#xff0c;\u5e76\u786e\u4fdd\u670d\u52a1\u5668\u5411\u5ba2\u6237\u7aef\u9a8c\u8bc1\u670d\u52a1\u5668\u8bc1\u4e66\u3002\u4e5f\u652f\u6301\u57fa\u4e8e PSK \u7684 TLS\/DTLS \u8ba4\u8bc1\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u672c\u7ae0\u8282\u4ecb\u7ecd\u4e86 EMQX \u7684MySQL\u8ba4\u8bc1\u63d2\u4ef6\u7684\u914d\u7f6e\u65b9\u6cd5\u4ee5\u53caTLS\u8ba4\u8bc1\u914d\u7f6e\u3002<\/p>\n<h4 style=\"text-align:left\">3.1 \u5f00\u542f\u8ba4\u8bc1\u6a21\u5f0f<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">EMQ X \u9ed8\u8ba4\u914d\u7f6e\u4e2d\u542f\u7528\u4e86\u533f\u540d\u8ba4\u8bc1&#xff0c;\u4efb\u4f55\u5ba2\u6237\u7aef\u90fd\u80fd\u63a5\u5165 EMQX&#xff0c;\u56e0\u6b64&#xff0c;EMQX\u5f00\u542f\u8ba4\u8bc1\u9996\u5148\u8981\u5173\u95ed\u533f\u540d\u8ba4\u8bc1\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">vim etc\/emqx.conf<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050615-68032f473e213.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5c06allow_anonymous\u8bbe\u4e3afalse&#xff0c;\u5173\u95ed\u533f\u540d\u8bbf\u95ee&#xff0c;\u5173\u95ed\u540eEMQX\u5c06\u4e0d\u5141\u8bb8\u533f\u540d\u7528\u6237\u8fde\u63a5&#xff0c;\u9700\u8981\u901a\u8fc7\u7528\u6237\u540d\u5bc6\u7801\u8fde\u63a5\u3002<\/p>\n<h4 style=\"text-align:left\">3.2 MySQL\u8ba4\u8bc1<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">MySQL \u8ba4\u8bc1\u4f7f\u7528\u5916\u90e8 MySQL \u6570\u636e\u5e93\u4f5c\u4e3a\u8ba4\u8bc1\u6570\u636e\u6e90&#xff0c;\u53ef\u4ee5\u5b58\u50a8\u5927\u91cf\u6570\u636e&#xff0c;\u540c\u65f6\u65b9\u4fbf\u4e0e\u5916\u90e8\u8bbe\u5907\u7ba1\u7406\u7cfb\u7edf\u96c6\u6210\u3002<\/p>\n<h5 style=\"text-align:justify\">3.2.1 \u5b89\u88c5MySQL\u6570\u636e\u5e93<\/h5>\n<p style=\"margin-left:.0001pt;text-align:justify\">MySQL\u6570\u636e\u5e93\u914d\u7f6e<\/p>\n<h5 style=\"text-align:justify\">3.2.2 MySQL\u8ba4\u8bc1\u914d\u7f6e<\/h5>\n<p style=\"margin-left:.0001pt;text-align:justify\">1 \u5728MySQL\u4e2d\u521b\u5efaemqx\u6240\u9700\u7684\u6570\u636e\u5e93\u548c\u7528\u6237\u8ba4\u8bc1\u8868<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;1&#xff09;\u521b\u5efa\u7528\u6237\u540demqx\u5bc6\u7801emqx<\/p>\n<p>CREATE USER emqx&#064;&#039;%&#039; IDENTIFIED BY &#039;emqx&#039;; <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;2&#xff09;\u521b\u5efaemqx\u6570\u636e\u5e93<\/p>\n<p>create database emqx character set utf8; <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;3&#xff09;\u5c06\u6570\u636e\u5e93emqx\u4e0b\u7684\u6240\u6709\u8868\u6388\u6743\u7ed9emqx\u7528\u6237<\/p>\n<p>grant all privileges on emqx.* to &#039;emqx&#039;&#064;&#039;%&#039;; <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;4&#xff09;\u521b\u5efa\u8ba4\u8bc1\u7528\u6237\u8868<\/p>\n<p>CREATE TABLE &#096;mqtt_user&#096; (<\/p>\n<p>\u00a0\u00a0&#096;id&#096; int(11) unsigned NOT NULL AUTO_INCREMENT,<\/p>\n<p>\u00a0\u00a0&#096;username&#096; varchar(100) DEFAULT NULL,<\/p>\n<p>\u00a0\u00a0&#096;password&#096; varchar(100) DEFAULT NULL,<\/p>\n<p>\u00a0\u00a0&#096;salt&#096; varchar(35) DEFAULT NULL,<\/p>\n<p>\u00a0\u00a0&#096;is_superuser&#096; tinyint(1) DEFAULT 0,<\/p>\n<p>\u00a0\u00a0&#096;created&#096; datetime DEFAULT NULL,<\/p>\n<p>\u00a0\u00a0PRIMARY KEY (&#096;id&#096;),<\/p>\n<p>\u00a0\u00a0UNIQUE KEY &#096;mqtt_username&#096; (&#096;username&#096;)<\/p>\n<p>) ENGINE&#061;InnoDB DEFAULT CHARSET&#061;utf8mb4; <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u521b\u5efa\u597d\u6570\u636e\u5e93\u76f8\u5173\u7528\u6237\u548c\u8868\u7ed3\u6784\u540e\u5728\u6bcf\u4e2a\u8282\u70b9\u7684\u914d\u7f6e\u6587\u4ef6etc\/plugins\/emqx_auth_mysql.conf\u00a0\u4e2d\u914d\u7f6e\u4ee5\u4e0b\u5185\u5bb9&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">2 \u4fee\u6539MySQL\u8ba4\u8bc1\u914d\u7f6e\u6587\u4ef6<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u521b\u5efa\u597d\u6570\u636e\u5e93\u76f8\u5173\u7528\u6237\u548c\u8868\u7ed3\u6784\u540e\u5728\u6bcf\u4e2a\u8282\u70b9\u7684\u914d\u7f6e\u6587\u4ef6etc\/plugins\/emqx_auth_mysql.conf\u00a0\u4e2d\u914d\u7f6e\u4ee5\u4e0b\u5185\u5bb9&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;1&#xff09;\u914d\u7f6e MySQL \u670d\u52a1\u76f8\u5173\u7684\u8fde\u63a5\u5730\u5740&#xff0c;\u7528\u6237\u540d\u5bc6\u7801\u548c\u6570\u636e\u5e93<\/p>\n<p style=\"margin-left:.0001pt\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050615-68032f475ba13.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;2&#xff09; \u914d\u7f6e\u8ba4\u8bc1SQL<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">\u8fdb\u884c\u8eab\u4efd\u8ba4\u8bc1\u65f6&#xff0c;EMQX \u5c06\u4f7f\u7528\u5f53\u524d\u5ba2\u6237\u7aef\u4fe1\u606f\u586b\u5145\u5e76\u6267\u884c\u7528\u6237\u914d\u7f6e\u7684\u8ba4\u8bc1 SQL&#xff0c;\u67e5\u8be2\u51fa\u8be5\u5ba2\u6237\u7aef\u5728\u6570\u636e\u5e93\u4e2d\u7684\u8ba4\u8bc1\u6570\u636e\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050615-68032f477f709.png\" \/><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">\u4f60\u53ef\u4ee5\u5728\u8ba4\u8bc1 SQL \u4e2d\u4f7f\u7528\u4ee5\u4e0b\u5360\u4f4d\u7b26&#xff0c;\u6267\u884c\u65f6 EMQX \u5c06\u81ea\u52a8\u586b\u5145\u4e3a\u5ba2\u6237\u7aef\u4fe1\u606f&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">%u&#xff1a;\u7528\u6237\u540d<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">%c&#xff1a;Client ID<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">%C&#xff1a;TLS \u8bc1\u4e66\u516c\u7528\u540d&#xff08;\u8bc1\u4e66\u7684\u57df\u540d\u6216\u5b50\u57df\u540d&#xff09;&#xff0c;\u4ec5\u5f53 TLS \u8fde\u63a5\u65f6\u6709\u6548<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">%d&#xff1a;TLS \u8bc1\u4e66 subject&#xff0c;\u4ec5\u5f53 TLS \u8fde\u63a5\u65f6\u6709\u6548<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">\u4f60\u53ef\u4ee5\u6839\u636e\u4e1a\u52a1\u9700\u8981\u8c03\u6574\u8ba4\u8bc1 SQL&#xff0c;\u5982\u6dfb\u52a0\u591a\u4e2a\u67e5\u8be2\u6761\u4ef6\u3001\u4f7f\u7528\u6570\u636e\u5e93\u9884\u5904\u7406\u51fd\u6570&#xff0c;\u4ee5\u5b9e\u73b0\u66f4\u591a\u4e1a\u52a1\u76f8\u5173\u7684\u529f\u80fd\u3002\u4f46\u662f\u4efb\u4f55\u60c5\u51b5\u4e0b\u8ba4\u8bc1 SQL \u9700\u8981\u6ee1\u8db3\u4ee5\u4e0b\u6761\u4ef6&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">a.\u67e5\u8be2\u7ed3\u679c\u4e2d\u5fc5\u987b\u5305\u542b password \u5b57\u6bb5&#xff0c;EMQX \u4f7f\u7528\u8be5\u5b57\u6bb5\u4e0e\u5ba2\u6237\u7aef\u5bc6\u7801\u6bd4\u5bf9<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">b.\u5982\u679c\u542f\u7528\u4e86\u52a0\u76d0\u914d\u7f6e&#xff0c;\u67e5\u8be2\u7ed3\u679c\u4e2d\u5fc5\u987b\u5305\u542b salt \u5b57\u6bb5&#xff0c;EMQX \u4f7f\u7528\u8be5\u5b57\u6bb5\u4f5c\u4e3a salt&#xff08;\u76d0&#xff09;\u503c<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">c.\u67e5\u8be2\u7ed3\u679c\u53ea\u80fd\u6709\u4e00\u6761&#xff0c;\u591a\u6761\u7ed3\u679c\u65f6\u53ea\u53d6\u7b2c\u4e00\u6761\u4f5c\u4e3a\u6709\u6548\u6570\u636e<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">(3) \u914d\u7f6e\u52a0\u76d0\u89c4\u5219\u4e0e\u54c8\u5e0c\u65b9\u6cd5<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u914d\u7f6e\u5bc6\u7801\u52a0\u5bc6\u65b9\u5f0f&#xff0c;\u672c\u6587\u5bc6\u7801\u52a0\u5bc6\u91c7\u7528\u52a0\u76d0&#043;sha256\u65b9\u5f0f<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050615-68032f47a16a5.png\" \/><\/p>\n<h4 style=\"text-align:left\">3.3 TLS\u8ba4\u8bc1\u53cc\u5411\u8ba4\u8bc1<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">1<\/span><\/span>\u00a0<span style=\"background-color:#ffffff\"><span style=\"color:#343741\">MQTT TLS \u7684\u9ed8\u8ba4\u7aef\u53e3\u662f 8883&#xff1a;<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050615-68032f47c1145.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">2 <\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">\u914d\u7f6e\u8bc1\u4e66\u548c CA<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">\u5f00\u542fTLS\u53cc\u5411\u8ba4\u8bc1\u65f6\u9700\u8981\u521b\u5efa\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u7aef\u8bc1\u4e66&#xff0c;\u5e76\u5728\u6b64\u5904\u914d\u7f6e\u670d\u52a1\u7aef\u8bc1\u4e66\u7684\u4f4d\u7f6e&#xff0c;\u5728\u4f7f\u7528TLS\u53cc\u5411\u8ba4\u8bc1\u8fde\u63a5\u65f6&#xff0c;\u9700\u8981\u5728\u5ba2\u6237\u7aef\u914d\u7f6e\u5ba2\u6237\u7aef\u8bc1\u4e66\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050615-68032f47dfdaf.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u521b\u5efa\u81ea\u7b7e\u540d\u8bc1\u4e66\u65b9\u6cd5\u53c2\u8003\u9644\u5f556.1\u7ae0\u8282<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">3 \u5f00\u542f\u53cc\u5411\u8ba4\u8bc1<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">\u4ee5\u4e0b\u4e24\u4e2a\u914d\u7f6e\u662f \u6253\u5f00\u670d\u52a1\u7aef \u9a8c\u8bc1\u5ba2\u6237\u7aef\u8bc1\u4e66 <\/span><\/span><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">(\u9ed8\u8ba4\u5173\u95ed \u5373\u5355\u5411\u9a8c\u8bc1 \u6253\u5f00\u5373\u53ef\u5b9e\u73b0\u53cc\u5411\u8ba4\u8bc1)<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050616-68032f4810156.png\" \/><\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">\u4f5c\u4e3a\u4e00\u79cd\u6027\u80fd\u4f18\u5316\u8bbe\u7f6e&#xff0c;\u5b83\u5141\u8bb8\u5ba2\u6237\u7aef\u91cd\u7528\u9884\u5148\u5b58\u5728\u7684\u4f1a\u8bdd&#xff0c;\u800c\u4e0d\u662f\u521d\u59cb\u5316\u65b0\u7684\u4f1a\u8bdd\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050616-68032f4832fd5.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">EMQX\u96c6\u7fa4\u6240\u6709\u8282\u70b9\u914d\u7f6e\u5b8c\u6210\u540e&#xff0c;\u5206\u522b\u91cd\u542f\u6bcf\u4e2a\u8282\u70b9<\/p>\n<h4 style=\"text-align:left\">3.4 \u8ba4\u8bc1\u9a8c\u8bc1<\/h4>\n<h5 style=\"text-align:justify\">3.4.1 \u5f00\u542femqx_auth_mysql\u63d2\u4ef6\u8ba4\u8bc1<\/h5>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5f00\u542f\u6240\u6709\u8282\u70b9\u7684emqx_auth_mysql\u63d2\u4ef6\u8ba4\u8bc1&#xff0c;\u6253\u5f00emqx Dashboard\u754c\u9762&#xff0c;\u70b9\u51fb\u63d2\u4ef6\u6a21\u5757&#xff0c;\u542f\u52a8emqx_auth_mysql\u63d2\u4ef6\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050616-68032f4851df8.png\" \/><\/p>\n<h5 style=\"text-align:justify\">3.4.2 \u521b\u5efaemqx\u7528\u6237\u540d\u548c\u5bc6\u7801<\/h5>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728emqx\u6570\u636e\u5e93\u7684mqtt_user\u8868\u4e2d\u65b0\u589e\u4e00\u4e2a\u7528\u6237<\/p>\n<p>INSERT INTO &#096;mqtt_user&#096; ( &#096;username&#096;, &#096;password&#096;, &#096;salt&#096;) VALUES<\/p>\n<p>(\u2018test\u2019, \u201862a11257d24e7b577b87936eaf7931a0f15bc7b4e52f2c37507b7792c38b6d0c\u2019, \u2018secret\u2019); <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6ce8\u610f&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5bc6\u7801\u662f\u7ecf\u8fc7\u52a0\u5bc6\u540e\u7684\u5bc6\u6587&#xff0c;\u5982\u679c\u91c7\u7528\u4e86\u52a0\u76d0&#xff0c;\u9700\u8981\u6dfb\u52a0\u52a0\u76d0\u5b57\u6bb5&#xff0c;\u53ef\u4ee5\u5728\u7f51\u4e0a\u641c\u7d22\u52a0\u5bc6\u5de5\u5177&#xff0c;\u672c\u6587\u4f7f\u7528\u7684\u52a0\u5bc6\u5de5\u5177\u5730\u5740&#xff1a;md5\u52a0\u5bc6,sha1\u52a0\u5bc6&#8211;md5\u5728\u7ebf\u89e3\u5bc6<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u9009\u62e9\u6b63\u786e\u7684\u52a0\u5bc6\u65b9\u5f0f\u751f\u6210\u7684\u5bc6\u7801hash\u503c&#xff08;\u672c\u6587\u662f\u91c7\u7528salt&#043;sha256&#xff09;<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050617-68032f490dbee.png\" \/><\/p>\n<h5 style=\"text-align:justify\">3.4.3 \u9a8c\u8bc1<\/h5>\n<h6 style=\"text-align:justify\">3.4.3.1 \u4f7f\u7528WebSocket\u5de5\u5177<\/h6>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4f7f\u7528EMQX Dashboard Websocket\u5de5\u5177\u53ef\u4ee5\u8fdb\u884c\u7b80\u5355\u7684\u5ba2\u6237\u7aef\u8fde\u63a5\u670d\u52a1\u7aef\u6d4b\u8bd5&#xff0c;\u4e3b\u9898\u8ba2\u9605\u548c\u53d1\u5e03\u6d88\u606f\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5f00\u542fMYSQL\u8ba4\u8bc1\u540e&#xff0c;\u9700\u8981\u901a\u8fc7\u5df2\u521b\u5efa\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\u8fde\u63a5&#xff0c;\u5426\u5219\u4f1a\u663e\u793a\u8fde\u63a5\u5931\u8d25\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4f7f\u7528WebSocket\u5de5\u5177\u7684SSL\u8fde\u63a5\u9700\u8981\u5b89\u88c5\u5ba2\u6237\u7aef\u8bc1\u4e66&#xff0c;\u5426\u5219\u65e0\u6cd5\u8fde\u63a5&#xff0c;\u672c\u6587\u63a8\u8350\u4f7f\u7528MQTTX\u5ba2\u6237\u7aef\u5de5\u5177\u8fdb\u884cSSL\u8ba4\u8bc1\u8fde\u63a5\u6d4b\u8bd5\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<h6 style=\"text-align:justify\">3.4.3.2\u00a0MQTTX\u5ba2\u6237\u7aef\u8fde\u63a5\u5de5\u5177<\/h6>\n<p style=\"margin-left:.0001pt;text-align:justify\">1 \u5b89\u88c5MQTTX\u5ba2\u6237\u7aef<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8bbf\u95eeMQTTX&#xff1a;\u5168\u529f\u80fd MQTT \u5ba2\u6237\u7aef\u5de5\u5177\u4e0b\u8f7d\u5b89\u88c5MQTTX\u5ba2\u6237\u7aef<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">2 \u6253\u5f00\u5ba2\u6237\u7aef\u65b0\u5efa\u8fde\u63a5<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;1&#xff09;\u65b0\u5efa\u4e00\u4e2a\u8fde\u63a5&#xff0c;\u586b\u5199\u670d\u52a1\u7aef\u5730\u5740\u3001\u7aef\u53e3\u53f7\u3001\u7528\u6237\u540d\u548c\u5bc6\u7801&#xff0c;\u5f00\u542fSSL\/TLS\u53cc\u5411\u8ba4\u8bc1&#xff0c;\u9009\u62e9\u81ea\u5b9a\u4e49\u8bc1\u4e66&#xff0c;\u5f00\u542fSSL Secure\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;2&#xff09;\u9009\u62e9\u672c\u5730\u5ba2\u6237\u7aef\u8bc1\u4e66\u7684\u4f4d\u7f6e<\/p>\n<p style=\"text-align:justify\">\u70b9\u51fbconnect\u8fdb\u884c\u8fde\u63a5<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">MQTTX\u5176\u4ed6\u529f\u80fd\u53ef\u4ee5\u53c2\u8003\u5b98\u65b9\u6587\u6863&#xff0c;\u5728\u6b21\u4e0d\u505a\u8fc7\u591a\u4ecb\u7ecd<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">MQTTX&#xff1a;\u5168\u529f\u80fd MQTT \u5ba2\u6237\u7aef\u5de5\u5177<\/p>\n<h3 style=\"text-align:left\">4 \u53d1\u5e03\u8ba2\u9605 ACL<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u53d1\u5e03\u8ba2\u9605 ACL\u00a0\u6307\u5bf9\u00a0\u53d1\u5e03 (PUBLISH)\/\u8ba2\u9605 (SUBSCRIBE)\u00a0\u64cd\u4f5c\u7684\u00a0\u6743\u9650\u63a7\u5236\u3002\u4f8b\u5982\u62d2\u7edd\u7528\u6237\u540d\u4e3a\u00a0Anna\u00a0\u5411\u00a0open\/elsa\/door\u00a0\u53d1\u5e03\u6d88\u606f\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">EMQX \u652f\u6301\u901a\u8fc7\u5ba2\u6237\u7aef\u53d1\u5e03\u8ba2\u9605 ACL \u8fdb\u884c\u5ba2\u6237\u7aef\u6743\u9650\u7684\u7ba1\u7406&#xff0c;\u672c\u7ae0\u8282\u4ecb\u7ecd\u4e86 EMQX \u53d1\u5e03\u8ba2\u9605 ACL \u4ee5\u53ca\u5bf9\u5e94MYSQL\u63d2\u4ef6\u7684\u914d\u7f6e\u65b9\u6cd5\u3002<\/p>\n<h4 style=\"text-align:left\">4.1 MySQL\u63d2\u4ef6\u914d\u7f6e<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u53d1\u5e03\u8ba2\u9605 ACL\u529f\u80fd\u5305\u542b\u5728emqx_auth_mysql \u63d2\u4ef6\u4e2d&#xff0c;\u57283.2MySQL\u8ba4\u8bc1\u5c0f\u8282\u4e2d\u5df2\u7ecf\u5f00\u542f\u4e86\u6b64\u63d2\u4ef6&#xff0c;\u5e76\u8fdb\u884c\u4e86\u6570\u636e\u5e93\u914d\u7f6e&#xff0c;\u5728\u6b64\u57fa\u7840\u4e0a\u8fd8\u9700\u8fdb\u884c\u5982\u4e0b\u914d\u7f6e\u3002<\/p>\n<h5 style=\"text-align:justify\">4.1.1 \u521b\u5efaACL\u89c4\u5219\u8868<\/h5>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728emqx\u6570\u636e\u5e93\u4e2d\u521b\u5efaacl\u89c4\u5219\u8868mqtt_acl<\/p>\n<p>CREATE TABLE &#096;mqtt_acl&#096; (<\/p>\n<p>\u00a0\u00a0&#096;id&#096; int(11) unsigned NOT NULL AUTO_INCREMENT,<\/p>\n<p>\u00a0\u00a0&#096;allow&#096; int(1) DEFAULT 1 COMMENT &#039;0: deny, 1: allow&#039;,<\/p>\n<p>\u00a0\u00a0&#096;ipaddr&#096; varchar(60) DEFAULT NULL COMMENT &#039;IpAddress&#039;,<\/p>\n<p>\u00a0\u00a0&#096;username&#096; varchar(100) DEFAULT NULL COMMENT &#039;Username&#039;,<\/p>\n<p>\u00a0\u00a0&#096;clientid&#096; varchar(100) DEFAULT NULL COMMENT &#039;ClientId&#039;,<\/p>\n<p>\u00a0\u00a0&#096;access&#096; int(2) NOT NULL COMMENT &#039;1: subscribe, 2: publish, 3: pubsub&#039;,<\/p>\n<p>\u00a0\u00a0&#096;topic&#096; varchar(100) NOT NULL DEFAULT &#039;&#039; COMMENT &#039;Topic Filter&#039;,<\/p>\n<p>\u00a0\u00a0PRIMARY KEY (&#096;id&#096;),<\/p>\n<p>\u00a0\u00a0INDEX (ipaddr),<\/p>\n<p>\u00a0\u00a0INDEX (username),<\/p>\n<p>\u00a0\u00a0INDEX (clientid)<\/p>\n<p>) ENGINE&#061;InnoDB DEFAULT CHARSET&#061;utf8mb4; <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u89c4\u5219\u8868\u5b57\u6bb5\u8bf4\u660e&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">allow&#xff1a;\u7981\u6b62&#xff08;0&#xff09;&#xff0c;\u5141\u8bb8&#xff08;1&#xff09;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">ipaddr&#xff1a;\u8bbe\u7f6e IP \u5730\u5740<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">username&#xff1a;\u8fde\u63a5\u5ba2\u6237\u7aef\u7684\u7528\u6237\u540d&#xff0c;\u6b64\u5904\u7684\u503c\u5982\u679c\u8bbe\u7f6e\u4e3a\u00a0$all\u00a0\u8868\u793a\u8be5\u89c4\u5219\u9002\u7528\u4e8e\u6240\u6709\u7684\u7528\u6237<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">clientid&#xff1a;\u8fde\u63a5\u5ba2\u6237\u7aef\u7684 Client ID<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">access&#xff1a;\u5141\u8bb8\u7684\u64cd\u4f5c&#xff1a;\u8ba2\u9605&#xff08;1&#xff09;&#xff0c;\u53d1\u5e03&#xff08;2&#xff09;&#xff0c;\u8ba2\u9605\u53d1\u5e03\u90fd\u53ef\u4ee5&#xff08;3&#xff09;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">topic&#xff1a;\u63a7\u5236\u7684\u4e3b\u9898&#xff0c;\u53ef\u4ee5\u4f7f\u7528\u901a\u914d\u7b26&#xff0c;\u5e76\u4e14\u53ef\u4ee5\u5728\u4e3b\u9898\u4e2d\u52a0\u5165\u5360\u4f4d\u7b26\u6765\u5339\u914d\u5ba2\u6237\u7aef\u4fe1\u606f&#xff0c;\u4f8b\u5982\u00a0t\/%c\u00a0\u5219\u5728\u5339\u914d\u65f6\u4e3b\u9898\u5c06\u4f1a\u66ff\u6362\u4e3a\u5f53\u524d\u5ba2\u6237\u7aef\u7684 Client ID<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">%u&#xff1a;\u7528\u6237\u540d<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">%c&#xff1a;Client ID<\/p>\n<h5 style=\"text-align:justify\">4.1.2 \u8d85\u7ea7\u7528\u6237 SQL&#xff08;super_query&#xff09;<\/h5>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8fdb\u884c ACL \u9274\u6743\u65f6&#xff0c;EMQX \u5c06\u4f7f\u7528\u5f53\u524d\u5ba2\u6237\u7aef\u4fe1\u606f\u586b\u5145\u5e76\u6267\u884c\u7528\u6237\u914d\u7f6e\u7684\u8d85\u7ea7\u7528\u6237 SQL&#xff0c;\u67e5\u8be2\u5ba2\u6237\u7aef\u662f\u5426\u4e3a\u8d85\u7ea7\u7528\u6237\u3002\u5ba2\u6237\u7aef\u4e3a\u8d85\u7ea7\u7528\u6237\u65f6\u5c06\u8df3\u8fc7 ACL SQL\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728etc\/plugins\/emqx_auth_mysql.conf\u914d\u7f6e\u4e2d\u505a\u5982\u4e0b\u4fee\u6539<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050617-68032f499261f.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4f60\u53ef\u4ee5\u5728 SQL \u4e2d\u4f7f\u7528\u4ee5\u4e0b\u5360\u4f4d\u7b26&#xff0c;\u6267\u884c\u65f6 EMQX \u5c06\u81ea\u52a8\u586b\u5145\u4e3a\u5ba2\u6237\u7aef\u4fe1\u606f&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">%u&#xff1a;\u7528\u6237\u540d<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">%c&#xff1a;Client ID<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">%C&#xff1a;TLS \u8bc1\u4e66\u516c\u7528\u540d&#xff08;\u8bc1\u4e66\u7684\u57df\u540d\u6216\u5b50\u57df\u540d&#xff09;&#xff0c;\u4ec5\u5f53 TLS \u8fde\u63a5\u65f6\u6709\u6548<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">%d&#xff1a;TLS \u8bc1\u4e66 subject&#xff0c;\u4ec5\u5f53 TLS \u8fde\u63a5\u65f6\u6709\u6548<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4f60\u53ef\u4ee5\u6839\u636e\u4e1a\u52a1\u9700\u8981\u8c03\u6574\u8d85\u7ea7\u7528\u6237 SQL&#xff0c;\u5982\u6dfb\u52a0\u591a\u4e2a\u67e5\u8be2\u6761\u4ef6\u3001\u4f7f\u7528\u6570\u636e\u5e93\u9884\u5904\u7406\u51fd\u6570&#xff0c;\u4ee5\u5b9e\u73b0\u66f4\u591a\u4e1a\u52a1\u76f8\u5173\u7684\u529f\u80fd\u3002\u4f46\u662f\u4efb\u4f55\u60c5\u51b5\u4e0b\u8d85\u7ea7\u7528\u6237 SQL \u9700\u8981\u6ee1\u8db3\u4ee5\u4e0b\u6761\u4ef6&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;1&#xff09;\u67e5\u8be2\u7ed3\u679c\u4e2d\u5fc5\u987b\u5305\u542b is_superuser \u5b57\u6bb5&#xff0c;is_superuser \u5e94\u8be5\u663e\u5f0f\u7684\u4e3a true&#xff1b;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;2&#xff09;\u67e5\u8be2\u7ed3\u679c\u53ea\u80fd\u6709\u4e00\u6761&#xff0c;\u591a\u6761\u7ed3\u679c\u65f6\u53ea\u53d6\u7b2c\u4e00\u6761\u4f5c\u4e3a\u6709\u6548\u6570\u636e\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u63d0\u793a<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5982\u679c\u4e0d\u9700\u8981\u8d85\u7ea7\u7528\u6237\u529f\u80fd&#xff0c;\u6ce8\u91ca\u5e76\u7981\u7528\u8be5\u9009\u9879\u80fd\u6709\u6548\u63d0\u9ad8\u6548\u7387<\/p>\n<h5 style=\"text-align:justify\">4.1.3 ACL SQL&#xff08;acl_query&#xff09;<\/h5>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8fdb\u884c ACL \u9274\u6743\u65f6&#xff0c;EMQX \u5c06\u4f7f\u7528\u5f53\u524d\u5ba2\u6237\u7aef\u4fe1\u606f\u586b\u5145\u5e76\u6267\u884c\u7528\u6237\u914d\u7f6e\u7684\u8d85\u7ea7\u7528\u6237 SQL&#xff0c;\u5982\u679c\u6ca1\u6709\u542f\u7528\u8d85\u7ea7\u7528\u6237 SQL \u6216\u5ba2\u6237\u7aef\u4e0d\u662f\u8d85\u7ea7\u7528\u6237&#xff0c;\u5219\u4f7f\u7528 ACL SQL \u67e5\u8be2\u51fa\u8be5\u5ba2\u6237\u7aef\u5728\u6570\u636e\u5e93\u4e2d\u7684 ACL \u89c4\u5219\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728etc\/plugins\/emqx_auth_mysql.conf\u914d\u7f6e\u4e2d\u505a\u5982\u4e0b\u4fee\u6539<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050617-68032f49b2e48.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4f60\u53ef\u4ee5\u5728 ACL SQL \u4e2d\u4f7f\u7528\u4ee5\u4e0b\u5360\u4f4d\u7b26&#xff0c;\u6267\u884c\u65f6 EMQX \u5c06\u81ea\u52a8\u586b\u5145\u4e3a\u5ba2\u6237\u7aef\u4fe1\u606f&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">%u&#xff1a;\u7528\u6237\u540d<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">%c&#xff1a;Client ID<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">%C&#xff1a;TLS \u8bc1\u4e66\u516c\u7528\u540d&#xff08;\u8bc1\u4e66\u7684\u57df\u540d\u6216\u5b50\u57df\u540d&#xff09;&#xff0c;\u4ec5\u5f53 TLS \u8fde\u63a5\u65f6\u6709\u6548<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">%d&#xff1a;TLS \u8bc1\u4e66 subject&#xff0c;\u4ec5\u5f53 TLS \u8fde\u63a5\u65f6\u6709\u6548<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4f60\u53ef\u4ee5\u6839\u636e\u4e1a\u52a1\u9700\u8981\u8c03\u6574 ACL SQL&#xff0c;\u5982\u6dfb\u52a0\u591a\u4e2a\u67e5\u8be2\u6761\u4ef6\u3001\u4f7f\u7528\u6570\u636e\u5e93\u9884\u5904\u7406\u51fd\u6570&#xff0c;\u4ee5\u5b9e\u73b0\u66f4\u591a\u4e1a\u52a1\u76f8\u5173\u7684\u529f\u80fd\u3002\u4f46\u662f\u4efb\u4f55\u60c5\u51b5\u4e0b ACL SQL \u9700\u8981\u6ee1\u8db3\u4ee5\u4e0b\u6761\u4ef6&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u67e5\u8be2\u7ed3\u679c\u4e2d\u5fc5\u987b\u5305\u542b allow\u3001access\u3001topic\u3001clientid\u3001username\u3001ipaddr \u5b57\u6bb5&#xff0c;\u5982\u679c\u5b57\u6bb5\u4e0d\u60f3\u53c2\u4e0e\u6bd4\u5bf9\u5219\u4f7f\u7528\u00a0$all\u00a0\u5b57\u7b26\u4e32\u6216\u8005\u6570\u636e\u5e93\u00a0NULL\u00a0\u503c<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u67e5\u8be2\u7ed3\u679c\u53ef\u4ee5\u6709\u591a\u6761&#xff0c;\u591a\u6761\u7ed3\u679c\u65f6\u6309\u7167\u4ece\u4e0a\u5230\u4e0b\u7684\u987a\u5e8f\u8fdb\u884c\u5339\u914d<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u63d0\u793a<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u53ef\u4ee5\u5728 SQL \u4e2d\u8c03\u6574\u67e5\u8be2\u6761\u4ef6\u3001\u6307\u5b9a\u6392\u5e8f\u65b9\u5f0f\u5b9e\u73b0\u66f4\u9ad8\u6548\u7387\u7684\u67e5\u8be2\u3002<\/p>\n<h4 style=\"text-align:left\">4.2 ACL\u5168\u5c40\u914d\u7f6e<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4fee\u6539etc\/emqx.conf\u00a0\u4e2d\u7684 ACL \u914d\u7f6e<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050617-68032f49e152a.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;1&#xff09;acl_nomatch<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u00a0ACL \u672a\u5339\u914d\u65f6\u9ed8\u8ba4\u6388\u6743&#xff0c;deny\u62d2\u7edd\u6388\u6743<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;2&#xff09;acl_file<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u914d\u7f6e\u9ed8\u8ba4\u00a0ACL \u6587\u4ef6&#xff0c;\u4f7f\u7528\u6587\u4ef6\u5b9a\u4e49\u9ed8\u8ba4 ACL \u89c4\u5219<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;3&#xff09;acl_deny_action<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u914d\u7f6e ACL \u6388\u6743\u7ed3\u679c\u4e3a\u7981\u6b62\u7684\u54cd\u5e94\u52a8\u4f5c&#xff0c;\u4e3a\u00a0disconnect\u00a0\u65f6\u5c06\u65ad\u5f00\u8bbe\u5907<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;4&#xff09;enable_acl_cache<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">ACL \u7f13\u5b58\u5f00\u5173<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;5&#xff09;acl_cache_max_size<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5355\u4e2a\u5ba2\u6237\u7aef\u6700\u5927\u7f13\u5b58\u89c4\u5219\u6570\u91cf<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;6&#xff09;acl_cache_ttl<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7f13\u5b58\u5931\u6548\u65f6\u95f4&#xff0c;\u8d85\u65f6\u540e\u7f13\u5b58\u5c06\u88ab\u6e05\u9664<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">ACL \u7f13\u5b58\u5141\u8bb8\u5ba2\u6237\u7aef\u5728\u547d\u4e2d\u67d0\u6761 ACL \u89c4\u5219\u540e&#xff0c;\u4fbf\u5c06\u5176\u7f13\u5b58\u81f3\u5185\u5b58\u4e2d&#xff0c;\u4ee5\u4fbf\u4e0b\u6b21\u76f4\u63a5\u4f7f\u7528&#xff0c;\u5ba2\u6237\u7aef\u53d1\u5e03\u3001\u8ba2\u9605\u9891\u7387\u8f83\u9ad8\u7684\u60c5\u51b5\u4e0b\u5f00\u542f ACL \u7f13\u5b58\u53ef\u4ee5\u63d0\u9ad8 ACL \u68c0\u67e5\u6027\u80fd\u3002<\/p>\n<h4 style=\"text-align:left\">4.3 \u5185\u7f6eACL\u914d\u7f6e<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u901a\u8fc7etc\/acl.conf\u6587\u4ef6\u914d\u7f6eACL\u5185\u7f6e\u89c4\u5219<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"color:#343741\">\u5185\u7f6e ACL \u4f18\u5148\u7ea7\u6700\u4f4e&#xff0c;\u53ef\u4ee5\u88ab ACL \u63d2\u4ef6\u8986\u76d6&#xff0c;\u5982\u9700\u7981\u7528\u5168\u90e8\u6ce8\u91ca\u5373\u53ef\u3002\u89c4\u5219\u6587\u4ef6\u66f4\u6539\u540e\u9700\u91cd\u542f EMQX \u4ee5\u5e94\u7528\u751f\u6548\u3002<\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">\u5185\u7f6e ACL \u662f\u4f18\u5148\u7ea7\u6700\u4f4e\u89c4\u5219\u8868&#xff0c;\u5728\u6240\u6709\u7684 ACL \u68c0\u67e5\u5b8c\u6210\u540e&#xff0c;\u5982\u679c\u4ecd\u7136\u672a\u547d\u4e2d\u5219\u68c0\u67e5\u9ed8\u8ba4\u7684 ACL \u89c4\u5219\u3002<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">\u672c\u6587\u5728\u6b64\u914d\u7f6e\u51e0\u6761ACL\u9ed8\u8ba4\u89c4\u5219<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">&#xff08;1&#xff09;\u5141\u8bb8 &#034;dashboard&#034; \u7528\u6237 \u8ba2\u9605 &#034;$SYS\/#&#034; \u4e3b\u9898<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">{allow, {user, &#034;dashboard&#034;}, subscribe, [&#034;$SYS\/#&#034;]}.<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">&#xff08;2&#xff09; \u5141\u8bb8 IP \u5730\u5740\u4e3a &#034;127.0.0.1&#034; \u7684\u7528\u6237 \u53d1\u5e03\/\u8ba2\u9605 &#034;$SYS\/#&#034;&#xff0c;&#034;#&#034; \u4e3b\u9898<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">{allow, {ipaddr, &#034;127.0.0.1&#034;}, pubsub, [&#034;$SYS\/#&#034;, &#034;#&#034;]}.<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><span style=\"background-color:#ffffff\"><span style=\"color:#343741\">&#xff08;3&#xff09;\u62d2\u7edd &#034;\u6240\u6709\u7528\u6237&#034; \u8ba2\u9605 &#034;$SYS\/#&#034; &#034;#&#034; \u4e3b\u9898<\/span><\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">{deny, all, subscribe, [&#034;$SYS\/#&#034;, {eq, &#034;#&#034;}]}.<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050618-68032f4a16cf9.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">acl.conf\u5177\u4f53\u7f16\u5199\u89c4\u5219\u8bf7\u53c2\u8003\u5b98\u65b9\u6587\u6863<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5185\u7f6e ACL | EMQX 4.4 \u6587\u6863<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5c06\u6bcf\u4e2a\u8282\u70b9\u4e0a\u8ff0\u914d\u7f6e\u4fee\u6539\u5b8c\u6bd5\u540e\u91cd\u542f\u540e\u751f\u6548<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u91cd\u542fEMQX\u8282\u70b9\u547d\u4ee4<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">.\/bin\/emqx restart<\/p>\n<h4 style=\"text-align:left\">4.4 ACL\u529f\u80fd\u9a8c\u8bc1<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4f7f\u7528EMQX Dashboard Websocket\u5de5\u5177\u53ef\u4ee5\u8fdb\u884c\u7b80\u5355\u9a8c\u8bc1&#xff0c;\u5f00\u542ftopic\u53d1\u5e03\u8ba2\u9605ACL\u540e&#xff0c;\u5fc5\u987b\u5728mqtt_acl\u8868\u4e2d\u4e3a\u7528\u6237\u914d\u7f6etopic\u6743\u9650\u540e&#xff0c;\u7528\u6237\u624d\u53ef\u4ee5\u53d1\u5e03\u6216\u8ba2\u9605\u8be5topic\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5982\u4e0b\u56fe&#xff0c;\u4e3atest\u7528\u6237\u8d4b\u4e88test-topic\u4e3b\u9898\u7684\u53d1\u5e03\u8ba2\u9605\u6743\u9650<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050618-68032f4a34da9.png\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4f7f\u7528Websocket\u5de5\u5177\u8fdb\u884c\u9a8c\u8bc1&#xff1a;<\/p>\n<p style=\"text-align:justify\">&#xff08;1&#xff09;\u9996\u5148\u4f7f\u7528test\u7528\u6237\u8fde\u63a5\u670d\u52a1\u7aef<\/p>\n<p style=\"text-align:justify\">&#xff08;2&#xff09;\u8fde\u63a5\u670d\u52a1\u7aef\u540e\u5c1d\u8bd5\u8ba2\u9605\u5176\u4ed6\u672a\u6388\u6743\u4e3b\u9898\u4f1a\u663e\u793a\u8ba2\u9605\u5931\u8d25&#xff0c;\u53ea\u80fd\u8ba2\u9605test-topic&#xff0c;\u8ba2\u9605\u6210\u529f\u540e\u53ef\u4ee5\u5728\u8ba2\u9605\u6a21\u5757\u663e\u793a\u8ba2\u9605\u4fe1\u606f<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050618-68032f4a55486.png\" \/><\/p>\n<p style=\"text-align:justify\">\u00a0&#xff08;3&#xff09;\u5411\u5df2\u6388\u6743\u7684\u6307\u5b9atopic\u53d1\u9001\u4fe1\u606f<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"2025-04-194iygsajahvz.png\" \/><\/p>\n<p style=\"text-align:justify\">&#xff08;4&#xff09;\u5411\u672a\u6388\u6743\u7684topic\u53d1\u9001\u6d88\u606f<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5411\u672a\u6388\u6743\u7684topic\u53d1\u9001\u6d88\u606f\u65f6\u5728websocket\u5de5\u5177\u754c\u9762\u4ecd\u4f1a\u663e\u793a\u6d88\u606f\u5df2\u53d1\u51fa&#xff0c;\u4f46\u53ef\u4ee5\u5728emqx\u65e5\u5fd7\u67e5\u770b\u5230\u4e0d\u80fd\u5411\u672a\u6388\u6743\u7684topic\u53d1\u9001\u6d88\u606f\u3002<\/p>\n<p style=\"margin-left:.0001pt\"><img decoding=\"async\" alt=\"\" src=\"2025-04-19ldumay3ev3g.png\" \/><\/p>\n<h3 style=\"text-align:left\">5 EMQX\u7cfb\u7edf\u4f18\u5316<\/h3>\n<h4 style=\"text-align:left\">5.1 Linux \u64cd\u4f5c\u7cfb\u7edf\u53c2\u6570<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">1 \u7cfb\u7edf\u5168\u5c40\u5141\u8bb8\u5206\u914d\u7684\u6700\u5927\u6587\u4ef6\u53e5\u67c4\u6570:<\/p>\n<p># 2 millions system-wide<\/p>\n<p>sysctl -w fs.file-max&#061;2097152<\/p>\n<p>sysctl -w fs.nr_open&#061;2097152<\/p>\n<p>echo 2097152 &gt; \/proc\/sys\/fs\/nr_open <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">2 \u5141\u8bb8\u5f53\u524d\u4f1a\u8bdd \/ \u8fdb\u7a0b\u6253\u5f00\u6587\u4ef6\u53e5\u67c4\u6570:<\/p>\n<p>ulimit -n 1048576 <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">3 \/etc\/sysctl.conf<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6301\u4e45\u5316 &#039;fs.file-max&#039; \u8bbe\u7f6e\u5230 \/etc\/sysctl.conf \u6587\u4ef6:<\/p>\n<p>fs.file-max &#061; 1048576 <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">4 \/etc\/systemd\/system.conf \u8bbe\u7f6e\u670d\u52a1\u6700\u5927\u6587\u4ef6\u53e5\u67c4\u6570<\/p>\n<p>DefaultLimitNOFILE&#061;1048576 <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">5 \/etc\/security\/limits.conf<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\/etc\/security\/limits.conf \u6301\u4e45\u5316\u8bbe\u7f6e\u5141\u8bb8\u7528\u6237 \/ \u8fdb\u7a0b\u6253\u5f00\u6587\u4ef6\u53e5\u67c4\u6570:<\/p>\n<p>* \u00a0\u00a0\u00a0\u00a0\u00a0soft \u00a0\u00a0nofile \u00a0\u00a0\u00a0\u00a0\u00a01048576<\/p>\n<p>* \u00a0\u00a0\u00a0\u00a0\u00a0hard \u00a0\u00a0nofile \u00a0\u00a0\u00a0\u00a0\u00a01048576 <\/p>\n<h4 style=\"text-align:left\">5.2 TCP \u534f\u8bae\u6808\u7f51\u7edc\u53c2\u6570<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">1 \u5e76\u53d1\u8fde\u63a5 backlog \u8bbe\u7f6e:<\/p>\n<p>sysctl -w net.core.somaxconn&#061;32768<\/p>\n<p>sysctl -w net.ipv4.tcp_max_syn_backlog&#061;16384<\/p>\n<p>sysctl -w net.core.netdev_max_backlog&#061;16384 <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">2 \u53ef\u7528\u77e5\u540d\u7aef\u53e3\u8303\u56f4:<\/p>\n<p>sysctl -w net.ipv4.ip_local_port_range&#061;&#039;1000 65535&#039; <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">3 TCP Socket \u8bfb\u5199 Buffer \u8bbe\u7f6e:<\/p>\n<p>sysctl -w net.core.rmem_default&#061;262144<\/p>\n<p>sysctl -w net.core.wmem_default&#061;262144<\/p>\n<p>sysctl -w net.core.rmem_max&#061;16777216<\/p>\n<p>sysctl -w net.core.wmem_max&#061;16777216<\/p>\n<p>sysctl -w net.core.optmem_max&#061;16777216<\/p>\n<p>sysctl -w net.ipv4.tcp_rmem&#061;&#039;1024 4096 16777216&#039;<\/p>\n<p>sysctl -w net.ipv4.tcp_wmem&#061;&#039;1024 4096 16777216&#039; <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">4 TCP \u8fde\u63a5\u8ffd\u8e2a\u8bbe\u7f6e:<\/p>\n<p>sysctl -w net.netfilter.nf_conntrack_max&#061;1000000<\/p>\n<p>sysctl -w net.netfilter.nf_conntrack_tcp_timeout_time_wait&#061;30 <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">5 TIME-WAIT Socket \u6700\u5927\u6570\u91cf\u3001\u56de\u6536\u4e0e\u91cd\u7528\u8bbe\u7f6e:<\/p>\n<p>sysctl -w net.ipv4.tcp_max_tw_buckets&#061;1048576 <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">6 FIN-WAIT-2 Socket \u8d85\u65f6\u8bbe\u7f6e:<\/p>\n<p>sysctl -w net.ipv4.tcp_fin_timeout&#061;15 <\/p>\n<h4 style=\"text-align:left\">5.3 Erlang \u865a\u62df\u673a\u53c2\u6570<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4f18\u5316\u8bbe\u7f6e Erlang \u865a\u62df\u673a\u542f\u52a8\u53c2\u6570&#xff0c;\u914d\u7f6e\u6587\u4ef6 emqx\/etc\/emqx.conf:<\/p>\n<p>## Erlang Process Limit<\/p>\n<p>node.process_limit &#061; 2097152<\/p>\n<p>## Sets the maximum number of simultaneously existing ports for this system<\/p>\n<p>node.max_ports &#061; 1048576 <\/p>\n<h4 style=\"text-align:left\">5.4 EMQX \u6d88\u606f\u670d\u52a1\u5668\u53c2\u6570<\/h4>\n<p style=\"margin-left:.0001pt;text-align:justify\">ceptor \u6c60\u5927\u5c0f&#xff0c;\u6700\u5927\u5141\u8bb8\u8fde\u63a5\u6570\u3002\u00a0emqx\/etc\/emqx.conf<\/p>\n<p>## TCP Listener<\/p>\n<p>listener.tcp.external &#061; 0.0.0.0:1883<\/p>\n<p>listener.tcp.external.acceptors &#061; 64<\/p>\n<p>listener.tcp.external.max_connections &#061; 1024000 <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6ce8\u610f&#xff1a;EMQX\u8282\u70b9\u53c2\u6570\u7684\u914d\u7f6e\u9700\u8981\u91cd\u542f\u8282\u70b9\u540e\u751f\u6548<\/p>\n<h3 style=\"text-align:left\">6 \u9644\u5f55<\/h3>\n<h4 style=\"text-align:left\">6.1 openssl\u751f\u6210\u8bc1\u4e66<\/h4>\n<h5 style=\"text-align:justify\">6.1.1 \u751f\u6210\u81ea\u7b7e\u540d CA \u8bc1\u4e66<\/h5>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u9996\u5148&#xff0c;\u6211\u4eec\u9700\u8981\u4e00\u4e2a\u81ea\u7b7e\u540d\u7684 CA \u8bc1\u4e66\u3002\u751f\u6210\u8fd9\u4e2a\u8bc1\u4e66\u9700\u8981\u6709\u4e00\u4e2a\u79c1\u94a5\u4e3a\u5b83\u7b7e\u540d&#xff0c;\u53ef\u4ee5\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u751f\u6210\u79c1\u94a5&#xff1a;<\/p>\n<p>openssl genrsa -out ca.key 2048 <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8fd9\u4e2a\u547d\u4ee4\u5c06\u751f\u6210\u4e00\u4e2a\u5bc6\u94a5\u957f\u5ea6\u4e3a 2048 \u7684\u5bc6\u94a5\u5e76\u4fdd\u5b58\u5728\u00a0ca.key\u00a0\u4e2d\u3002\u6709\u4e86\u8fd9\u4e2a\u5bc6\u94a5&#xff0c;\u5c31\u53ef\u4ee5\u7528\u5b83\u6765\u751f\u6210 EMQX \u7684\u6839\u8bc1\u4e66\u4e86&#xff1a;<\/p>\n<p>openssl req -x509 -new -nodes -key ca.key -sha256 -days 3650 -out ca.pem <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6839\u8bc1\u4e66\u662f\u6574\u4e2a\u4fe1\u4efb\u94fe\u7684\u8d77\u70b9&#xff0c;\u5982\u679c\u4e00\u4e2a\u8bc1\u4e66\u7684\u6bcf\u4e00\u7ea7\u7b7e\u53d1\u8005\u5411\u4e0a\u4e00\u76f4\u5230\u6839\u8bc1\u4e66\u90fd\u662f\u53ef\u4fe1\u7684&#xff0c;\u90a3\u4e2a\u6211\u4eec\u5c31\u53ef\u4ee5\u8ba4\u4e3a\u8fd9\u4e2a\u8bc1\u4e66\u4e5f\u662f\u53ef\u4fe1\u7684\u3002\u6709\u4e86\u8fd9\u4e2a\u6839\u8bc1\u4e66&#xff0c;\u6211\u4eec\u5c31\u53ef\u4ee5\u7528\u5b83\u6765\u7ed9\u5176\u4ed6\u5b9e\u4f53\u7b7e\u53d1\u5b9e\u4f53\u8bc1\u4e66\u4e86\u3002<\/p>\n<h5 style=\"text-align:justify\">6.1.2 \u751f\u6210\u670d\u52a1\u7aef\u8bc1\u4e66<\/h5>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5b9e\u4f53&#xff08;\u5728\u8fd9\u91cc\u6307\u7684\u662f EMQX&#xff09;\u4e5f\u9700\u8981\u4e00\u4e2a\u81ea\u5df1\u7684\u79c1\u94a5\u5bf9\u6765\u4fdd\u8bc1\u5b83\u5bf9\u81ea\u5df1\u8bc1\u4e66\u7684\u63a7\u5236\u6743\u3002\u751f\u6210\u8fd9\u4e2a\u5bc6\u94a5\u7684\u8fc7\u7a0b\u548c\u4e0a\u9762\u7c7b\u4f3c&#xff1a;<\/p>\n<p>openssl genrsa -out emqx.key 2048 <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u65b0\u5efa\u00a0openssl.cnf\u00a0\u6587\u4ef6&#xff0c;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">req_distinguished_name &#xff1a;\u6839\u636e\u60c5\u51b5\u8fdb\u884c\u4fee\u6539&#xff0c;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">alt_names&#xff1a;\u00a0BROKER_ADDRESS\u00a0\u4fee\u6539\u4e3a EMQX \u670d\u52a1\u5668\u5b9e\u9645\u7684 IP \u6216 DNS \u5730\u5740&#xff0c;\u4f8b\u5982&#xff1a;IP.1 &#061; 127.0.0.1&#xff0c;\u6216 DNS.1 &#061; broker.xxx.com<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6ce8\u610f&#xff1a;IP \u548c DNS \u4e8c\u8005\u4fdd\u7559\u5176\u4e00\u5373\u53ef&#xff0c;\u5982\u679c\u5df2\u8d2d\u4e70\u57df\u540d&#xff0c;\u53ea\u9700\u4fdd\u7559 DNS \u5e76\u4fee\u6539\u4e3a\u4f60\u6240\u4f7f\u7528\u7684\u57df\u540d\u5730\u5740\u3002<\/p>\n<p>[req]<\/p>\n<p>default_bits \u00a0&#061; 2048<\/p>\n<p>distinguished_name &#061; req_distinguished_name<\/p>\n<p>req_extensions &#061; req_ext<\/p>\n<p>x509_extensions &#061; v3_req<\/p>\n<p>prompt &#061; no<\/p>\n<p>[req_distinguished_name]<\/p>\n<p>countryName &#061; CN<\/p>\n<p>stateOrProvinceName &#061; Zhejiang<\/p>\n<p>localityName &#061; Hangzhou<\/p>\n<p>organizationName &#061; EMQX<\/p>\n<p>commonName &#061; CA<\/p>\n<p>[req_ext]<\/p>\n<p>subjectAltName &#061; &#064;alt_names<\/p>\n<p>[v3_req]<\/p>\n<p>subjectAltName &#061; &#064;alt_names<\/p>\n<p>[alt_names]<\/p>\n<p>IP.1 &#061; BROKER_ADDRESS<\/p>\n<p>DNS.1 &#061; BROKER_ADDRESS <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7136\u540e\u4ee5\u8fd9\u4e2a\u5bc6\u94a5\u548c\u914d\u7f6e\u7b7e\u53d1\u4e00\u4e2a\u8bc1\u4e66\u8bf7\u6c42&#xff1a;<\/p>\n<p>openssl req -new -key .\/emqx.key -config openssl.cnf -out emqx.csr <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7136\u540e\u4ee5\u6839\u8bc1\u4e66\u6765\u7b7e\u53d1 EMQX \u7684\u5b9e\u4f53\u8bc1\u4e66&#xff1a;<\/p>\n<p>openssl x509 -req -in .\/emqx.csr -CA ca.pem -CAkey ca.key -CAcreateserial -out emqx.pem -days 3650 -sha256 -extensions v3_req -extfile openssl.cnf <\/p>\n<h5 style=\"text-align:justify\">6.1.3 \u751f\u6210\u5ba2\u6237\u7aef\u8bc1\u4e66<\/h5>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u53cc\u5411\u8fde\u63a5\u8ba4\u8bc1\u8fd8\u9700\u8981\u521b\u5efa\u5ba2\u6237\u7aef\u8bc1\u4e66&#xff0c;\u9996\u5148\u9700\u8981\u521b\u5efa\u5ba2\u6237\u7aef\u5bc6\u94a5&#xff1a;<\/p>\n<p>openssl genrsa -out client.key 2048 <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4f7f\u7528\u751f\u6210\u7684\u5ba2\u6237\u7aef\u5bc6\u94a5\u6765\u521b\u5efa\u4e00\u4e2a\u5ba2\u6237\u7aef\u8bf7\u6c42\u6587\u4ef6&#xff1a;<\/p>\n<p>openssl req -new -key client.key -out client.csr -subj &#034;\/C&#061;CN\/ST&#061;Zhejiang\/L&#061;Hangzhou\/O&#061;EMQX\/CN&#061;client&#034; <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6700\u540e\u4f7f\u7528\u5148\u524d\u751f\u6210\u597d\u7684\u670d\u52a1\u7aef CA \u8bc1\u4e66\u6765\u7ed9\u5ba2\u6237\u7aef\u7b7e\u540d&#xff0c;\u751f\u6210\u4e00\u4e2a\u5ba2\u6237\u7aef\u8bc1\u4e66&#xff1a;<\/p>\n<p>openssl x509 -req -days 3650 -in client.csr -CA ca.pem -CAkey ca.key -CAcreateserial -out client.pem <\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u51c6\u5907\u597d\u670d\u52a1\u7aef\u548c\u5ba2\u6237\u7aef\u8bc1\u4e66\u540e&#xff0c;\u6211\u4eec\u5c31\u53ef\u4ee5\u5728 EMQX \u4e2d\u542f\u7528 TLS\/SSL \u53cc\u5411\u8ba4\u8bc1\u529f\u80fd\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:left\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb7.3k\u6b21\uff0c\u70b9\u8d5e24\u6b21\uff0c\u6536\u85cf29\u6b21\u3002EMQX \u662f\u4e00\u6b3e\u5927\u89c4\u6a21\u53ef\u5f39\u6027\u4f38\u7f29\u7684\u4e91\u539f\u751f\u5206\u5e03\u5f0f\u7269\u8054\u7f51 MQTT \u6d88\u606f\u670d\u52a1\u5668\u3002\u4f5c\u4e3a\u5168\u7403\u6700\u5177\u6269\u5c55\u6027\u7684 MQTT \u6d88\u606f\u670d\u52a1\u5668\uff0cEMQX \u63d0\u4f9b\u4e86\u9ad8\u6548\u53ef\u9760\u6d77\u91cf\u7269\u8054\u7f51\u8bbe\u5907\u8fde\u63a5\uff0c\u80fd\u591f\u9ad8\u6027\u80fd\u5b9e\u65f6\u79fb\u52a8\u4e0e\u5904\u7406\u6d88\u606f\u548c\u4e8b\u4ef6\u6d41\u6570\u636e\uff0c\u5e2e\u52a9\u60a8\u5feb\u901f\u6784\u5efa\u5173\u952e\u4e1a\u52a1\u7684\u7269\u8054\u7f51\u5e73\u53f0\u4e0e\u5e94\u7528_emqx\u96c6\u7fa4<\/p>\n","protected":false},"author":2,"featured_media":25561,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[887,664,220],"topic":[],"class_list":["post-25581","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-iot","tag-664","tag-220"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>EMQX\u7269\u8054\u7f51MQTT\u6d88\u606f\u670d\u52a1\u5668\u96c6\u7fa4\u642d\u5efa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/25581.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"EMQX\u7269\u8054\u7f51MQTT\u6d88\u606f\u670d\u52a1\u5668\u96c6\u7fa4\u642d\u5efa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb7.3k\u6b21\uff0c\u70b9\u8d5e24\u6b21\uff0c\u6536\u85cf29\u6b21\u3002EMQX \u662f\u4e00\u6b3e\u5927\u89c4\u6a21\u53ef\u5f39\u6027\u4f38\u7f29\u7684\u4e91\u539f\u751f\u5206\u5e03\u5f0f\u7269\u8054\u7f51 MQTT \u6d88\u606f\u670d\u52a1\u5668\u3002\u4f5c\u4e3a\u5168\u7403\u6700\u5177\u6269\u5c55\u6027\u7684 MQTT \u6d88\u606f\u670d\u52a1\u5668\uff0cEMQX \u63d0\u4f9b\u4e86\u9ad8\u6548\u53ef\u9760\u6d77\u91cf\u7269\u8054\u7f51\u8bbe\u5907\u8fde\u63a5\uff0c\u80fd\u591f\u9ad8\u6027\u80fd\u5b9e\u65f6\u79fb\u52a8\u4e0e\u5904\u7406\u6d88\u606f\u548c\u4e8b\u4ef6\u6d41\u6570\u636e\uff0c\u5e2e\u52a9\u60a8\u5feb\u901f\u6784\u5efa\u5173\u952e\u4e1a\u52a1\u7684\u7269\u8054\u7f51\u5e73\u53f0\u4e0e\u5e94\u7528_emqx\u96c6\u7fa4\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/25581.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-19T05:06:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050613-68032f45cb5ef.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/25581.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/25581.html\",\"name\":\"EMQX\u7269\u8054\u7f51MQTT\u6d88\u606f\u670d\u52a1\u5668\u96c6\u7fa4\u642d\u5efa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-19T05:06:19+00:00\",\"dateModified\":\"2025-04-19T05:06:19+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/25581.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/25581.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/25581.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"EMQX\u7269\u8054\u7f51MQTT\u6d88\u606f\u670d\u52a1\u5668\u96c6\u7fa4\u642d\u5efa\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"EMQX\u7269\u8054\u7f51MQTT\u6d88\u606f\u670d\u52a1\u5668\u96c6\u7fa4\u642d\u5efa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/25581.html","og_locale":"zh_CN","og_type":"article","og_title":"EMQX\u7269\u8054\u7f51MQTT\u6d88\u606f\u670d\u52a1\u5668\u96c6\u7fa4\u642d\u5efa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb7.3k\u6b21\uff0c\u70b9\u8d5e24\u6b21\uff0c\u6536\u85cf29\u6b21\u3002EMQX \u662f\u4e00\u6b3e\u5927\u89c4\u6a21\u53ef\u5f39\u6027\u4f38\u7f29\u7684\u4e91\u539f\u751f\u5206\u5e03\u5f0f\u7269\u8054\u7f51 MQTT \u6d88\u606f\u670d\u52a1\u5668\u3002\u4f5c\u4e3a\u5168\u7403\u6700\u5177\u6269\u5c55\u6027\u7684 MQTT \u6d88\u606f\u670d\u52a1\u5668\uff0cEMQX \u63d0\u4f9b\u4e86\u9ad8\u6548\u53ef\u9760\u6d77\u91cf\u7269\u8054\u7f51\u8bbe\u5907\u8fde\u63a5\uff0c\u80fd\u591f\u9ad8\u6027\u80fd\u5b9e\u65f6\u79fb\u52a8\u4e0e\u5904\u7406\u6d88\u606f\u548c\u4e8b\u4ef6\u6d41\u6570\u636e\uff0c\u5e2e\u52a9\u60a8\u5feb\u901f\u6784\u5efa\u5173\u952e\u4e1a\u52a1\u7684\u7269\u8054\u7f51\u5e73\u53f0\u4e0e\u5e94\u7528_emqx\u96c6\u7fa4","og_url":"https:\/\/www.wsisp.com\/helps\/25581.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-19T05:06:19+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419050613-68032f45cb5ef.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"8 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/25581.html","url":"https:\/\/www.wsisp.com\/helps\/25581.html","name":"EMQX\u7269\u8054\u7f51MQTT\u6d88\u606f\u670d\u52a1\u5668\u96c6\u7fa4\u642d\u5efa - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-19T05:06:19+00:00","dateModified":"2025-04-19T05:06:19+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/25581.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/25581.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/25581.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"EMQX\u7269\u8054\u7f51MQTT\u6d88\u606f\u670d\u52a1\u5668\u96c6\u7fa4\u642d\u5efa"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/25581","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=25581"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/25581\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/25561"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=25581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=25581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=25581"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=25581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}