本帖最后由 ozjso 于 2017-10-17 07:48 编辑
我重装了一次MQTT,原来是安装文件 sudo apt-get install mosquito,后来用sudo hassbian-config install mosquitto安装的,mosquito.conf的文件内容不一样,用hassbian-config安装的文件长很多,多了很多描述。目前persistence的内容如下,我该改哪里呢?
# Persistence
# =================================================================
# If persistence is enabled, save the in-memory database to disk
# every autosave_interval seconds. If set to 0, the persistence
# database will only be written when mosquitto exits. See also
# autosave_on_changes.
# Note that writing of the persistence database can be forced by
# sending mosquitto a SIGUSR1 signal.
#autosave_interval 1800
# If true, mosquitto will count the number of subscription changes, retained
# messages received and queued messages and if the total exceeds
# autosave_interval then the in-memory database will be saved to disk.
# If false, mosquitto will save the in-memory database to disk by treating
# autosave_interval as a time in seconds.
#autosave_on_changes false
# Save persistent message data to disk (true/false).
# This saves information about all messages, including
# subscriptions, currently in-flight messages and retained
# messages.
# retained_persistence is a synonym for this option.
persistence true
# The filename to use for the persistent database, not including
# the path.
persistence_file mosquitto.db
# Location for persistent database. Must include trailing /
# Default is an empty string (current directory).
# Set to e.g. /var/lib/mosquitto/ if running as a proper service on Linux or
# similar.
persistence_location /var/lib/mosquitto/
==========================
找到一个mosquitto.conf.back文件,内容很少:
# Place your local configuration in /etc/mosquitto/conf.d/ # # A full description of the configuration file is at # /usr/share/doc/mosquitto/examples/mosquitto.conf.example
pid_file /var/run/mosquitto.pid
persistence true persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
============ 在/var/lib/mosquitto/mosquitto.db 文件下的内容:好像是一些乱码,其中一些是sonoff里命名的名字 ^@^@mosquitto db^@^@^@^@^@^@^@^C^@^A^@^@^@ ^A^H^E^@^@^@^@^@^@^B^@^@^@B^E^@^@^@^@^@^@^Mhass_sonoff02^@^@^@^@^@^Xtele/livingroomlight/LWT^A^A^@^@^@^GOffline^@^B^@^@^@@^[^E^@^@^@^@^@^@^Mhass_sonoff02^@^E^@^@^@^Zcmnd/livingroomlight/P$
|