Search code examples
couchdbcouchdb-futon

Merge multiple databases in couchDB


I have multiple databases wherein each database is harvesting some hundred thousand tweets. I am not looking to merge these databases together to get more in depth analysis. However, I cannot find anything which could help me merging these databases, which were created in CouchDB.

$ npm install -g couchdb-merge

Installed this, and then ran below:

$ couchdb-merge --database aus_vs_pak_new.couch nz_vs_wi_new.couch --database merge.couch

However, I get error :

/usr/local/bin/couchdb-merge: line 2: /bin: Is a directory
/usr/local/bin/couchdb-merge: line 2: /bin: Is a directory
/usr/local/bin/couchdb-merge: line 2: /bin: Is a directory
/usr/local/bin/couchdb-merge: line 2: /bin: Is a directory
/usr/local/bin/couchdb-merge: line 2: /bin: Is a directory
/usr/local/bin/couchdb-merge: line 2: /bin: Is a directory
/usr/local/bin/couchdb-merge: line 2: /bin: Is a directory
....

How to resolve this issue?


Solution

  • Looks like you want to merge two different databases into one. You can do this from couchdb itself by using the _replicate endpoint.

    If you have access to futon then you can click on the replicator link in the sidebar to replicate with the help of a user interface.

    After merging the databases aus_vs_pak and nz_vs_wi into a new database say "crikcet_analysis" the final database will contain everything from the two sources. Keep in mind though the indexes are not replicated and you will have to recreate them.