My aim is to create the arango database dump (with all the users and passwords, permissions, databases, collections, roles and so on) and then make a full restore of this data on the other arango server (that was installed from scratch and empty).
I am using the one-node configuration, arangodb version is 3.4.4 [linux] .
On origin I make a dump of every database:
USER=root
PASSWORD=***
for db in $(arangosh --server.username "$USER" --server.password "$PASSWORD" --javascript.execute-string "db._databases().forEach(function(db) { print(db); });")
do
arangodump --output-directory /tmp/dump/"$db" --overwrite true --server.username "$USER" --server.password "$PASSWORD" --include-system-collections --server.database "$db"
done
Then I move the created folders to the empty arangodb server on this server go with:
arangorestore --input-directory "/tmp/dump/_system/"
arangorestore --input-directory "/tmp/dump/collection/"
arangorestore --input-directory "/tmp/dump/collection2/"
...one by one
The result if very far my expectations, I just get the collections in _system database for the root user (no other users, no databases).
What am I doing wrong? How can I make the full backup and restore?
Thanks in advance.
arangorestore
needs to be told to which database to restore the data to. This can be achieved by providing the --server.database
option in the same way as it can be done for arangodump
. If no value is provided for --server.database
it will default to _system
, meaning the subsequent invocations of arangorestore will each overwrite the previous data in the _system
database.
If the target databases do not exist yet on the backup server, it is possible to create them on the fly using the option --create-database true
. Additionally, to restore system collections, arangorestore
needs to be given the option --include-system-collections true
.
That means, if your databases are really named "collection" and "collection2", your restore commands should look as follows:
arangorestore --input-directory "/tmp/dump/_system/" --server.database "_system" --include-system-collections true --create-database true
arangorestore --input-directory "/tmp/dump/collection/" --server.database "collection" --include-system-collections true --create-database true
arangorestore --input-directory "/tmp/dump/collection2/" --server.database "collection2" --include-system-collections true --create-database true
Please also note that with ArangoDB 3.5 there is an option --all-databases
for both arangodump and arangorestore, which should greatly simplify the backup and restore process.
To take dump from remote server or local server execute the command
arangodump --server.endpoint tcp://ip_address:8529 --server.username test --server.password test --server.database dev --output-directory "dump"
To restore from dump execute the below command
arangorestore --server.endpoint tcp://ip_address:8529 --server.username test --server.password test --server.database dev --input-directory "dump"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.