CouchDB dump to file and load from file

Viewed 30152

I cannot replicate between two couchdb servers, so I would like to dump to file from one server and load from file into the other server.

I used this statement to dump and it worked fine:

curl -X GET http://localhost:5984/<DATABASE_NAME>/_all_docs?include_docs=true > FILE.txt

But when I used this statement to load:

curl -d @FILE.txt -H “Content-Type: application/json” -X POST http://localhost:5984/<DATABASE_NAME>/_bulk_docs

it failed like this:

curl: (6) Could not resolve host: application; Host not found {"error":"bad_content_type","reason":"Content-Type must be application/json"}

Any ideas?

6 Answers

There's also github.com/danielebailo/couchdb-dump , which might help to clean out old transients, the authors state:

We've seen 15GB database files, containing only 2.1GB of raw JSON, reduced to 2.5GB on disk after import!

There are also hints on how update_seq works if you want do sync clusters.

Related