CouchDB对于实现分布式数据复制是非常容易的。
我们只需要发送POST请求到指定数据库的_replicate URL即可,请求的Body是一个JSON。
wiki.apache.org/couchdb/Replication
如果需要持续进行复制,只需要在JSON中加上参数"continuous":true即可。
另外,我们可以通过Futon的replicator工具直接在UI上操作。
http://localhost:5984/_utils/replicator.html
譬如:
Replicate changes from: Local Database: testdb
To: Remote database : http://remote_ip:5984/testdb勾选Continuous后点击replicate按钮即可。
参考资料:
http://guide.couchdb.org/draft/replication.html
http://joeandmotorboat.com/2009/01/27/couchdb-load-balancing-and-replication-using-haproxy/
http://ephemera.karmi.cz/post/247255194/simple-couchdb-multi-master-clustering-via-nginx