zoukankan      html  css  js  c++  java
  • mosquitto配置文件说明

    安装完成之后,所有配置文件会被放置于/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
  • 相关阅读:
    DDD 领域驱动设计-谈谈 Repository、IUnitOfWork 和 IDbContext 的实践
    UVA10071 Back to High School Physics
    UVA10071 Back to High School Physics
    UVA10055 Hashmat the Brave Warrior
    UVA10055 Hashmat the Brave Warrior
    UVA458 The Decoder
    UVA458 The Decoder
    HDU2054 A == B ?
    HDU2054 A == B ?
    POJ3414 Pots
  • 原文地址:https://www.cnblogs.com/bluealine/p/8624190.html
Copyright © 2011-2022 走看看