You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Wil Chung <ia...@gmail.com> on 2010/08/06 22:51:46 UTC

Re: How to replicate to Couch.io

Hi all,

I seem to be missing something simple. I'm just seeing if I can
replicate from my local couchdb install to couch dot io. I created a
db on my local install, and tried to replicate to the remote version.

for the source, I have "contact-manager" on local install
for the destination, I have "iamwil.couchone.com/contact-manager"

contact-manager is an empty db on the remote.
But it doesn't work. Is it because there are admin permissions on the
remote db? If so, how do I set up the local couchdb instance so that
the remote can accept a replication?  Thanks.

Wil

Re: How to replicate to Couch.io

Posted by Dave Cottlehuber <da...@muse.net.nz>.
Hi Wil

this should be pretty easy to set up using curl or in futon. You are
better off having your couchone.com pull replication from your local
db ie more reliable.

assuming you have disabled admin party on both your boxes (futon
interface, bottom righthand corner) then this should work fine:

curl -v -H Content-Type:application/json -X POST -d
'{"source":"http://admin:password@localhost.external.hostname.com/contact-manager",
"target":"contact-manager"}' \
    http://admin:password@iamwil.couchone.com/_replicate

& you'll see replication get initiated in your couchone.com futon ->
status -- http://iamwil.couchone.com:5984/_utils/status.html

some common issues:
 admin party or passwords are not sorted out on both couches.
 local.ini needs to be bound to all IPs on your local couch, &
accessible through selinux/firewall/router/internet/whatever. For
example my local.ini has:
 ;bind_address = 127.0.0.1
 bind_address = 0.0.0.0
& I can curl or telnet through on port 80 or 5984 from external.

some useful options for your curl/json above explained on the wiki
 "create_target": true
 "continuous": true
 "cancel": true

there are a few good wiki links
 http://wiki.apache.org/couchdb/Replication
 http://wiki.apache.org/couchdb/How_to_replicate_a_database

working example - with creation of DB

$ curl -H Content-Type:application/json -X POST -d  '{"source":
"http://admin:passwd@muse.net.nz:5984/cat", "target": "cat3",
"create_target": true}' \
    http://admin:passwd@muse.couchone.com:5984/_replicate  -v

* About to connect() to muse.couchone.com port 5984 (#0)
*   Trying 184.73.200.44... connected
* Connected to muse.couchone.com (184.73.200.44) port 5984 (#0)
* Server auth using Basic with user 'admin'
> POST /_replicate HTTP/1.1
> Authorization: Basic YWRtaW46d3Vid3Vi
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
> Host: muse.couchone.com:5984
> Accept: */*
> Content-Type:application/json
> Content-Length: 95
>
< HTTP/1.1 200 OK
< Server: CouchDB/1.0.0 (Erlang OTP/R13B)
< Date: Sat, 07 Aug 2010 02:58:49 GMT
< Content-Type: text/plain;charset=utf-8
< Content-Length: 398
< Cache-Control: must-revalidate
<
{"ok":true,"no_changes":true,"session_id":"72f695c7b4791e2f497f0e03a0503fea","source_last_seq":41,"history":[{"session_id":"72f695c7b4791e2f497f0e03a0503fea","start_time":"Sat,
07 Aug 2010 02:54:38 GMT","end_time":"Sat, 07 Aug 2010 02:57:30
GMT","start_last_seq":0,"end_last_seq":41,"recorded_seq":41,"missing_checked":0,"missing_found":9,"docs_read":11,"docs_written":11,"doc_write_failures":0}]}
* Connection #0 to host muse.couchone.com left intact
* Closing connection #0

On 7 August 2010 08:51, Wil Chung <ia...@gmail.com> wrote:
> Hi all,
>
> I seem to be missing something simple. I'm just seeing if I can
> replicate from my local couchdb install to couch dot io. I created a
> db on my local install, and tried to replicate to the remote version.
>
> for the source, I have "contact-manager" on local install
> for the destination, I have "iamwil.couchone.com/contact-manager"
>
> contact-manager is an empty db on the remote.
> But it doesn't work. Is it because there are admin permissions on the
> remote db? If so, how do I set up the local couchdb instance so that
> the remote can accept a replication?  Thanks.
>
> Wil
>