Reputation: 1
Sorry for my ignorance. I have influx db running on docker with docker-compose as below.
influxdb:
image: influxdb:alpine
ports:
- 8086:8086
volumes:
- ./influxdb/config/influxdb.conf:/etc/influxdb/influxdb.conf:ro
- ./influxdb/data:/var/lib/influxdb
I need to restore the backup of a database from remote server to this Influxdb container. I have taken the backup as below from remote server.
influxd backup -database tech_db /tmp/tech_db
I read the documentation and couldn't find a way to restore the DB to docker container.Can anyone give me a pointer to how to do this.
Upvotes: 0
Views: 1865
Reputation: 119
I have also had the same issue. Looks like it is impossible because you are not able to kill influxd process in a container.
# Restoring a backup requires that influxd is stopped (note that stopping the process kills the container).
docker stop "$CONTAINER_ID"
# Run the restore command in an ephemeral container.
# This affects the previously mounted volume mapped to /var/lib/influxdb.
docker run --rm \
--entrypoint /bin/bash \
-v "$INFLUXDIR":/var/lib/influxdb \
-v "$BACKUPDIR":/backups \
influxdb:1.3 \
-c "influxd restore -metadir /var/lib/influxdb/meta -datadir /var/lib/influxdb/data -database foo /backups/foo.backup"
# Start the container just like before, and get the new container ID.
CONTAINER_ID=$(docker run --rm \
--detach \
-v "$INFLUXDIR":/var/lib/influxdb \
-v "$BACKUPDIR":/backups \
-p 8086 \
influxdb:1.3
)
More information is here
Upvotes: 2