You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by kowsik <ko...@gmail.com> on 2011/06/28 23:57:15 UTC

_replicator database...

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?

Thanks,

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

Re: _replicator database...

Posted by Filipe David Manana <fd...@apache.org>.
On Tue, Jun 28, 2011 at 11:44 PM, kowsik <ko...@gmail.com> wrote:
> 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.

Hum, in the 1.1.x code it might take some time to realize the doc was
deleted. I think this doesn't happen on trunk (upcoming 1.2). I'll see
what I can do there and improve that error message.

>
> 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
>



-- 
Filipe David Manana,
fdmanana@gmail.com, fdmanana@apache.org

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."

Re: _replicator database...

Posted by kowsik <ko...@gmail.com>.
On Tue, Jun 28, 2011 at 3:29 PM, Filipe David Manana
<fd...@apache.org> wrote:
> On Tue, Jun 28, 2011 at 10:57 PM, kowsik <ko...@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

Re: _replicator database...

Posted by Filipe David Manana <fd...@apache.org>.
On Tue, Jun 28, 2011 at 10:57 PM, kowsik <ko...@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.

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



-- 
Filipe David Manana,
fdmanana@gmail.com, fdmanana@apache.org

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."