Skip to content

Instantly share code, notes, and snippets.

@skyrocknroll
Last active October 24, 2023 13:47
Show Gist options
  • Save skyrocknroll/c374666f746031c437c23928cdc9f4f4 to your computer and use it in GitHub Desktop.
Save skyrocknroll/c374666f746031c437c23928cdc9f4f4 to your computer and use it in GitHub Desktop.
[Influxdb Cardinality Debug] #influxdb
  • SHOW TAG VALUES EXACT CARDINALITY WITH KEY = "index";
  • SHOW SERIES CARDINALITY group by "measurement"; → Important useful one.
  • influxdata/influxdb#8636 → Good examples are here
  • influx_inspect report -detailed /var/lib/influxdb/data/envoy/autogen/903 The best way to ficure out high cardinality series.
  • figure out series in each database use _internal ; select * from "database" where time > now() - 900s limit 10; Faced this error ERR: cannot delete data. DB contains shards using both inmem and tsi1 indexes. Please convert all shards to use the same index type to delete data.
find /var/lib/influxdb -type d -name index | while read index; do rm -Rf "$index" ; done
influx_inspect buildtsi -database envoy -datadir /var/lib/influxdb/data/ -waldir /var/lib/influxdb/wal
influx_inspect buildtsi -database telegraf -datadir /var/lib/influxdb/data/ -waldir /var/lib/influxdb/wal

chown -R influxdb:influxdb /var/lib/influxdb/
  • influx_inspect verify -dir /var/lib/influxdb
  • Use backup and restore of influxdb to migrate to new machines. it support time range as well. Influxdb use
max-series-per-database = 0
max-values-per-tag = 0 
index-version = "tsi1"

tune the above values.

Fo io tuning

# The amount of time that a write will wait before fsyncing.  A duration
  # greater than 0 can be used to batch up multiple fsync calls.  This is useful for slower
  # disks or when WAL write contention is seen.  A value of 0s fsyncs every write to the WAL.
  # Values in the range of 0-100ms are recommended for non-SSD disks.
  # wal-fsync-delay = "0s"
  
  
  max-select-point = 1000
  log-queries-after = "45s
  query-timeout = "120s"
  max-concurrent-queries = 25

Putting a limit at micro service level using one db per nomad-task-name

Towards multi influxdb database instances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment