Last active
November 2, 2017 16:40
-
-
Save solisoft/f9360a2da7535e186bd40552bfa925a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'json' | |
DB_USER = '<your_user>'.freeze | |
DB_PASS = '<your_password>'.freeze | |
DB_ENDPOINT = 'http+tcp://0.0.0.0:8529'.freeze | |
DUMP_PATH = '/path/to/your/dump/folder/'.freeze # must exist | |
DB_URL = 'http://0.0.0.0:8529'.freeze | |
uri = URI(DB_URL + '/_api/database') | |
req = Net::HTTP::Get.new(uri) | |
req.basic_auth DB_USER, DB_PASS | |
res = Net::HTTP.start(uri.hostname, uri.port) {|http| | |
http.request(req) | |
} | |
results = JSON.parse(res.body)['result'] | |
results.each do |result| | |
system("arangodump --output-directory #{DUMP_PATH}#{result} --include-system-collections true --server.endpoint #{DB_ENDPOINT} --server.username #{DB_USER} --server.password #{DB_PASS} --overwrite true --server.database #{result}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment