Introduction
From time to time, InfluxDB will corrupt its TSI index files. This is mostly due to external circumstances like sudden power loss, forced shutdown or similar. However, the problem is easy to fix.
Fixing the index files
# Shutdown InfluxDB
systemctl stop influxdb
# Remove all TSI index files
rm -r /var/lib/influxdb/data/*/*/*/index
# Rebuild TSI index files
su --command "influx_inspect buildtsi -datadir /var/lib/influxdb/data -waldir /var/lib/influxdb/wal" influxdb
# Start InfluxDB again
systemctl start influxdb
See also the documentation about influx_inspect buildtsi
.
Appendix
Note that your machine should have enough memory to handle the repair process, which might be a problem for large databases where we have been running into OOM conditions once.
At the time of writing this, we have been running InfluxDB 1.5.3.