Replication between buckets using sync gateway


#1

Hi,

We are trying to replicate the documents from one bucket to another using SG. However, when we start the SG, no replication occurs between the two buckets. Below is our sample SG config file.
We have referred SG config examples on github.

{
“interface”:":4984",
“adminInterface”:":4985",
“log”:[“CRUD+”,“Events”,“Events+”],
“databases”:{
“sync_gateway”:{
“server”:“http://localhost:8091”,
“bucket”:“igt”,
“revs_limit”:200,
“users”: { “GUEST”: { “disabled”: false, “admin_channels”: [""] } },
“event_handlers”: {
“max_processes” : 1000,
“wait_for_process” : “20”,
“document_changed”: [
{
“handler”: “webhook”,
“url”: "https://
********************.com/api/push/webhook",
“timeout”: 20,
“filter”: function(doc) { if (doc.type == "quickTask" || doc.type == "advTask") { if(doc.onIt) return true; } return false; }
}]
},
“sync”:function(doc,oldDoc){ if (!doc.type) { throw ({forbidden: "A document must have a type"}); } if (oldDoc) { if (oldDoc.type != doc.type) { throw ({forbidden: "A document cannot change its type"}); } } channel(doc.channels) }
},
“notification”:{
“server”:“http://localhost:8091”,
“bucket”:“lateNotification”,
“revs_limit”:100,
“allow_empty_password”: true,
“users”: { “GUEST”: { “disabled”: false, “admin_channels”: ["
"] } },
“sync”:function(doc,oldDoc){channel(doc.channels);}
}
},
“replications”:[
{
“replication_id”:“push-to-sg-continuous”,
“source”:“http://localhost:4985/notification”,
“target”:“http://localhost:4985/sync_gateway”,
“continuous”:true
}
]
}

Please let us know how to proceed further.

Thanks


#2

@sumedh908

Which version of SG are you running?

You will need to run SG from a local source build, built-in support for replication will be released in SG 1.3.


#3

We are using SG version 1.2.

So do we need to clone SG from master branch to achieve this? And also could you elaborate more on ‘local source build’ part?