You are viewing a plain text version of this content. The canonical link for it is here.
Posted to replication@couchdb.apache.org by Daniel Hopkins <ds...@earthlink.net> on 2014/08/13 21:24:15 UTC
Continuous Replication with Credentials?
Hi folks, CouchDb Noob here..
couchdb-1.6.0
I'm trying to setup replication such that it persists across restarts.
My understanding to do this I must add a Document to: _replicator
In addition I have created an admin account: admin:password
if create the document like:
|{
"|source|":|"http://admin:password@SOURCE_HOST:5984/test"|,
"|target|":|"http://admin:password@TARGET_HOST:5984/test"|,
"|create_target|":|true|,
"|continuous|":|true|,
}|
it works..(which is good :)
my question is:
if I create the replication doc like:
|{
"|source|":|"test"|,
"|target|":|"http://admin:password@TARGET_HOST:5984/test"|,
"|create_target|":|true|,
"|continuous|":|true|,
}|
it will fail, as it has no credentials to read 'test' even though the
process is running locally.
I noticed as well that when using the http form for the source, that
couchdb shows 'get' requests every x seconds for the replication..is there
a way to specify credentials without using the http form on the source??
(I tried un:pd@sourceDbName..didnt work)
Thanks
Dan
Re: Continuous Replication with Credentials?
Posted by Dave Cottlehuber <dc...@jsonified.com>.
> Hi folks, CouchDb Noob here..
> couchdb-1.6.0
>
> I'm trying to setup replication such that it persists across restarts.
> My understanding to do this I must add a Document to: _replicator
>
> In addition I have created an admin account: admin:password
>
> if create the document like:
>
> |{
> "|source|":|"http://admin:password@SOURCE_HOST:5984/test"|,
> "|target|":|"http://admin:password@TARGET_HOST:5984/test"|,
> "|create_target|":|true|,
> "|continuous|":|true|,
> }|
>
> it works..(which is good :)
>
> my question is:
> if I create the replication doc like:
>
> |{
> "|source|":|"test"|,
> "|target|":|"http://admin:password@TARGET_HOST:5984/test"|,
> "|create_target|":|true|,
> "|continuous|":|true|,
> }|
>
> it will fail, as it has no credentials to read 'test' even though the
> process is running locally.
> I noticed as well that when using the http form for the source, that
> couchdb shows 'get' requests every x seconds for the replication..is there
> a way to specify credentials without using the http form on the source??
> (I tried un:pd@sourceDbName..didnt work)
>
> Thanks
> Dan
>
Hey Dan,
As Jens mentioned, try this:
POST /your_couch/_replicator
{
_id: “replication_id”,
source: “here”,
target: “there”,
continuous:true,
owner:”admin",
roles:["_admin”]
}
A+
Dave
Re: Continuous Replication with Credentials?
Posted by Jens Alfke <je...@couchbase.com>.
According to the old CouchDB wiki*, a replication doc can have an "owner" property to indicate the local user that owns it; presumably it will use the credentials of that user when accessing the local database.
—Jens
* http://wiki.apache.org/couchdb/Replication#Replicator_database