安装完成之后,所有配置文件会被放置于/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. SecureCRT卡死的问题

    ctrl+s是一个古老的shell控制键,不小心按倒就卡死了.在输入ctrl+q就可以恢复了

  2. 剑指offer 面试59题

    面试59题: 题目:队列的最大值. 题目一:滑动窗口的最大值. 给定一个数组和滑动窗口的大小,请找出所有滑动窗口里的最大值.例如:如果输入数组为[2,3,4,2,6,2,5,1]及滑动窗口大小为3,那 ...

  3. Computer Information

    Lab: lxw@lxw-PC:python$ df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/sda7 190G .4G 175G % / none .0K .0K % /sys/ ...

  4. python面向对象之 封装(Day25)

    封装: 隐藏对象的属性和实现细节,仅对外提供公共访问方式 好处:1.将变化隔离 2.便于使用 3.提高复用性 4.提高安全性 封装原则: 1.将不需要对外提供的内容隐藏起来 2.把属性都隐藏,提供公共 ...

  5. Yii2 使用 Beanstalk 队列系统

    参考网址: Beanstalk:https://github.com/kr/beanstalkd Beanstalk console:https://github.com/ptrofimov/bean ...

  6. 解决:Requested 'libdrm_radeon >= 2.4.56' but version of libdrm_radeon is 2.4.52

    checking for NOUVEAU... yes checking for RADEON... no configure: error: Package requirements (libdrm ...

  7. 一句white-space:nowrap解决IE6,IE7下浮动元素不自动换行

    一句white-space:nowrap解决IE6,IE7下浮动元素不自动换行

  8. Git常见命令整理

    Git常见命令整理 + 注释 git init # 初始化本地git仓库(创建新仓库) git config --global user.name "xxx" # 配置用户名 gi ...

  9. iOS_核心动画(二)

    目 录: 一.Core Animation开发步骤 二.Core Animation的继承结构 三.CAAnimation常用的属性 四.CAPropertyAnimation(属性动画) 五.CAB ...

  10. python模块cgihttpserver启动

    cgi是web服务器运行web应用的一种机制,web服务器通过执行cgi脚本,然后将该程序的标准输出作为http响应的一部分 CGIHTTPServer是python标准模块的web服务器,它可以运行 ...