-
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
feat: Implement backup/restore CLI subcommands #19864
Conversation
ca7f943
to
cea1c15
Compare
authorizer/backup.go
Outdated
// TODO(bbj): Correct permissions. | ||
if err := IsAllowedAll(ctx, influxdb.ReadAllPermissions()); err != nil { | ||
return 0, nil, err | ||
return err | ||
} | ||
return b.s.CreateBackup(ctx) | ||
return b.s.BackupKVStore(ctx, w) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stuartcarnie I don't know the permissions we're using too well so I just left this as a TODO
. Should this be OwnerPermissions()
? Is there a better permission set for backup/restore?
26016ac
to
0ebae22
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking really great, Ben! Thanks so much for pulling all this together.
I have experimented with the tool and the backups appear to be working after I added a minor tweak (see one of my comments). I could confirm the manifest, bolt and TSM files were in my backup path.
I was not able to restore the database, as the tool failed with the following errors.
Trying to restore into the existing bucket:
❯ bin/darwin/influx restore -b my-bucket ~/tmp/backup/
2020-10-30T23:33:01.195380Z info Resources opened {"log_id": "0QAyZOLl000", "path": "/Users/stuartcarnie/tmp/backup/20201030T230351Z.bolt"}
2020-10-30T23:33:01.195762Z info Restoring organization {"log_id": "0QAyZOLl000", "id": "93b0c30ea94cb097", "name": "my-org"}
2020-10-30T23:33:01.198169Z info Restoring bucket {"log_id": "0QAyZOLl000", "id": "7425a44ac4116e88", "name": "my-bucket"}
Error: Cannot create bucket: bucket with name my-bucket already exists.
See 'influx restore -h' for help
Tried to restore into a new bucket:
❯ bin/darwin/influx restore -b foo ~/tmp/backup/
2020-10-30T23:33:10.379596Z info Resources opened {"log_id": "0QAyZxDl000", "path": "/Users/stuartcarnie/tmp/backup/20201030T230351Z.bolt"}
2020-10-30T23:33:10.379950Z info Restoring organization {"log_id": "0QAyZxDl000", "id": "93b0c30ea94cb097", "name": "my-org"}
Error: Bucket "foo" not found.
See 'influx restore -h' for help
e55abd7
to
fdf4eed
Compare
@stuartcarnie I added the As for the restore usage, the |
Ahh right – I didn't even catch that. Sorry for the user error 🤦 I'll take another pass over it shortly |
fb878ce
to
3144a6f
Compare
3144a6f
to
869bffb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
869bffb
to
00b58de
Compare
All requests were addressed, clearing to unblock merge
Great work, @benbjohnson! |
Overview
This pull request adds the
influx backup
andinflux restore
commands to the OSS 2.0 CLI. It combines the functionality of the 1.x commands of the same name but updates them to work with organizations & buckets.Usage
Backup
Restore
Full restore
A full restore completely deletes all data on the server and replaces it with the data in the backup. This includes all org/bucket meta data as well as other info like dashboards:
Partial restore
To restore only the bucket shard data, a partial restore can be done: