#author("2023-06-29T14:37:20+08:00","default:Admin","Admin")
#author("2023-06-29T14:38:24+08:00","default:Admin","Admin")
[[IoT]]

&color(red){※前提条件:本文基于 emqttd 2.2 创作};

#contents

* 下载 [#f70d056b]

现在的emqttd已经变为收费软件了,2.2版本已经无法下载了

安装

 [root@wt--1 ~]# rpm -ivh --force emqttd-centos7-v2.2.0-1.el7.centos.x86_64.rpm
 [root@wt--1 ~]# ls  ####===你会找不到安装了哪个包
 [root@wt--1 ~]# rpm -ql emqttd ###===/查看安装了哪些包

启动

 [root@wt--1 ~]# systemctl start emqttd  ###=====///启动服务

* 配置 [#jaed52b9]

* 设置 [#qc494182]

在 emqx.conf中设置

allow_anonymous = false


不能在emqx_auth_username.conf中直接添加用户名密码,会导致程序启动失败,应该在WEB控制台或者命令行启用用户名认证,然后用命令行添加用户名和密码:

启用认证插件:

 emqx_ctl plugins load emqx_auth_username  

添加用户名及密码

 emqx_ctl users add admin 12345678

查看用户名列表

 emqx_ctl users list

删除用户名

 emqx_ctl users del admin

** 重启服务 [#j8b53474]

改了 etc 下的 emq.conf 需要重新启动一次服务

下面命令无法重启服务时:

 /sbin/emqttd restart

关闭emqtt服务

 /sbin/emqttd stop

然后下面的命令查看emqtt的守护进程

 ps -aux | grep emq
 root      71296  0.0  0.0  11624   340 ?        S    Jun03   0:06 /root/emqtt/emqttd-centos7-v2.2.0/emqttd/erts-8.3/bin/epmd -daemon
 root      76234  0.0  0.0 112712   984 pts/1    S+   14:40   0:00 grep --color=auto emq


用kill 命令结束这个守护进程

 kill <进程id>

然后再启动 emqtt服务

 /sbin/emqttd start


* 用户设置 [#nf3644a6]

启用 emq_auth_username 插件:

#codeprettify{{
/sbin/emqttd_ctl plugins load emq_auth_username
}}

在下面的文件中,配置默认用户,密码使用明文的

 /etc/plugins/emq_auth_username.conf 


参考网址
 http://runxinzhi.com/lexiaofei-p-8397888.html

#hr();
コメント:
#comment_kcaptcha

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS