- 安装mosquitto-2.0.14-install-windows-x64.exe
- 修改配置文件C:\Program Files\mosquitto\mosquitto.conf
listener 1883 0.0.0.0
log_dest file mosquitto.log
allow_anonymous false
acl_file aclfile
password_file pwfile
- 在管理员权限下的cmd下输入mosquitto_passwd -c “C:\Program Files\mosquitto\pwfile” mqtest 用来生成密码文件
- 修改aclfile文件
user mqtest
topic read test/#
topic read $SYS/#
topic write test/#
topic write $SYS/#
topic read com/iot/#
topic write com/iot/#
- 启动服务 mosquitto -c .\mosquitto.conf -v
注意:
在windows服务下, 启动mosquitto服务,启动不了(如果不改配置文件,默认安装可以启动。但只能本地访问),但是在命令行模式下可以启动。