安装完成之后,所有配置文件会被放置于/etc/mosquitto/目录下,其中最重要的就是Mosquitto的配置文件,即mosquitto.conf,以下是详细的配置参数说明。

  1. # =================================================================
  2. # General configuration
  3. # =================================================================
  4. # 客户端心跳的间隔时间
  5. #retry_interval 20
  6. # 系统状态的刷新时间
  7. #sys_interval 10
  8. # 系统资源的回收时间,0表示尽快处理
  9. #store_clean_interval 10
  10. # 服务进程的PID
  11. #pid_file /var/run/mosquitto.pid
  12. # 服务进程的系统用户
  13. #user mosquitto
  14. # 客户端心跳消息的最大并发数
  15. #max_inflight_messages 10
  16. # 客户端心跳消息缓存队列
  17. #max_queued_messages 100
  18. # 用于设置客户端长连接的过期时间,默认永不过期
  19. #persistent_client_expiration
  20. # =================================================================
  21. # Default listener
  22. # =================================================================
  23. # 服务绑定的IP地址
  24. #bind_address
  25. # 服务绑定的端口号
  26. #port 1883
  27. # 允许的最大连接数,-1表示没有限制
  28. #max_connections -1
  29. # cafile:CA证书文件
  30. # capath:CA证书目录
  31. # certfile:PEM证书文件
  32. # keyfile:PEM密钥文件
  33. #cafile
  34. #capath
  35. #certfile
  36. #keyfile
  37. # 必须提供证书以保证数据安全性
  38. #require_certificate false
  39. # 若require_certificate值为true,use_identity_as_username也必须为true
  40. #use_identity_as_username false
  41. # 启用PSK(Pre-shared-key)支持
  42. #psk_hint
  43. # SSL/TSL加密算法,可以使用“openssl ciphers”命令获取
  44. # as the output of that command.
  45. #ciphers
  46. # =================================================================
  47. # Persistence
  48. # =================================================================
  49. # 消息自动保存的间隔时间
  50. #autosave_interval 1800
  51. # 消息自动保存功能的开关
  52. #autosave_on_changes false
  53. # 持久化功能的开关
  54. persistence true
  55. # 持久化DB文件
  56. #persistence_file mosquitto.db
  57. # 持久化DB文件目录
  58. #persistence_location /var/lib/mosquitto/
  59. # =================================================================
  60. # Logging
  61. # =================================================================
  62. # 4种日志模式:stdout、stderr、syslog、topic
  63. # none 则表示不记日志,此配置可以提升些许性能
  64. log_dest none
  65. # 选择日志的级别(可设置多项)
  66. #log_type error
  67. #log_type warning
  68. #log_type notice
  69. #log_type information
  70. # 是否记录客户端连接信息
  71. #connection_messages true
  72. # 是否记录日志时间
  73. #log_timestamp true
  74. # =================================================================
  75. # Security
  76. # =================================================================
  77. # 客户端ID的前缀限制,可用于保证安全性
  78. #clientid_prefixes
  79. # 允许匿名用户
  80. #allow_anonymous true
  81. # 用户/密码文件,默认格式:username:password
  82. #password_file
  83. # PSK格式密码文件,默认格式:identity:key
  84. #psk_file
  85. # pattern write sensor/%u/data
  86. # ACL权限配置,常用语法如下:
  87. # 用户限制:user <username>
  88. # 话题限制:topic [read|write] <topic>
  89. # 正则限制:pattern write sensor/%u/data
  90. #acl_file
  91. # =================================================================
  92. # Bridges
  93. # =================================================================
  94. # 允许服务之间使用“桥接”模式(可用于分布式部署)
  95. #connection <name>
  96. #address <host>[:<port>]
  97. #topic <topic> [[[out | in | both] qos-level] local-prefix remote-prefix]
  98. # 设置桥接的客户端ID
  99. #clientid
  100. # 桥接断开时,是否清除远程服务器中的消息
  101. #cleansession false
  102. # 是否发布桥接的状态信息
  103. #notifications true
  104. # 设置桥接模式下,消息将会发布到的话题地址
  105. # $SYS/broker/connection/<clientid>/state
  106. #notification_topic
  107. # 设置桥接的keepalive数值
  108. #keepalive_interval 60
  109. # 桥接模式,目前有三种:automatic、lazy、once
  110. #start_type automatic
  111. # 桥接模式automatic的超时时间
  112. #restart_timeout 30
  113. # 桥接模式lazy的超时时间
  114. #idle_timeout 60
  115. # 桥接客户端的用户名
  116. #username
  117. # 桥接客户端的密码
  118. #password
  119. # bridge_cafile:桥接客户端的CA证书文件
  120. # bridge_capath:桥接客户端的CA证书目录
  121. # bridge_certfile:桥接客户端的PEM证书文件
  122. # bridge_keyfile:桥接客户端的PEM密钥文件
  123. #bridge_cafile
  124. #bridge_capath
  125. #bridge_certfile
  126. #bridge_keyfile
  127. # 自己的配置可以放到以下目录中
  128. include_dir /etc/mosquitto/conf.d

