Badger v0.9 provides a CLI tool
badger , which can do offline backup/restore. Make sure you have
$GOPATH/bin in your PATH to use this tool.
Do the offline backup/restore CLI tool only provided by badger v0.9? I use badger v3, but I can’t find the CLI tool. If I want to backup badger v3, the only way is to use public API methods
The CLI tool is in the repo here and is still around: badger/badger/cmd at master · dgraph-io/badger · GitHub
The CLI backup tool just executes db.Backup()/Load()
But db.Backup() is a small wrapper around a badgerdb Stream with a known format for Load() to use, so you could implement whatever you want on your own Stream and have it make more sense for your application maybe.
ok, I see, thanks. One another question, when I use the backup API or restore API, must I stop the front writing ops, that is to say, I need stop the business to call backup or restore API?
for backup, no - for load, yes. Check the docs, details are there.