程序谷 认真生活 享受生活

Ubuntu20安装mosquito且和EMQX集群

⚠️ 本文最后更新于2023年11月15日,已经过了626天没有更新,若内容或图片失效,请留言反馈

安装mosquito

更新源

sudo apt update

安装

sudo apt install mosquitto

安装Mosquitto的服务工具

sudo apt install mosquitto-clients

修改配置

打开 /etc/mosquitto/mosquitto.conf

pid_file /run/mosquitto/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

# 修改端口
listener 1883
# 开启匿名访问
allow_anonymous true

和EMQX集群

打开配置文件/etc/mosquitto/mosquitto.conf

在最下面添加

# 集群的名称
connection emqx1
# emqx的地址
address 1.2.3.4:1883
# clientid
remote_clientid mosquitto_test
# 用户名密码,有就填,没有就不写
remote_username xxx
remote_password xxx

# 桥接主题,#代表所有主题,方向可以是 out, in 或者 both
topic # both

EMQX集群文档

命令

//启动
systemctl start mosquitto
//停止
systemctl stop mosquitto
//重启
systemctl restart mosquitto
//查看状态
systemctl status mosquitto
By 大芃展翅 On
此页面评论区已关闭
程序谷 |  蜀ICP备2020031553号-1