j8typz 发表于 2024-10-3 12:54:23

开源物联网MQTT 5.0服务器——EMQ安装及运行教程


    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/92e1c55b8e904f0495e42e5602a3665d~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728099195&amp;x-signature=d003DyRK0CppkKykffIwt5g%2BkS0%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">1、</span>安装预置<span style="color: black;">要求</span></h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">EMQ X <span style="color: black;">能够</span>跨平台运行在 Linux、FreeBSD、MacOS 或 Windows 服务器<span style="color: black;">乃至</span>是树莓派上。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">服务器最低配置为 512MB 内存且<span style="color: black;">最少</span><span style="color: black;">保存</span> 1 GB 以上硬盘空间。</p>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">2、</span>二进制包安装</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">EMQ 官网 <span style="color: black;">供给</span>热门 Linux 发行版、MacOS、Windows 操作系统以及 Docker 镜像的二进制包下载,当前支持的操作系统及平台请到官网下载页查阅。</p>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">3、</span>源码编译安装</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">部分官网未<span style="color: black;">供给</span>二进制包的操作系统与平台如 Linux ARM、FreeBSB,可<span style="color: black;">运用</span>源码编译安装。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">EMQ X 基于 Erlang/OTP 平台<span style="color: black;">研发</span>,项目托管的 GitHub 管理<span style="color: black;">守护</span>,源码编译依赖 Erlang 环境和 git 客户端。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">EMQ X 3.0+ 依赖 Erlang R21+ 版本。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">EMQ X Enterprise 暂未<span style="color: black;">供给</span>源码编译安装,如有特殊运行环境<span style="color: black;">需要</span>请联系 contact@emqx.io</p>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">4、</span>首次安装 EMQ X</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在安装 EMQ X 前,请确认安装的 前置<span style="color: black;">要求</span> 都<span style="color: black;">已然</span>满足。</p>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;">版本<span style="color: black;">选取</span></h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">EMQ X 支持多种操作系统,请<span style="color: black;">选取</span>合适您的版本下载。</p>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;">1、在 Linux 下安装</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">针对</span> Linux 发布,EMQ X <span style="color: black;">供给</span>两种方式的安装。一是基于各 linux 发布的安装包。用安装包安装 EMQ X 以后,<span style="color: black;">能够</span>方便的<span style="color: black;">运用</span>系统管理工具来启停 EMQ X 服务。二是<span style="color: black;">运用</span> zip 压缩打包的通用包。安装 zip 包只需解压 zip 文件<span style="color: black;">就可</span>。<span style="color: black;">运用</span> zip 包<span style="color: black;">能够</span>实<span style="color: black;">此刻</span>同一个系统下安装多套 EMQ X。在<span style="color: black;">研发</span> / 实验室环境下<span style="color: black;">运用</span> zip 包安装 EMQ X 非常实用。</p>
    <h3 style="color: black; text-align: left; margin-bottom: 10px;">CentOS/RHEL</h3>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">日前</span> EMQ X 支持 CentOS/RHEL 6 和 7,在这两个版本上的安装过程一致。以下安装过程以 CentOS 7 为例。</p><span style="color: black;">运用</span> zip 包安装<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">解压 zip 文件</p><span style="color: black;">unzip</span> <span style="color: black;">emqx-centos7-v3</span><span style="color: black;">.0</span><span style="color: black;">.zip</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">起步</span>以<span style="color: black;">掌控</span>台调试模式 emqx,<span style="color: black;">检测</span> EMQ X <span style="color: black;">是不是</span><span style="color: black;">能够</span>正常<span style="color: black;">起步</span>:</p><span style="color: black;">cd</span> emqx &amp;&amp; ./bin/emqx console<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">倘若</span>安装成功,<span style="color: black;">能够</span>在<span style="color: black;">掌控</span>台看到以下输出:</p>starting emqx <span style="color: black;">on</span>node<span style="color: black;">emqx@127.0.0.1</span>emqx ctl <span style="color: black;">is</span> starting...emqx hook <span style="color: black;">is</span> starting...emqx router <span style="color: black;">is</span> starting...emqx pubsub <span style="color: black;">is</span> starting...emqx stats <span style="color: black;">is</span> starting...emqx metrics <span style="color: black;">is</span>starting...emqx pooler<span style="color: black;">is</span> starting...emqx trace <span style="color: black;">is</span> starting...emqx client manager <span style="color: black;">is</span> starting...emqx session manager <span style="color: black;">is</span> starting...emqx session supervisor <span style="color: black;">is</span>starting...emqx wsclient supervisor<span style="color: black;">is</span> starting...emqx broker <span style="color: black;">is</span> starting...emqx alarm <span style="color: black;">is</span> starting...emqx mod supervisor <span style="color: black;">is</span> starting...emqx bridge supervisor <span style="color: black;">is</span>starting...emqx access control<span style="color: black;">is</span> starting...emqx system monitor <span style="color: black;">is</span> starting...dashboard:http listen <span style="color: black;">on</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span>:<span style="color: black;">18083</span> with <span style="color: black;">2</span> acceptors.mqtt:tcp listen <span style="color: black;">on</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span>:<span style="color: black;">1883</span>with<span style="color: black;">8</span> acceptors.mqtt:ssl listen <span style="color: black;">on</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span>:<span style="color: black;">8883</span> with <span style="color: black;">4</span> acceptors.mqtt:ws listen <span style="color: black;">on</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span>:<span style="color: black;">8083</span> with <span style="color: black;">4</span> acceptors.Erlang MQTT Broker <span style="color: black;">3.0</span> <span style="color: black;">is</span> running now<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">CTRL+C 关闭<span style="color: black;">掌控</span>台。<span style="color: black;">保护</span>进程模式<span style="color: black;">起步</span>:</p>./bin/emqx <span style="color: black;">start</span><span style="color: black;">运用</span> rpm 包安装<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在 CentOS 下<span style="color: black;">运用</span> rpm 工具安装 EMQ X:</p><span style="color: black;">rpm</span> <span style="color: black;">-ivh</span> <span style="color: black;">emqx-centos7-v3</span><span style="color: black;">.0-beta</span><span style="color: black;">.4</span><span style="color: black;">.rpm</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在安装完成之后,EMQ X 的配置文件、日志文件和数据文件分别在以下目录:系统配置文件:/etc/emqx/emqx.conf插件配置文件: /etc/emqx/plugins/*.conf日志文件: /var/log/emqx数据文件: /var/lib/emqx/</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在命令行启停 EMQ X:</p>systemctl <span style="color: black;">start</span>|<span style="color: black;">stop</span>|restart emqx.service<h3 style="color: black; text-align: left; margin-bottom: 10px;">Ubuntu</h3>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">日前</span> EMQ X 支持 Ubuntu 12.04、14.04、16.04 和 18.04,在这些版本上的安装过程一致。以下安装过程以 Ubuntu 18.04 为例。</p><span style="color: black;">运用</span> zip 包安装<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">解压 zip 文件</p><span style="color: black;">unzip</span> <span style="color: black;">emqx-ubuntu18</span><span style="color: black;">.04-v3</span><span style="color: black;">.0</span><span style="color: black;">.zip</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">起步</span>以<span style="color: black;">掌控</span>台调试模式 emqx,<span style="color: black;">检测</span> EMQ X <span style="color: black;">是不是</span><span style="color: black;">能够</span>正常<span style="color: black;">起步</span>:</p><span style="color: black;">cd</span> emqx &amp;&amp; ./bin/emqx console<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">倘若</span>安装成功,<span style="color: black;">能够</span>在<span style="color: black;">掌控</span>台看到以下输出:</p>starting emqx <span style="color: black;">on</span> node <span style="color: black;">emqx@127.0.0.1</span>emqx ctl <span style="color: black;">is</span> starting...emqx hook <span style="color: black;">is</span> starting...emqx router <span style="color: black;">is</span>starting...emqx pubsub<span style="color: black;">is</span> starting...emqx stats <span style="color: black;">is</span> starting...emqx metrics <span style="color: black;">is</span> starting...emqx pooler <span style="color: black;">is</span> starting...emqx trace <span style="color: black;">is</span> starting...emqx client manager <span style="color: black;">is</span>starting...emqx session manager<span style="color: black;">is</span> starting...emqx session supervisor <span style="color: black;">is</span> starting...emqx wsclient supervisor <span style="color: black;">is</span> starting...emqx broker <span style="color: black;">is</span> starting...emqx alarm <span style="color: black;">is</span>starting...emqx mod supervisor<span style="color: black;">is</span> starting...emqx bridge supervisor <span style="color: black;">is</span> starting...emqx access control <span style="color: black;">is</span> starting...emqx system monitor <span style="color: black;">is</span>starting...dashboard:http listen<span style="color: black;">on</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span>:<span style="color: black;">18083</span> with <span style="color: black;">2</span> acceptors.mqtt:tcp listen <span style="color: black;">on</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span>:<span style="color: black;">1883</span> with <span style="color: black;">8</span> acceptors.mqtt:ssl listen <span style="color: black;">on</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span>:<span style="color: black;">8883</span> with <span style="color: black;">4</span> acceptors.mqtt:ws listen <span style="color: black;">on</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span>:<span style="color: black;">8083</span> with <span style="color: black;">4</span> acceptors.Erlang MQTT Broker <span style="color: black;">3.0</span> <span style="color: black;">is</span> running now<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">CTRL+C 关闭<span style="color: black;">掌控</span>台。<span style="color: black;">保护</span>进程模式<span style="color: black;">起步</span>:</p>./bin/emqx <span style="color: black;">start</span><span style="color: black;">运用</span> deb 包安装<span style="color: black;">sudo</span> <span style="color: black;">dp<span style="color: black;">公斤</span></span> <span style="color: black;">-i</span> <span style="color: black;">emqx-ubuntu18</span><span style="color: black;">.04-v3</span><span style="color: black;">.0_amd64</span><span style="color: black;">.deb</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在安装完成之后,EMQ X 的配置文件、日志文件和数据文件分别在以下目录:系统配置文件:/etc/emqx/emqx.conf插件配置文件: /etc/emqx/plugins/*.conf日志文件: /var/log/emqx数据文件: /var/lib/emqx/</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在命令行启停 EMQ X:</p>service emqx <span style="color: black;">start</span>|<span style="color: black;">stop</span>|restart<h3 style="color: black; text-align: left; margin-bottom: 10px;">Debian</h3>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">日前</span> EMQ X 支持 Debian 7、8 和 9,在这些版本上的安装过程一致。以下安装过程以 Debian 9 为例。</p><span style="color: black;">运用</span> zip 包安装<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">解压 zip 文件</p><span style="color: black;">unzip</span> <span style="color: black;">emqx-debian9-v3</span><span style="color: black;">.0</span><span style="color: black;">.zip</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">起步</span>以<span style="color: black;">掌控</span>台调试模式 emqx,<span style="color: black;">检测</span> EMQ X <span style="color: black;">是不是</span><span style="color: black;">能够</span>正常<span style="color: black;">起步</span>:</p><span style="color: black;">cd</span> emqx &amp;&amp; ./bin/emqx console<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">倘若</span>安装成功,<span style="color: black;">能够</span>在<span style="color: black;">掌控</span>台看到以下输出:</p>starting emqx <span style="color: black;">on</span> node <span style="color: black;">emqx@127.0.0.1</span>emqx ctl <span style="color: black;">is</span> starting...emqx hook <span style="color: black;">is</span> starting...emqx router <span style="color: black;">is</span> starting...emqx pubsub <span style="color: black;">is</span> starting...emqx stats <span style="color: black;">is</span> starting...emqx metrics <span style="color: black;">is</span> starting...emqx pooler <span style="color: black;">is</span> starting...emqx trace <span style="color: black;">is</span> starting...emqx client manager <span style="color: black;">is</span> starting...emqx session manager <span style="color: black;">is</span> starting...emqx session supervisor <span style="color: black;">is</span> starting...emqx wsclient supervisor <span style="color: black;">is</span> starting...emqx broker <span style="color: black;">is</span>starting...emqx alarm<span style="color: black;">is</span> starting...emqx mod supervisor <span style="color: black;">is</span> starting...emqx bridge supervisor <span style="color: black;">is</span> starting...emqx access control <span style="color: black;">is</span> starting...emqx system monitor <span style="color: black;">is</span>starting...dashboard:http listen<span style="color: black;">on</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span>:<span style="color: black;">18083</span> with <span style="color: black;">2</span> acceptors.mqtt:tcp listen <span style="color: black;">on</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span>:<span style="color: black;">1883</span> with <span style="color: black;">8</span> acceptors.mqtt:ssl listen <span style="color: black;">on</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span>:<span style="color: black;">8883</span> with <span style="color: black;">4</span> acceptors.mqtt:ws listen <span style="color: black;">on</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span>:<span style="color: black;">8083</span> with <span style="color: black;">4</span> acceptors.Erlang MQTT Broker <span style="color: black;">3.0</span> <span style="color: black;">is</span> running now<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">CTRL+C 关闭<span style="color: black;">掌控</span>台。<span style="color: black;">保护</span>进程模式<span style="color: black;">起步</span>:</p>./bin/emqx <span style="color: black;">start</span><span style="color: black;">运用</span> deb 包安装<span style="color: black;">sudo</span> <span style="color: black;">dp<span style="color: black;">公斤</span></span> <span style="color: black;">-i</span> <span style="color: black;">emqx-debian9-v3</span><span style="color: black;">.0_amd64</span><span style="color: black;">.deb</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在安装完成之后,EMQ X 的配置文件、日志文件和数据文件分别在以下目录:系统配置文件:/etc/emqx/emqx.conf插件配置文件: /etc/emqx/plugins/*.conf日志文件: /var/log/emqx数据文件: /var/lib/emqx/</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在命令行启停 EMQ X:</p>service emqx<span style="color: black;">start</span>|<span style="color: black;">stop</span>|restart<h2 style="color: black; text-align: left; margin-bottom: 10px;">2、在 MacOS 下安装</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">日前</span> EMQ X 在 MacOS 下<span style="color: black;">供给</span> zip 包安装:解压 zip 文件</p><span style="color: black;">unzip</span> <span style="color: black;">emqx-macos-v3</span><span style="color: black;">.0</span><span style="color: black;">.zip</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">起步</span>以<span style="color: black;">掌控</span>台调试模式 emqx,<span style="color: black;">检测</span> EMQ X <span style="color: black;">是不是</span><span style="color: black;">能够</span>正常<span style="color: black;">起步</span>:</p><span style="color: black;">cd</span>emqx &amp;&amp; ./bin/emqx console<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">倘若</span>安装成功,<span style="color: black;">能够</span>在<span style="color: black;">掌控</span>台看到以下输出:</p>starting emqx <span style="color: black;">on</span> node <span style="color: black;">emqx@127.0.0.1</span>emqx ctl <span style="color: black;">is</span> starting...emqx hook <span style="color: black;">is</span> starting...emqx router <span style="color: black;">is</span> starting...emqx pubsub <span style="color: black;">is</span>starting...emqx stats<span style="color: black;">is</span> starting...emqx metrics <span style="color: black;">is</span> starting...emqx pooler <span style="color: black;">is</span> starting...emqx trace <span style="color: black;">is</span> starting...emqx client manager <span style="color: black;">is</span>starting...emqx session manager<span style="color: black;">is</span> starting...emqx session supervisor <span style="color: black;">is</span> starting...emqx wsclient supervisor <span style="color: black;">is</span> starting...emqx broker <span style="color: black;">is</span> starting...emqx alarm <span style="color: black;">is</span>starting...emqx mod supervisor<span style="color: black;">is</span> starting...emqx bridge supervisor <span style="color: black;">is</span> starting...emqx access control <span style="color: black;">is</span> starting...emqx system monitor <span style="color: black;">is</span> starting...dashboard:http listen <span style="color: black;">on</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span>:<span style="color: black;">18083</span> with <span style="color: black;">2</span> acceptors.mqtt:tcp listen <span style="color: black;">on</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span>:<span style="color: black;">1883</span> with <span style="color: black;">8</span> acceptors.mqtt:ssl listen <span style="color: black;">on</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span>:<span style="color: black;">8883</span> with <span style="color: black;">4</span> acceptors.mqtt:ws listen <span style="color: black;">on</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span>:<span style="color: black;">8083</span> with <span style="color: black;">4</span>acceptors.Erlang MQTT Broker<span style="color: black;">3.0</span> <span style="color: black;">is</span> running now<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">CTRL+C 关闭<span style="color: black;">掌控</span>台。<span style="color: black;">保护</span>进程模式<span style="color: black;">起步</span>:</p>./bin/emqx <span style="color: black;">start</span>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;">3、在 Microsoft Windows 下安装</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">日前</span> EMQ X 在 Windows 下<span style="color: black;">供给</span> zip 包安装。程序包下载解压后,打开 Windows 命令行窗口,cd 到程序目录。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">掌控</span>台模式<span style="color: black;">起步</span>:</p>bin\emqx <span style="color: black;">console</span>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;">4、在 Docker 中安装</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">解压 emqx docker 镜像包:</p><span style="color: black;">unzip</span> <span style="color: black;">emqx-docker-v3</span><span style="color: black;">.0</span><span style="color: black;">.zip</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">加载镜像:</p><span style="color: black;">docker</span> <span style="color: black;">load</span> &lt; <span style="color: black;">emqx-docker-v3</span><span style="color: black;">.0</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">起步</span>容器:</p><span style="color: black;">docker</span> <span style="color: black;">run</span> <span style="color: black;">-tid</span> <span style="color: black;">--name</span> <span style="color: black;">emq30</span> <span style="color: black;">-p</span> 1883<span style="color: black;">:1883</span> <span style="color: black;">-p</span> 8083<span style="color: black;">:8083</span> <span style="color: black;">-p</span> 8883<span style="color: black;">:8883</span> <span style="color: black;">-p</span> 8084<span style="color: black;">:8084</span> <span style="color: black;">-p</span> 18083<span style="color: black;">:18083</span> <span style="color: black;">emqx-docker-v3</span><span style="color: black;">.0</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">停止容器:</p><span style="color: black;">docker</span> stop emq30<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">开启容器:</p><span style="color: black;">docker</span> start emq30<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">进入 Docker <span style="color: black;">掌控</span>台:</p>docker <span style="color: black;">exec</span>-it emq30 /bin/sh<h2 style="color: black; text-align: left; margin-bottom: 10px;">5、<span style="color: black;">运用</span>源代码安装</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">EMQ X <span style="color: black;">信息</span>服务器基于 Erlang/OTP 平台<span style="color: black;">研发</span>,项目托管的 GitHub 管理<span style="color: black;">守护</span>,源码编译依赖 Erlang 环境和 git 客户端。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">本文以下说明适合 Linux 环境。</p><span style="color: black;">重视</span>:EMQ X 3.0 依赖 Erlang R21 + 版本 *<span style="color: black;">怎样</span>安装 Erlang 请参考Erlang 官方网站*<span style="color: black;">怎样</span>安装和<span style="color: black;">运用</span> git 客户端请参考git-scm*在准备好编译环境之后,clone 代码边并使编译:<span style="color: black;">git</span>clone -b win30 https://github.com/emqx/emqx-rel.gitcd emqx-relx &amp;&amp; makecd _rel/emqx &amp;&amp; ./bin/emqx console<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在编译成功后,程序包发布目录:</p>_rel/emqx<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">从<span style="color: black;">掌控</span>台<span style="color: black;">起步</span>程序:</p>&nbsp;复制代码<span style="color: black;">cd</span> _rel/emqx &amp;&amp; ./bin/emqx console<h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">5、</span>首次运行 EMQ X</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在安装以后您<span style="color: black;">能够</span>直接运行 EMQ X 来<span style="color: black;">得到</span>最初步的经验。除了在<span style="color: black;">掌控</span>台,您<span style="color: black;">亦</span><span style="color: black;">能够</span><span style="color: black;">经过</span>浏览器<span style="color: black;">拜访</span> http://127.0.0.1:18083 来<span style="color: black;">运用</span> EMQ X 的 Web 管理<span style="color: black;">掌控</span>界面。默认的登录名是 admin 和<span style="color: black;">秘码</span>是 public。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">经过</span>浏览器<span style="color: black;">拜访</span> http://127.0.0.1:18083,您将看到一个 EMQ X 登录界面:</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/c1d6d66087ec4f1a9a6e2ca85a0b4abc~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728099195&amp;x-signature=PEiiyscFhFchjYSv9ktwfttESIc%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在输入用户名和<span style="color: black;">秘码</span>后,您就<span style="color: black;">能够</span><span style="color: black;">运用</span> EMQ X Dashboard 的各项功能。在首次登录后,您看到的将是 EMQ X <span style="color: black;">掌控</span>台的信息汇总。这个页面<span style="color: black;">表示</span>了系统信息,节点信息,运行统计和<span style="color: black;">有些</span>统计指标。</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p26-sign.toutiaoimg.com/pgc-image/d4523288f353425387d24544a1f3397b~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728099195&amp;x-signature=ThCGjJWnLDGwXpe7dKea%2Bq8yzS8%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">您<span style="color: black;">亦</span><span style="color: black;">能够</span>对 EMQ X 做些简单的配置,让它适配您的运行环境和<span style="color: black;">需要</span>。</p>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;">对 EMQ X 进行简单的配置</h2>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">所有对 EMQ X 的配置都<span style="color: black;">能够</span><span style="color: black;">经过</span>修改配置文件完成。配置文件的位置:</p>etc/emqx.conf : EMQ X 服务器的参数设置etc/plugins/*.conf : EMQ X 插件配置文件,<span style="color: black;">每一个</span>插件都有单独的配置文件。<span style="color: black;">有些</span>常用功能的配置<span style="color: black;">亦</span>在 Web Dashboard 上进行修改。<h3 style="color: black; text-align: left; margin-bottom: 10px;">更改 Dashboard 界面语言</h3>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在 Web 界面上<span style="color: black;">选取</span> ADMIN -&gt; Settings 菜单,您<span style="color: black;">能够</span>改变 Dashboard <span style="color: black;">运用</span>的语言,点击 Apply 后生效。<span style="color: black;">日前</span> EMQ X 支持中文和英文。</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/ba8ccf9046e64e82b00f7517ac570383~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728099195&amp;x-signature=RhcEKKf%2FQXa5ByNibMKDi7EOxo8%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <h3 style="color: black; text-align: left; margin-bottom: 10px;">修改 Dashboard 默认登录名和<span style="color: black;">秘码</span></h3>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">Dashboard 插件以 Web 界面的方式<span style="color: black;">供给</span>对 EMQ X 的管理和<span style="color: black;">掌控</span>功能,是 EMQ X 的默认随系统<span style="color: black;">起步</span>的插件之一。在安装以后,您<span style="color: black;">能够</span><span style="color: black;">经过</span>编辑配置文件的方式来改变 Dashboard 默认的用户名和<span style="color: black;">秘码</span>。配置文件:</p>etc/plugins/emqx_dashboard.conf<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">修改以下两行内容,将等号右侧值改为需要的值:</p><span style="color: black;">dashboard.default_user.login</span>= admindashboard.default_user.password = public<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">或</span>以 Web 方式管理 Dashboard 用户。在 ADMIN -&gt; Users 菜单下,您<span style="color: black;">能够</span>修改用户<span style="color: black;">秘码</span>和<span style="color: black;">增多</span> / 删除用户。admin 用户只能修改<span style="color: black;">秘码</span>,<span style="color: black;">不可</span>被删除。</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/053742cc05994c1586ab83fd92230fd1~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728099195&amp;x-signature=oT%2B%2FgU0iBI8FAKlXrxMc7cjuD6w%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <h3 style="color: black; text-align: left; margin-bottom: 10px;">配置端口</h3>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在安装以后,EMQ X 默认会<span style="color: black;">运用</span>以下端口:</p>1883: MQTT 协议端口8883: MQTT/SSL 端口8083: MQTT/WebSocket 端口8080: HTTP API 端口18083: Dashboard 管理<span style="color: black;">掌控</span>台端口<span style="color: black;">根据</span>安装环境需要,<span style="color: black;">能够</span>修改以上端口。<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">修改协议端口请编辑 EMQ X 系统配置文件etc/emqx.conf,找到以下各行,并按需要修改端口号:</p><span style="color: black;">listener.tcp.external</span> <span style="color: black;">=</span> <span style="color: black;">0.0</span><span style="color: black;">.0</span><span style="color: black;">.0</span><span style="color: black;">:1883listener.ssl.external</span> <span style="color: black;">=</span> <span style="color: black;">8883listener.ws.external</span> <span style="color: black;">=</span> <span style="color: black;">8083</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">修改 HTTP API 端口请编辑 emqx_management 插件的配置文件</p>etc/plugins/emqx_management.conf,找到下述行,并按需修改端口号:<span style="color: black;">management.listener.http</span> = <span style="color: black;">8080</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">修改 Dashboard 管理<span style="color: black;">掌控</span>台端口请编辑 emqx_dashboard 插件的配置文件</p>etc/plugins/emqx_dashboard.conf, 找到下述行,并按需修改端口号:<span style="color: black;">dashboard.listener.http</span> = <span style="color: black;">18083</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在 Web Dashboard 的 MANAGEMENT -&gt; Listeners 菜单下,<span style="color: black;">能够</span>查看<span style="color: black;">此刻</span>正在<span style="color: black;">运用</span>的监听器端口和属性。</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/053742cc05994c1586ab83fd92230fd1~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728099195&amp;x-signature=oT%2B%2FgU0iBI8FAKlXrxMc7cjuD6w%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">起步</span> / 停止插件</h3>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">插件是 EMQ X 的重要部分,EMQ X 的扩展功能基本都是<span style="color: black;">经过</span>插件实现的。<span style="color: black;">包含</span> Dashbard <span style="color: black;">亦</span>是插件实现。您<span style="color: black;">能够</span><span style="color: black;">经过</span>随软件附带的命令行工具 emqx_ctl 来<span style="color: black;">起步</span>和停止各个插件。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">起步</span>插件:</p>bin/emqx_ctl plugins <span style="color: black;">load</span> plugin_name<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">停止插件:</p>bin/emqx_ctl plugins unload plugin_name<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">您<span style="color: black;">亦</span><span style="color: black;">能够</span>在 Dashboard 的 MANAGEMENT -&gt; plugins 菜单下<span style="color: black;">起步</span>和停止插件,或对插件进行简单的配置。</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/b6eac5a874a7473ea2514fabf63114a2~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728099195&amp;x-signature=caFm5z29q1%2Bmzh9IhzmmHR6SXlY%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">EMQ X 的 Dashboard 本身<span style="color: black;">亦</span>是一个插件,<span style="color: black;">倘若</span>您在 Web 界面下停止了 Dashboard 插件,您将<span style="color: black;">没法</span>再<span style="color: black;">运用</span> dashboard,直至您<span style="color: black;">运用</span>命令行工具再次<span style="color: black;">起步</span> Dashboard。</p>
    <h3 style="color: black; text-align: left; margin-bottom: 10px;">修改 Erlang 虚拟机<span style="color: black;">起步</span>参数</h3>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">EMQ X 运行在 Erlang 虚拟机上,在etc/emqx.conf中有两个限定了虚拟机<span style="color: black;">准许</span>的最大连接数。在运行 EMQ X 前<span style="color: black;">能够</span>修改这两个参数以适配连接<span style="color: black;">需要</span>:</p>node.process_limit : Erlang 虚拟机<span style="color: black;">准许</span>的最大进程数,EMQ X 一个连接会消耗 2 个 Erlang 进程;node.max_ports : Erlang 虚拟机<span style="color: black;">准许</span>的最大 Port 数量,EMQ X 一个连接消耗 1 个 Port在 Erlang 虚拟机中的 Port 概念并不是 TCP 端口,<span style="color: black;">能够</span>近似的理解为文件句柄。*<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">这两个参数<span style="color: black;">能够</span>设置为:</p>node.process_limit: 大于最大<span style="color: black;">准许</span>连接数 * 2node.max_ports: 大于最大<span style="color: black;">准许</span>连接数<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/594d1fa50e5148f2aafee4576abc4e20~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728099195&amp;x-signature=RN8dmkBYup6DR%2FhcY%2BtvwlhyGNc%3D" style="width: 50%; margin-bottom: 20px;"></div>




qzmjef 发表于 2024-10-10 15:29:36

你字句如珍珠,我珍藏这份情。

wrjc1hod 发表于 2024-10-30 19:41:14

你的努力一定会被看见,相信自己,加油。

4lqedz 发表于 4 天前

太棒了、厉害、为你打call、点赞、非常精彩等。

4zhvml8 发表于 4 天前

我深受你的启发,你的话语是我前进的动力。
页: [1]
查看完整版本: 开源物联网MQTT 5.0服务器——EMQ安装及运行教程