1.打开cmd,执行命令,拉取eclipse-mosquitto镜像
docker pull eclipse-mosquitto
2.变更mosquitto的配置文件
2.1打开镜像的控制台

2.2执行下面的命令,编辑配置文件
cd /mosquitto/config
vi mosquitto.conf

2.3给配置文件中追加一下三行
listener 1883
allow_anonymous false
password_file /mosquitto/config/pwdfile.conf

2.4退出vim模式,执行以下命令,设置用户密码
touch pwdfile.conf
mosquitto_passwd -b pwdfile.conf test test2020
pwdfile.conf 为存储密码信息的文件要和2.3password_file项目的文件名称保持一致
test为用户名
test2020为用户密码
2.5重启服务

782

被折叠的 条评论
为什么被折叠?



