如何使用 ArangoDB 转储所有数据库 [英] How to dump all databases with ArangoDB
问题描述
我在本地运行 ArangoDB,其中包含来自多个不同项目的数据库、集合、数据和图表.我想备份所有内容,以便我可以重建我的系统.我知道如何备份单个数据库,但因为我有一堆数据库,所以我希望一次性完成.
I have ArangoDB running locally with databases, collections, data and graphs from several different projects in it. I'd like to back up everything so I can rebuild my system. I know how to do a backup of a single database, but because I have a bunch I'm hoping to do this in one shot.
本质上,我正在寻找与 ArangoDB 等效的
Essentially, I'm looking for the ArangoDB equivalent of
mysqldump -u root -p --all-databases > alldb.sql
显然是
mysql -u root -p < alldb.sql
也很高兴知道.
推荐答案
从 3.3 版开始,arangodump 不支持一次转储所有数据库.它是每个数据库.
As of release 3.3, arangodump does not support dumping all databases at once. It is per database.
为了让它转储所有数据库,它可以在所有数据库的循环中调用,例如
To make it dump all databases, it can be invoked in a loop over all databases, e.g.
# loop over all databases
for db in `arangosh --javascript.execute-string "db._databases().forEach(function(db) { print(db); });"` # host, user and password go here...
do
arangodump --sever.database "$db" # host, user and password go here...
done
如果有一个用户拥有所有数据库的访问权限,这将起作用.
This will work if there is one user that has access privileges for all databases.
这篇关于如何使用 ArangoDB 转储所有数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!