Influxdb restore inside container and default data location

I was following this documentation: Restore data in InfluxDB | InfluxDB OSS v2 Documentation

my docker-compose.yml:

services:
  influxdb:
    image: influxdb:2
    container_name: influxdb
    ports:
      - "8086:8086"
    volumes:
      - /userdata/influxdb/data:/var/lib/influxdb2
      - /userdata/influxdb/config:/etc/influxdb2
      - /home/naymore/influxdb_backup:/backup
    restart: unless-stopped
    entrypoint: ["influxd"]

start container:

docker compose up -d

open a shell in the container:

docker exec -ti influxdb /bin/bash

follow restore documentation…

influx setup –token
I typically enter some dummy values for user, passwd, org… they are overwritten by the restore anyway!?

influx restore /backup –full

It then restores the backup. Once it’s done I can open the UI at http://:8086 and I get a login prompt. I can login with my old credentials. I can see all my old data. GOOD.

Now what I tried to do several times is to remove the /backup volume mount from my docker-compose.yml file.

It creates a new container and all data is gone. Actually I have no idea why it creates a new container but it does.

Anyway… I figured out that my /userdata/influxdb/data directory is actually empty.
And inside the container /var/lib/influxdb2 is as well!!

root@fda91bb90d29:/var/lib/influxdb2# find / -iname “.db"***
find: ‘/sys/kernel/debug’: Permission denied
find: ‘/proc/tty/driver’: Permission denied
root@fda91bb90d29:/var/lib/influxdb2# f
ind / -iname ".bolt”
find: ‘/sys/kernel/debug’: Permission denied
find: ‘/proc/tty/driver’: Permission denied
/root/.influxdbv2/influxd.bolt
root@fda91bb90d29:/var/lib/influxdb2# find / -iname “*.tsm”
*
find: ‘/sys/kernel/debug’: Permission denied
find: ‘/proc/tty/driver’: Permission denied
/root/.influxdbv2/engine/data/cfdfedcbe7f33b88/autogen/615/000000012-000000002.tsm
/root/.influxdbv2/engine/data/cfdfedcbe7f33b88/autogen/623/000000012-000000002.tsm
/root/.influxdbv2/engine/data/cfdfedcbe7f33b88/autogen/55/000000011-000000002.tsm
/root/.influxdbv2/engine/data/cfdfedcbe7f33b88/autogen/383/000000007-000000002.tsm
/root/.influxdbv2/engine/data/cfdfedcbe7f33b88/autogen/1023/000000012-000000002.tsm
/root/.influxdbv2/engine/data/cfdfedcbe7f33b88/autogen/959/000000011-000000002.tsm
/root/.influxdbv2/engine/data/cfdfedcbe7f33b88/autogen/695/000000013-000000002.tsm
/root/.influxdbv2/engine/data/cfdfedcbe7f33b88/autogen/503/000000011-000000002.tsm
/root/.influxdbv2/engine/data/cfdfedcbe7f33b88/autogen/271/000000011-000000002.tsm
/root/.influxdbv2/engine/data/cfdfedcbe7f33b88/autogen/247/000000001-000000001.tsm

Not sure why I cannot find any .bolt or .db files.
Why are .tsm files stored under /root/.influxdbv2/engine/data?

And why is /etc/influxdb2/influx-configs still showing an org that doesn’t exist (the random stuff I typed in earlier which should have been replaced by the restore)?

root@fda91bb90d29:/etc/influxdb2# cat influx-configs
[default]
  url = "http://localhost:8086"
  token = "BJAPV7aSTwaMWDvh7xzVID0Bxv9vprFgn2AX6z2h1s2hP6eTEy6jBnL-sQ4rkgCWlgbexUbg-C0EYuGUyrMl0Q=="
  org = "umbrella-corp"
  active = true
#
# [eu-central]
#   url = "https://eu-central-1-1.aws.cloud2.influxdata.com"
#   token = "XXX"
#   org = ""
#
# [us-central]
#   url = "https://us-central1-1.gcp.cloud2.influxdata.com"
#   token = "XXX"
#   org = ""
#
# [us-west]
#   url = "https://us-west-2-1.aws.cloud2.influxdata.com"
#   token = "XXX"
#   org = ""

Wasn’t there a config.yml in /etc/influxdb2 earlier?
That restore is really causing me headaches…

root@fda91bb90d29:/etc/influxdb2# influx server-config
{
        "assets-path": "",
        "bolt-path": "/root/.influxdbv2/influxd.bolt",
        "e2e-testing": false,
        "engine-path": "/root/.influxdbv2/engine",
        "feature-flags": null,
        "flux-log-enabled": false,
        "hardening-enabled": false,
        "http-bind-address": ":8086",
        "http-idle-timeout": 180000000000,
        "http-read-header-timeout": 10000000000,
        "http-read-timeout": 0,
        "http-write-timeout": 0,
        "influxql-max-select-buckets": 0,
        "influxql-max-select-point": 0,
        "influxql-max-select-series": 0,
        "instance-id": "",
        "log-level": "info",
        "metrics-disabled": false,
        "nats-max-payload-bytes": 0,
        "nats-port": 0,
        "no-tasks": false,
        "overwrite-pid-file": false,
        "pid-file": "",
        "pprof-disabled": false,
        "query-concurrency": 1024,
        "query-initial-memory-bytes": 0,
        "query-max-memory-bytes": 0,
        "query-memory-bytes": 0,
        "query-queue-size": 1024,
        "reporting-disabled": true,
        "secret-store": "bolt",
        "session-length": 60,
        "session-renew-disabled": false,
        "sqlite-path": "/root/.influxdbv2/influxd.sqlite",
        "storage-cache-max-memory-size": 1073741824,
        "storage-cache-snapshot-memory-size": 26214400,
        "storage-cache-snapshot-write-cold-duration": "10m0s",
        "storage-compact-full-write-cold-duration": "4h0m0s",
        "storage-compact-throughput-burst": 50331648,
        "storage-max-concurrent-compactions": 0,
        "storage-max-index-log-file-size": 1048576,
        "storage-no-validate-field-size": false,
        "storage-retention-check-interval": "30m0s",
        "storage-series-file-max-concurrent-snapshot-compactions": 0,
        "storage-series-id-set-cache-size": 0,
        "storage-shard-precreator-advance-period": "30m0s",
        "storage-shard-precreator-check-interval": "10m0s",
        "storage-tsm-use-madv-willneed": false,
        "storage-validate-keys": false,
        "storage-wal-flush-on-shutdown": false,
        "storage-wal-fsync-delay": "0s",
        "storage-wal-max-concurrent-writes": 0,
        "storage-wal-max-write-delay": 600000000000,
        "storage-write-timeout": 10000000000,
        "store": "disk",
        "strong-passwords": false,
        "template-file-urls-disabled": false,
        "testing-always-allow-setup": false,
        "tls-cert": "",
        "tls-key": "",
        "tls-min-version": "1.2",
        "tls-strict-ciphers": false,
        "tracing-type": "",
        "ui-disabled": false,
        "vault-addr": "",
        "vault-cacert": "",
        "vault-capath": "",
        "vault-client-cert": "",
        "vault-client-key": "",
        "vault-client-timeout": 0,
        "vault-max-retries": 0,
        "vault-skip-verify": false,
        "vault-tls-server-name": "",
        "vault-token": ""
}

Your data is being written to /root/.influxdbv2 because of your InfluxDB configuration. To persist data outside the container, ensure your Docker volume mounts match the paths InfluxDB is actually using.