InfluxDB is super slow to start on Raspberry Pi

Hi all!

Hopefully somewhat simple question: influxdb is just extremely slow to start on my RaspberryPi I’ll enter the command influx and literally just sit around for a good 10 minutes until I get the command line prompt.

This has a cascade on effect during reboot when none of my python scripts that write to influxdb or my Grafana visualiser can load properly and basically means I just have to sit around for a bit after each reboot.

Surely this user error on my part somewhere along the line, but anyone have any ideas?

I’ve tried re-installing Influx twice, same result both times.

Cheers!
-Josh

Hi

By default, at startup, influx is creating memory indexes for series.
Like a PI doesn’t have a lot of RAM, the result is that it’s swapping (more than) a lot at startup.

In /etc/influxdb/influxdb.conf try to use “tsi1” instead of “inmem” indexes:

  # The type of shard index to use for new shards.  The default is an in-memory index that is
  # recreated at startup.  A value of "tsi1" will use a disk based index that supports higher
  # cardinality datasets.
  # index-version = "inmem"
  index-version = "tsi1"

Eventually you can also try to reduce memory cache size

  # CacheMaxMemorySize is the maximum size a shard's cache can
  # reach before it starts rejecting writes.
  # Valid size suffixes are k, m, or g (case insensitive, 1024 = 1k).
  # Values without a size suffix are in bytes.
  cache-max-memory-size = "384m"
  #cache-max-memory-size = "1g"

On my PI Zero it fix the issue. It’s still a bit slow (2-3 min) to starts but it’s starting!

BTW, using tsi1 will create disk indexes, so it will generate more I/O on disk, so take care of your SD life.

Hope it helps.

Zorg