couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Polzer <ch...@hai-fai.de>
Subject Re: Peer-to-Peer Replication
Date Wed, 06 Apr 2011 18:59:06 GMT



On 06.04.2011, at 20:50, Zdravko Gligic wrote:

>>> (1) How would two CouchDB go about discovering and meeting each other?
>>>  Would this not require a central server (similar to IRC) and are
>>> there any hosted solutions?
>> 
>> Two instances don't discover -- they depend on *you* telling them to
>> replicate.
> 
> I realize that keeping track of "who is currently online" is something
> that one needs to develop as part of one's application and was in fact
> curious if there were already built solutions for this, either as
> software or even as hosted services ?

You can configure the replication for continuous replication, they will find each other when
available. Also, this is a key feature to CouchDB. That's why CouchDB for example is working
so well with mobile devices: It's replicating when it's online/connected. Link: http://www.couchbase.com/products-and-services/mobile-couchbase
It has to be remembered, that  (until version 1.2, I think i remember) these settings are
lost upon server restart.

> 
>> POST /_replicate HTTP/1.1
>> {"source":"http://foo.bar/database","target":"database"}
>> 
>> Once you've triggered a replication, CouchDB takes over and figures out
>> the differences between the DB revisions on both instances.
>> 
>> Once it is done, it is done -- unless you pass continuous: true. That
>> sets up continuous replication, where the target will watch the source's
>> _changes API and replicate new docs over as needed.
> 
> However, for a bunch of peers, it seems that there would need to be a
> form of a ripple effect, where two peers then go on to discover other
> peers with more up to date CouchDB instances.

CouchDB is all about local data, especially with replication (MVCC). 

There are many nice features with CouchDB replication, I would really recommend reading the
replication section in the CouchDB book.

It is explained very understandable there. 



> 
>> For more, see http://guide.couchdb.org/draft/replication.html. It's a
>> great guide.
> 
> That contains an excellent explanation of what happens between two
> peers. However, it seems that any serverless p2p application would
> require lots of sophistication just to determine who needs to connect
> to who, in order for everyone to get updated in most or even
> relatively efficient manner.
> 
>>> (2) Once at least two CouchDB's discover and meet each other, is it
>>> just their URLs (domain name or IP based) that are needed? What about
>>> routers and/or firewalls?
>> 
>> Yep. As long as the instances can reach each other, everything should
>> just work (TM).
> 
> How would 2 CouchDBs communicate to each other if both are in
> different homes, where each one is behind a router with multiple
> computers as CouchDB peers?
> 
>> If you want to look at some other offerings, BigCouch
>> (https://github.com/cloudant/bigcouch) is one that I quite like. But IMO
>> you should get comfortable with what CouchDB provides before you go
>> elsewhere.
> 
> In terms of this p2p replication, what specifically does BigCouch
> offer that is beyond regular CouchDB?
> 
> Thanks again.


Mime
View raw message