couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kowsik <kow...@gmail.com>
Subject Re: _replicator database...
Date Tue, 28 Jun 2011 22:44:32 GMT
On Tue, Jun 28, 2011 at 3:29 PM, Filipe David Manana
<fdmanana@apache.org> wrote:
> On Tue, Jun 28, 2011 at 10:57 PM, kowsik <kowsik@gmail.com> wrote:
>> Playing around with 1.1.0 and the _replicator database. I have, say,
>> C1 that has require_valid_user set with admin credentials of foo:bar.
>> I'm trying to do this on C2:
>>
>> curl -X PUT -H 'application/json' -d '{
>>    "source":"http://foo:bar@C1/mydb",
>>    "target":"mydb",
>>    "create_target":true,
>>    "continuous":true
>> }' http://C2/_replicator/from_c1
>>
>> But no worky for me. The document itself gets added fine, but I see
>> "unauthorized to access database" message in the log. Is the
>> replicator not honoring the credentials specified in the document?
>> Bug, work around?
>
> Hi Kowsik!
>
> Is the error "unauthorized to access database" related to the local
> target database? If so, consider the following:
>
> Your server has admins configured? If so, the replication request can
> not create the target database (you didn't provide admin credentials
> for the curl put request).
> So either create it first, as an admin, or let the admin PUT the
> replication document with an explicit user_ctx property in the doc
> such as:
>
> {
>     "source":"http://foo:bar@C1/mydb",
>     "target":"mydb",
>     "create_target":true,
>     "continuous":true,
>    "user_ctx": {
>         "roles": ["_admin"]
>    }
> }
>
> You can read about this at  https://gist.github.com/832610, section 8.
> Anyway, there should be a more explicit error log message telling the
> problem was creating the target.
> Let us know if it works.

Neat! Worked like a charm. One thing though, if there's the
authorization error, the replicator goes into retry mode (which is
fine). However while in retry mode, it doesn't seem to check that the
doc might've been deleted (which I did). Just keeps on trying until it
finally gives up.

Love the persistence after reboots/restarts. Exactly what I wanted.
BTW I'm doing continuous replication from 1.0.2 to 1.1 which seems
like the simplest way to upgrade a production Couch. :)

K.
---
http://blitz.io
http://twitter.com/pcapr
http://blog.mudynamics.com

Mime
View raw message