天天看點

Mosquitto-1.4.15源碼編譯與使用(下)

# =================================================================
# General configuration
# =================================================================
 
# 用戶端心跳的間隔時間
#retry_interval 20
 
# 系統狀态的重新整理時間
#sys_interval 10
 
# 系統資源的回收時間,0表示盡快處理
#store_clean_interval 10
 
# 服務程序的PID
#pid_file /var/run/mosquitto.pid
 
# 服務程序的系統使用者
#user mosquitto
 
# 用戶端心跳消息的最大并發數
#max_inflight_messages 10
 
# 用戶端心跳消息緩存隊列
#max_queued_messages 100
 
# 用于設定用戶端長連接配接的過期時間,預設永不過期
#persistent_client_expiration
 
# =================================================================
# Default listener
# =================================================================
 
# 服務綁定的IP位址
#bind_address
 
# 服務綁定的端口号
#port 1883
 
# 允許的最大連接配接數,-1表示沒有限制
#max_connections -1
 
# cafile:CA憑證檔案
# capath:CA憑證目錄
# certfile:PEM證書檔案
# keyfile:PEM密鑰檔案
#cafile
#capath
#certfile
#keyfile
 
# 必須提供證書以保證資料安全性
#require_certificate false
 
# 若require_certificate值為true,use_identity_as_username也必須為true
#use_identity_as_username false
 
# 啟用PSK(Pre-shared-key)支援
#psk_hint
 
# SSL/TSL加密算法,可以使用“openssl ciphers”指令擷取
# as the output of that command.
#ciphers
 
# =================================================================
# Persistence
# =================================================================
 
# 消息自動儲存的間隔時間
#autosave_interval 1800
 
# 消息自動儲存功能的開關
#autosave_on_changes false
 
# 持久化功能的開關
persistence true
 
# 持久化DB檔案
#persistence_file mosquitto.db
 
# 持久化DB檔案目錄
#persistence_location /var/lib/mosquitto/
 
# =================================================================
# Logging
# =================================================================
 
# 4種日志模式:stdout、stderr、syslog、topic
# none 則表示不記日志,此配置可以提升些許性能
log_dest none
 
# 選擇日志的級别(可設定多項)
#log_type error
#log_type warning
#log_type notice
#log_type information
 
# 是否記錄用戶端連接配接資訊
#connection_messages true
 
# 是否記錄日志時間
#log_timestamp true
 
# =================================================================
# Security
# =================================================================
 
# 用戶端ID的字首限制,可用于保證安全性
#clientid_prefixes
 
# 允許匿名使用者
#allow_anonymous true
 
# 使用者/密碼檔案,預設格式:username:password
#password_file
 
# PSK格式密碼檔案,預設格式:identity:key
#psk_file
 
# pattern write sensor/%u/data
# ACL權限配置,常用文法如下:
# 使用者限制:user <username>
# 話題限制:topic [read|write] <topic>
# 正則限制:pattern write sensor/%u/data
#acl_file
 
# =================================================================
# Bridges
# =================================================================
 
# 允許服務之間使用“橋接”模式(可用于分布式部署)
#connection <name>
#address <host>[:<port>]
#topic <topic> [[[out | in | both] qos-level] local-prefix remote-prefix]
 
# 設定橋接的用戶端ID
#clientid
 
# 橋接斷開時,是否清除遠端伺服器中的消息
#cleansession false
 
# 是否釋出橋接的狀态資訊
#notifications true
 
# 設定橋接模式下,消息将會釋出到的話題位址
# $SYS/broker/connection/<clientid>/state
#notification_topic
 
# 設定橋接的keepalive數值
#keepalive_interval 60
 
# 橋接模式,目前有三種:automatic、lazy、once
#start_type automatic
 
# 橋接模式automatic的逾時時間
#restart_timeout 30
 
# 橋接模式lazy的逾時時間
#idle_timeout 60
 
# 橋接用戶端的使用者名
#username
 
# 橋接用戶端的密碼
#password
 
# bridge_cafile:橋接用戶端的CA憑證檔案
# bridge_capath:橋接用戶端的CA憑證目錄
# bridge_certfile:橋接用戶端的PEM證書檔案
# bridge_keyfile:橋接用戶端的PEM密鑰檔案
#bridge_cafile
#bridge_capath
#bridge_certfile
#bridge_keyfile

      

----

Linux:

chmod -R 777 jemalloc-4.5.0

netstat -nalp|grep 1883 #檢視1883端口的連接配接情況,觀察TCP狀态圖

netstat -nalp|grep 1883|wc -l #檢視1883端口的用戶端連接配接數

ulimit -n 5120000 #修改目前程序的最大檔案數

top -p 程序号 #檢視某個程序的CPU和記憶體情況

tail -f *.log #實時檢視日志内容

[root@localhost ~]# netstat -nalp|grep 80

[root@localhost ~]# kill -9 43221

更多内容請見:erlang物聯網開源項目emqttd下載下傳,編譯和圖形化監控相關

Windows:

netstat -aon|findstr "1883"  #檢視1883端口的連接配接情況,觀察TCP狀态圖

---

繼續閱讀