sysadminmike / couch-to-postgres

Node libary to stream CouchDB changes into PostgreSQL
BSD 2-Clause "Simplified" License
111 stars 17 forks source link

multi master replication #19

Open gcarranza opened 9 years ago

gcarranza commented 9 years ago

is it possible use couchdb replicator over the postgres database on couch-to-postgres?

sysadminmike commented 9 years ago

sorry im not clear on your question if you mean can it sync postgres as the source db then no

you can use the postgres http extension to populate a couchdb and then use couch as your datasource with master-master replication and using couch-to-postgres populate separate postgres databases.

This is currently how i am using it eg

Postgres at location 1 couch-to-postgres 1
couch at location 1
Internet
Couch at location 2 couch-to-postgres 2

Postgres at location 2

With couch 1 & 2 replicating to each other - so if you add a doc to couch 1 it will appear in postgres 2

gcarranza commented 9 years ago

ok, perfect, i have another question i need to know if you know other forms of doing master master replication with postgres and the advantages of using coudchb. i'm asking you because i'm looking for master master replication and your tool looks very interesting

sysadminmike commented 9 years ago

Im not sure there is a simple method to do multi-master replication with postgres - this is the reason we chose couchdb as our datasource - we were using solr then elasticsearch for searching/querying the data when couch map/reduce was not enough.

however elasticsearch uses a LOT of memory (and needs more as the index grows) but with postgres we have gone down from 4gb vm for elasticsearch to a 2gb vm for postgres and no problems with memory issues.

Take a peek at: http://blog.2ndquadrant.com/jsonb-type-performance-postgresql-9-4/ for jsonb indexing stuff and postgres

gcarranza commented 9 years ago

Thanks for you reply, i have another question for that im open a new issue about instalation

sysadminmike commented 9 years ago

sure ask away - btw i have released an npm: https://www.npmjs.com/package/couch-to-postgres so should make life simpler to install with:

npm i couch-to-postgres