-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remote restore not working - "DB metadata not changed. database may already exist" #9593
Comments
@pragmaticivan what version of InfluxDB are you running? |
Just updated |
When restoring, the flag for database selection is '-db' not '-database', as in |
I'm still getting this error regardless of the Error
Backup Command
Restore Command
Restore -newdb
|
The legacy backup and restore appear to work fine. |
hi @entone , try: influxd restore -portable -db "brood" -newdb "brood1" -host localhost:8088 ~/Desktop/influx-backup-test-2 to clarify: |
Then can you explain me how to restore an incremental backup ? |
Your commands above are not incremental, but always take a full backup. You can use either
You can then repeat this process for each increment. |
Sorry @aanthony1243, this mean there isn't any way to restore incremental data without proceding db-by-db? |
@mcappadonna yes, that's correct. |
I don't want to complain about open source software and I appreciate the work that you are doing a lot, but is incremental restore planned? Incremental backup without the means of restoring them incrementally without intensive manual work seems rather cumbersome and a huge oversight. |
We wrote this small script for restoring incremental backups so we won't be SOL when the worst happens https://github.com/motleyagency/influxdb-incremental-restore It's written in Node, so it might not be optimal for every case but has worked just fine for us. |
Also to add onto @petetnt's great work, before you do the SELECT * INTO operation suggested by @aanthony1243, you'll want to:
I just tried an incremental restore of about 1.6M data points on a 2 core machine, and it took about 2 minutes. This operation is slower than the initial Edit: We're solidly in the "low" category on this page -- 18k series with appropriately sized hardware -- and doing this SELECT * INTO query on a single day's incremental backup takes down the machine by eating all the RAM. I'm afraid I'm going to have to invest a couple more days and write some custom code to stream rows between databases in a "nice" way -- chunking by series and by shard. I've looked into Kapacitor and export/import (data becomes too large on disk) and neither of them solve the problem. Edit2: I found a way to merge everything from one database into another: pipe the output of an export command directly to an import command. Uses an extra ~500MB of RAM on my machine. DB_FROM=r_air
DB_TO=r_air2
fifo_name=fifo-${DB_FROM}-to-${DB_TO}
mkfifo $fifo_name
influx_inspect export -datadir /var/lib/influxdb/data -waldir /var/lib/influxdb/wal -database $DB_FROM -out $fifo_name &
cat $fifo_name \
| sed -e "s/^CREATE DATABASE ${DB_FROM} WITH/CREATE DATABASE ${DB_TO} WITH/" \
| sed -e "s/^# CONTEXT-DATABASE:${DB_FROM}$/# CONTEXT-DATABASE:${DB_TO}/" \
| influx -import -path /dev/stdin
rm $fifo_name Note that you can't use The only downside: it's extremely slow. The number of lines to process is somewhere around 3/4 the number of bytes in the gzipped backup, so a 1GB backup will require processing about 750M lines, and at 100k lines/sec on a modest machine, that's about 2 hours. |
Currently struggling with restore/backup, I'm also surprised that I can't restore a backup over an existing database. I expected new data to be added and existing data to be overwritten. I thought this was what is meant in the docs by
Perhaps the docs refer to duplicate data points in the backup itself (although I wonder how that could happen in the first place). Please consider this a feature request then. The lack of an ability to restore a partial DB file into an existing database is an important shortcoming. Use case: I recently backed up / restored databases to migrate an InfluxDB instance and something went wrong, I guess, because new databases lack chunks of data. After a few days, I made new backups and would like to complete the new databases. I can't afford to replace from scratch because new databases have been recording new data since the migration. I've been trying the workaround proposed by @aanthony1243 in #9593 (comment):
Unfortunately, it seems only measurements of numerical type are copied (#18132) so it does not provide a full backup/restore solution. At this point, I have data in two different databases and I can't find a way to merge data from one into another. |
@lafrech the InfluxDB team has moved on to version 2.0, so you won't see a feature like this added to 1.x. Consider using the hack I mentioned a few comments ago to merge data from one database to another. |
Influxdb 1.5 (apine docker version)
backup
restore
error
I tried deleting the 2 databases before restoring, and it didn't work.
The text was updated successfully, but these errors were encountered: