我在一个相对较小的设备上运行一个Influxdb实例来收集时间序列物联网传感器数据。有时需要重新启动该设备(更新或类似的东西),我注意到重新启动后,如果我查询一些数据,我的Influxdb历史记录中有一个数据表。使用我当前的配置,由于重新启动,我丢失了大约16个小时的数据。 如何在重启设备后确保所有数据仍然存在?
谢谢!
答案 0 :(得分:0)
In InfluxDB, persistent data is stored in the /wal
, /data
, and /meta
directories. The /wal
directory contains the write ahead log, which acts as a staging area for recently written points to be stored before they are compressed into time series merge files for long term storage in the /data
directory.
On Unix systems, the /tmp
directory is sometimes cleared on reboot. Since the wal-dir
config setting is specified as /tmp/.influxdb/wal
, the persistent data in the write ahead log may be cleared on reboot. This explains why you are seeing data loss on only recent data. Older data is flushed to the /data
directory, which isn't cleared on reboot.
In short, the wal-dir
config setting needs to be set to /data/.influxdb/wal
or another directory that is not cleared on reboot.