个人智能家居系统 - MQTT服务器搭建(centOS7.3)
个人智能家居系统 - MQTT服务器搭建(centOS7.3)
0x00 参考
0x01 配置
General configuration
所见即所得,保持默认即可
Default listener
# 设置端口
port 1883
# 设置最大连接数
max_connections -1
# 使用协议,mqtt或者websocket
protocol mqtt
SSL/TLS support
用于 default listerner 的安全设置,暂未设置
Extra listeners
用于 websocket ,暂未设置
SSL/TLS support
用于 Extra listeners 的安全设置,暂未设置
Persistence
持续性设置,即 mosquitto 重启后恢复设置,暂未设置
而且客户端的断线重连机制更加稳妥Logging
开启服务时重定向 stdout 等信息至文件,这里只设置 type
Security
# 设置前缀
clientid_prefixes guduyl
# 禁止匿名登录
allow_anonymous false
# 设置用户名密码文件
password_file /etc/mosquitto/pwfile
# 设置权限信息文件
acl_file /etc/mosquitto/aclfile
Bridges
用于分布式服务器,暂未设置
SSL/TLS support
分布式服务器安全设置,暂未设置
External config files
rsmb options
用户名密码设置
- mosquitto_passwd 命令,查看帮助即可
权限文件设置
仿照 aclfile.example 文件
- test/jh/# 可匹配 test/jh/a/b/c, test/jh/a/b, test/jh/a.test/jh
- test/jh/+ 可匹配 test/jh/a, test/jh/b, 但是不能匹配 test/jh/a/b
启动停止
启动
#! /bin/bash ps -ef | grep mosquitto | tee /tmp/graduation.tmp lines=$(awk 'END{print NR}' /tmp/graduation.tmp)
lines=`expr $lines + 1`
for ((i=1; i<$lines; ++i))
do
uid=$(sed -n "$i, 1p" /tmp/graduation.tmp | awk '{print $1}')
if [ $uid == "mosquit+" ] ; then
break
fi
done if [ $i != $lines ] ; then
echo "the mosquitto1.4.1 had been started already"
else
echo "Starting the mosquitto1.4.1 ..."
mosquitto -d -c /etc/mosquitto/mosquitto.conf > /root/graduation/mosquitto.log 2>&1
echo "the mosquitto1.4.1 has been started"
echo "the log file is /root/graduation/mosquitto.log"
fi rm -f /tmp/graduation.tmp停止
#! /bin/bash ps -ef | grep mosquitto | tee /tmp/graduation.tmp lines=$(awk 'END{print NR}' /tmp/graduation.tmp)
lines=`expr $lines + 1`
for ((i=1; i<$lines; ++i))
do
uid=$(sed -n "$i, 1p" /tmp/graduation.tmp | awk '{print $1}')
if [ $uid == "mosquit+" ] ; then
break
fi
done if [ $i != $lines ] ; then
pid=$(sed -n "$i, 1p" /tmp/graduation.tmp | awk '{print $2}')
echo "killing $pid ..."
kill $pid
echo "the mosquitto1.4.1 has been stopped"
else
echo "the mosquitto1.4.1 has not been started yet"
fi rm -f /tmp/graduation.tmp重启
#! /bin/bash /root/graduation/stop.sh
/root/graduation/start.sh
个人智能家居系统 - MQTT服务器搭建(centOS7.3)的更多相关文章
- 树莓派安装开源智能家居系统 Domoticz
前言 最近闲来无事开始折腾自己的智能家居系统,对比了几种比较流行的开源智能家居系统,觉得 Domoticz 更适合,Domoticz的官方中文文档,虽然不是很完善但还是可以参考一下.需要注意的是下文用 ...
- Mqtt服务器搭建
.bg { background: #99CC99 } Mqtt服务器搭建 测试环境:CentOS64位 1.安装基础软件 yum install gcc-c++ yum install cmake ...
- Home Assistant + 树莓派:强大的智能家居系统 · 安装篇
Home Assistant + 树莓派:强大的智能家居系统 · 安装篇 转载:Home Assistant + 树莓派:强大的智能家居系统 · 安装篇 目录 1. 初始安装 3. Homebridg ...
- 常见MQTT服务器搭建与试用
常见MQTT服务器搭建与试用 简介 MQTT(Message Queuing Telemetry Transport,消息队列遥测传输)是IBM开发的一个即时通讯协议,它比较适合于在低带宽.不可靠 ...
- Home Assistant + 树莓派:强大的智能家居系统 · 设备接入篇
转载:Home Assistant + 树莓派:强大的智能家居系统 · 设备接入篇 目录 HASS 配置框架 主文件设置 Homebridge 设置 鹬蚌相争? 设备追踪设置 更新日志 作者的话 相信 ...
- 智能家居系统 Home Assistant 系列 --介绍篇
一. HomeAssistant 是什么? HomeAssistant是构建智慧空间的神器.是一个成熟完整的基于 Python 的智能家居系统,设备支持度高,支持自动化(Automation).群组化 ...
- 智能家居系统 Home Assistant 系列 --安装系统之Windows
Home Assistant 是一个成熟完整的基于 Python 的智能家居系统. 首先得安装Python环境.在浏览器中访问Python官网 www.python.org 进入Downloads中的 ...
- 常见MQTT服务器搭建[转载]
简介 MQTT(Message Queuing Telemetry Transport,消息队列遥测传输)是IBM开发的一个即时通讯协议,它比较适合于在低带宽.不可靠的网络的进行远程传感器和控制设备通 ...
- Apollo mqtt 服务器搭建
html { overflow-x: initial !important } :root { --bg-color: #ffffff; --text-color: #333333; --select ...
随机推荐
- kafka-manager怎么查看topic里的数据量
https://jingyan.baidu.com/article/eb9f7b6d367679869364e8d4.html
- 【零售App】—— react/ant design mobile项目爬坑
一.H5制作 - 图片文本的动画效果 bug:打开一个模板,添加图片,添加动画效果,若先选定动画效果,再调节动画时间和延迟时间,则动画和延迟时间没有改变:若先调节动画时间和延迟时间在选定动画效果,则动 ...
- leetcode-easy-array-50. Intersection of Two Arrays II
mycode 77.78% class Solution(object): def intersect(self, nums1, nums2): """ :type n ...
- MyBaits动态sql语句
1 在接口中书写方法 public interface EmployeeMapperDynamicSQL { public List<Employee> getEmpsTestInnerP ...
- maven的配置及使用
Maven项目对象模型(POM),可以通过一小段描述信息来管理项目的构建,报告和文档的软件项目管理工具. Apache官网下载maven 解压缩,配置环境变量: path路径:E:\apache-ma ...
- excel简单操作
百度网盘(npoi.dll): http://pan.baidu.com/s/14eJRw //先创建一个文件流,指向磁盘上的某个Excel文件 using (FileStream fsRead = ...
- 在aspx页面的checkbox取值验证
在做项目的时候遇到了一个选择性的问题,之前都可以用$("#id").checked,但是不知道为什么现在不可以了,只能if($(this).is(":checked&qu ...
- ubuntu用mentohust连接ruijie
32位 http://download.csdn.net/detail/yan456jie/8720395 64位 http://download.csdn.net/detail/yan456jie ...
- python检测编码
# -*- coding: utf-8 -*- import chardet import urllib #可根据需要,选择不同的数据 TestData = urllib.urlopen('http: ...
- js中的相等
概述 今天学习 jest,看文档的时候发现 jest 用到了 Object.is(),以前没有见过,所以记录下来,供以后开发时参考,相信对其他人也有用. 注意:Object.is的文档在这里 Obje ...