Ubuntu MQTT mosquitto

https://github.com/eclipse/paho.mqtt.c.git

https://github.com/eclipse/paho.mqtt.cpp.git

Paho MQTT C Client Library: MQTT Client library for C (MQTTClient)

GitHub - eclipse/mosquitto: Eclipse Mosquitto - An open source MQTT broker

  1. install:

https://mosquitto.org/download/

  1. conf:

打开/etc/mosquitto/mosquitto.conf,发现需要将配置文件放置于/etc/mosquitto/conf.d/目录下,示例文件可以从/usr/share/doc/mosquitto/examples/目录下提取,发现其是一个压缩包,将其解压缩,然后复制到/etc/mosquitto/conf.d/目录下。

xx@ubuntu:/etc/mosquitto$ cd /usr/share/doc/mosquitto/examples/

xx@ubuntu:/usr/share/doc/mosquitto/examples$ ls -lh

总用量 24K

-rw-r--r-- 1 root root 230 Apr 3 2021 aclfile.example

-rw-r--r-- 1 root root 12K Apr 3 2021 mosquitto.conf.gz

-rw-r--r-- 1 root root 23 Apr 3 2021 pskfile.example

-rw-r--r-- 1 root root 355 Apr 3 2021 pwfile.example

cd /usr/share/doc/mosquitto/examples/

sudo gzip -d mosquitto.conf.gz

sudo cp mosquitto.conf /etc/mosquitto/conf.d/

手动启动mosquitto,方便查看日志排查出现的问题。

mosquitto -c /etc/mosquitto/conf.d/mosquitto.conf -v

配置成无用户密码校验和无TLS连接

listener 1883

allow_anonymous true

配置文件如上配置,然后启动mosquito。

  1. stat:

service mosquitto status // 查看服务状态

service mosquitto start // 启动

service mosquitto stop // 停止

service mosquitto restart // 重启

  1. test:

mosquitto_sub -h "192.168.10.111" -p 1883 -t "mqtt/test" -v

mosquitto_pub -h "192.168.10.111" -p 1883 -t "mqtt/test" -m "hello"

Reference:

Ubuntu mosquitto 安装及配置-CSDN博客

ubuntu上安装mosquitto服务_mosquitto ubuntu-CSDN博客

Linux Ububtu下安装MQTT服务器_ubuntu安装mqtt-CSDN博客

相关推荐
TG_yunshuguoji6 分钟前
阿里云国际代理:阿里云备份如何保障数据安全?
运维·阿里云·云计算
云雾J视界10 分钟前
Linux企业级解决方案架构:字节跳动短视频推荐系统全链路实践
linux·云原生·架构·kubernetes·音视频·glusterfs·elk stack
KKKlucifer43 分钟前
自动化漏洞利用技术颠覆传统:微软生态暴露的攻防新变局
运维·microsoft·自动化
此心光明事上练1 小时前
大厂级企业后端:配置变更与缓存失效的自动化处理方案
运维·缓存·自动化
java_logo1 小时前
Docker 部署 MinIO 全指南
运维·windows·mongodb·docker·容器
tongsound1 小时前
libmodbus 使用示例
linux·c++
拾光Ծ1 小时前
【Linux】“ 权限 “ 与相关指令
linux·运维·服务器
硬核子牙1 小时前
调试器是怎么让代码停下来的
linux
To_再飞行1 小时前
Linux Bash(一)
linux·运维·服务器·bash
我狸才不是赔钱货1 小时前
DevOps:打破开发与运维之间的高墙
运维·vscode·docker·devops