monkeyUser
monkeyUser

Reputation: 4679

What is the best Way to Export CouchDB?

I'm new in CouchDb, And sometimes I need to export my Database. Until Now I used this command

curl -X GET http://127.0.0.1:5984/nomeDB/_all_docs\?include_docs\=true > /Users/bob/Desktop/db.json

But in this way, before import my Dump with this command

curl -d @db.json -H "Content-type: application/json" -X POST http://127.0.0.1:5984/dbName/_bulk_docs

I have to correct the Json with

"rows": [   =====>   "docs": [

And in this way My documents have one more key, the doc key.

What is the best way to do a Dump to pass, for example, to another developer?

Upvotes: 8

Views: 11128

Answers (1)

Dominic Barnes
Dominic Barnes

Reputation: 28439

The easiest export/import and backup/restore strategy is to simply copy the raw database file. Usually, this file is located at /var/lib/couchdb/my-database.couch. You can safely copy this file, even while the database is running. (Source)

Another option is to use replication to copy entire databases between servers. This option can be done incrementally, unlike the first.

Upvotes: 12

Related Questions