启动Mosquitto服务很简单,直接运行命令行“mosquitto -c /etc/mosquitto/mosquitto.conf -d”即可。另外,Mosquitto是个纯异步IO框架,经测试可以轻松处理20000个以上的客户端连接。当然,实际的最大承载量还和业务的复杂度有比较大的关系。测试的时候不要忘记调整系统的最大连接数和栈大小,比如Linux上可用ulimit -n20000 -s512命令设置你需要的系统参数。

 
文章来自:http://blog.chinaunix.net/uid-25885064-id-3539075.html

mosquitto配置文件说明的更多相关文章

  1. mosquitto配置文件/etc/mosquitto/mosquitto.conf配置参数详细说明

    mosquitto配置文件/etc/mosquitto/mosquitto.conf配置参数详细说明 摘自:https://blog.csdn.net/weixin_43025071/article/ ...

  2. mosquitto 配置文件解说

    #配置文件为mosquitto #参见mosquitto.conf(5)了解更多信息. #显示默认值,取消注释以更改. #使用#字符来表示注释,但只有当它是 #第一个字符就行了. #========= ...

  3. mosquitto配置文件详解

    安装完成之后,所有配置文件会被放置于/etc/mosquitto/目录下,其中最重要的就是Mosquitto的配置文件,即mosquitto.conf,以下是详细的配置参数说明. # Config f ...

  4. mosquitto配置文件

    #配置文件为mosquitto #参见mosquitto.conf(5)了解更多信息. #显示默认值,取消注释以更改. #使用#字符来表示注释,但只有当它是 #第一个字符就行了. #========= ...

  5. mosquitto简单应用

    1. 简述 一款实现了消息推送协议 MQTT v3.1 的开源消息代理软件,提供轻量级的,支持可发布/可订阅的的消息推送模式,使设备对设备之间的短消息通信变得简单,比如现在应用广泛的低功耗传感器,手机 ...

  6. Mosquitto服务器的搭建以及SSL/TLS安全通信配置

    Mosquitto服务器的搭建以及SSL/TLS安全通信配置 摘自:https://segmentfault.com/a/1190000005079300 openhab  raspberry-pi ...

  7. mosquitto --- 单向认证

    1.生成证书要单向配置SSL 需要 做三项前置工作 1. 生成CA证书 2.生成server 端证书,server 端key github 的一个开源项目已经做到这点 ,详情可见 https://gi ...

  8. Mosquitto 单向SSL配置

    Mosquitto 单向SSL配置 摘自:https://blog.csdn.net/a_bcd_123/article/details/70167833 2017年04月14日 06:56:06 s ...

  9. mosquitto linux部署

    1:官网下载 https://mosquitto.org/files/source/ 本文使用的是mosquitto-1.5.tar.gz 2:解压mosquitto-1.5.tar.gz tar - ...

随机推荐

  1. Android开发视频教程

    http://study.163.com/course/courseMain.htm?courseId=207001 目录   章节1第一季   课时1课程介绍15:17 课时2Android历史15 ...

  2. shuit模块

    shuit模块 #高级的 文件.文件夹.压缩包 处理模块 shutil.copyfileobj(fsrc, fdst[, length])将文件内容拷贝到另一个文件中,可以部分内容 def copyf ...

  3. TLS and SSL

    SSL:(Secure Socket Layer,安全套接字层),位于可靠的面向连接的网络层协议和应用层协议之间的一种协议层.SSL通过互相认证.使用数字签名确保完整性.使用加密确保私密性,以实现客户 ...

  4. A+B和C (15)

    时间限制 1000 ms 内存限制 32768 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 给定区间[-2的31次方, 2的31次方]内的3个整数A.B和C ...

  5. [String ] StringBuffer VS StringBuilder

    StringBuilder的性能高于StringBuffer,因为StringBuffer是线程安全的. 首先说明一下,一般情况下,字符串相加默认是StringBuilder,但是当数量大于100,或 ...

  6. 剑指offer 面试51题

    面试51题: 题目:数组中的逆序对 题目描述 在数组中的两个数字,如果前面一个数字大于后面的数字,则这两个数字组成一个逆序对.输入一个数组,求出这个数组中的逆序对的总数P.并将P对1000000007 ...

  7. 【转】Python max内置函数详细介绍

    #max() array1 = range(10) array2 = range(0, 20, 3) print('max(array1)=', max(array1)) print('max(arr ...

  8. ssh登陆virtualbox虚拟机

  9. golang注册码

    许可证服务认证 由于更新,最近注册码都不能用了,下面是能用的, http://idea.youbbs.org

  10. HashMap,LinkedHashMap和TreeMap的区别

    Map主要用于存储健值对,根据键得到值,因此不允许键重复(重复会覆盖),但允许值重复. 1. HashMap Hashmap是一个最常用的Map,它根据键的HashCode值存储数据,根据键可以直接获 ...