Sync Gateway Failure

Hi,

I am using couchbase 5.0 community server, sync gateway 1.5.0. My sync gateway is working fine with a single cluster. But as per recommendation, couch requires at least two clusters for replication. When I add two servers. My sync_gateway stopped working. If anyone can help me, Please suggest me how to solve this issue. I am getting following log:

"2017-11-29T15:30:37.436Z Enabling logging: [CRUD CRUD+ HTTP HTTP+ Access Cache Shadow Shadow+ Changes Changes+]
2017-11-29T15:30:37.436Z ==== Couchbase Sync Gateway/1.5.0(594;e78dbf1) ====
2017-11-29T15:30:37.436Z Configured process to allow 5000 open file descriptors
2017-11-29T15:30:37.436Z Opening db /profile as bucket “profile_detail”, pool “default”, server http://52.77.82.98:8091
2017-11-29T15:30:37.436Z GoCBCustomSGTranscoder Opening Couchbase database profile_detail on http://52.77.82.98:8091 as user “digiscribe"
2017-11-29T15:31:08.408Z WARNING: Error installing Couchbase design doc: Put http://172.31.31.210:8092/profile_detail/_design/sync_gateway: dial tcp cluster1-ip:8092: i/o timeout – db.installViews.func1() at database.go:747
2017-11-29T15:31:38.414Z WARNING: Error installing Couchbase design doc: Put http://172.31.31.210:8092/profile_detail/_design/sync_gateway: dial tcp cluster1-ip:8092: i/o timeout – db.installViews.func1() at database.go:747
2017-11-29T15:32:08.425Z WARNING: Error installing Couchbase design doc: Put http://172.31.31.210:8092/profile_detail/_design/sync_gateway: dial tcp cluster2-ip: i/o timeout – db.installViews.func1() at database.go:747
2017-11-29T15:32:38.446Z WARNING: Error installing Couchbase design doc: Put http://172.31.30.126:8092/profile_detail/_design/sync_gateway: dial tcp cluster2-ip:8092: i/o timeout – db.installViews.func1() at database.go:747
2017-11-29T15:33:08.486Z WARNING: Error installing Couchbase design doc: Put http://172.31.30.126:8092/profile_detail/_design/sync_gateway: dial tcp cluster2-ip:8092: i/o timeout – db.installViews.func1() at database.go:747
2017-11-29T15:33:38.567Z WARNING: Error installing Couchbase design doc: Put http://172.31.31.210:8092/profile_detail/_design/sync_gateway: dial tcp cluster1-ip:8092: i/o timeout – db.installViews.func1() at database.go:747
2017-11-29T15:34:08.728Z WARNING: Error installing Couchbase design doc: Put http://172.31.31.210:8092/profile_detail/_design/sync_gateway: dial tcp cluster1-ip:8092: i/o timeout – db.installViews.func1() at database.go:747
2017-11-29T15:34:39.049Z WARNING: Error installing Couchbase design doc: Put http://172.31.31.210:8092/profile_detail/_design/sync_gateway: dial tcp cluster1-ip:8092: i/o timeout – db.installViews.func1() at database.go:747
2017-11-29T15:35:09.690Z WARNING: Error installing Couchbase design doc: Put http://172.31.30.126:8092/profile_detail/_design/sync_gateway: dial tcp cluster2-ip:8092: i/o timeout – db.installViews.func1() at database.go:747
2017-11-29T15:35:40.970Z WARNING: Error installing Couchbase design doc: Put http://172.31.30.126:8092/profile_detail/_design/sync_gateway: dial tcp cluster2-ip:8092: i/o timeout – db.installViews.func1() at database.go:747
2017-11-29T15:36:13.531Z WARNING: Error installing Couchbase design doc: Put http://172.31.30.126:8092/profile_detail/_design/sync_gateway: dial tcp cluster2-ip:8092: i/o timeout – db.installViews.func1() at database.go:747
2017-11-29T15:36:48.652Z WARNING: Error installing Couchbase design doc: Put http://172.31.30.126:8092/profile_detail/_design/sync_gateway: dial tcp cluster2-ip:8092: i/o timeout – db.installViews.func1() at database.go:747
2017-11-29T15:36:48.652Z WARNING: RetryLoop for Attempt to install Couchbase design doc bucket : sync_gateway giving up after 12 attempts – base.RetryLoop() at util.go:298
2017-11-29T15:36:48.652Z FATAL: Error opening database: Put http://172.31.30.126:8092/profile_detail/_design/sync_gateway: dial tcp cluster2-ip:8092: i/o timeout – rest.RunServer() at config.go:769”

Please have a look on sync_gateway.json as well. Am i doing something wrong

{
“interface”: “:4984”,
“adminInterface”: “:4985”,
“log”: [“CRUD”, “CRUD+”, “HTTP”, “HTTP+”, “Access”, “Cache”, “Shadow”, “Shadow+”, “Changes”, “Changes+”],
“databases”: {
“profile”: {
“server”: “http://cluster1-ip:8091”,
“bucket”: “profile_detail”,
“username”: “username”,
“password”: “password”,
“enable_shared_bucket_access”: true,
“import_docs”: “continuous”,
“sync”: function(doc) {channel(doc.channels);},
“users”: {
“GUEST”: {
“disabled”: false,
“admin_channels”: ["*"]
}
},
“unsupported”: {
“enable_extended_attributes”: true,
“replicator_2”: true
}
},
“CORS”: {
“Origin”: [“http://localhost:4200”],
“LoginOrigin”: [“http://localhost:4200”],
“Headers”: [“Content-Type”],
“MaxAge”: 17280000
}
}

Regards,
Achint

@achint,

In the above its trying to create a view but is getting timed out.
So it looks like your SG node is not able to talk to all or some ports on the new CB node.

Here is a list of all the port you need open. Couchbase SDKs

You want “Client to Node”.

Go into the SG node and run this:
#nc -zv {ip of CB Node} {port}

Example
nc -zv 9.9.9.9 8092

Did you mean to say a two node cluster rather two clusters? Also, when you say replication, what kind of replication are you referring to exactly?

@traun
Yes I mean to say two node cluster. Actually, I want to achieve mobile replication using sync_gateway. I already tried with one node server. But sometimes I am not getting any update from 1 node server.

Previously I was using couchbase 3.6.1 and sync_gateway 1.4.1. I was using shadowing of bucket to achieve mobile replication.

But currently i am using couchbase 5.0 and sync_gateway 1.5.0. I am missing some updates. For an Example when I am deleting some document or updating some documents those documents, I am unable to get updates on my mobile using sync_gateway.

Please help me with this because I am new to couchbase.

You indicate that you are “missing some updates” - Did you make the SG config changes as indicated in this blog post on shared bucket access.

Is this happening every time or is it sporadic? Can you provide more details and possibly a sample doc?

@priya.rajagopal looks like these settings are set:

enable_shared_bucket_access”: true,
“import_docs”: “continuous”,

what settings in particular were you thinking?

Nevermind. You are right. It looks fine.

@traun @priya.rajagopal

Actually, i made SG bucket access. @traun it is happening to me every time. Twice it happened that I am not able to get any updates on the local machine.

For example, this example has occurred multiple times:

  1. I deleted a document from the bucket. It is removed from my sync_url as well but it is not deleted from mobiles.

  2. I update any document on the server. It is updated on sync_url as well (Its revision id changed). But still, I am not able to get an update on mobile end.

Regards,
Achint

What is the CBL version you are using? is it 2.0 or 1.4.1 ?

If it is 2.0 which DB build you are using. Because I see

And it only works with 2.0 and not with 1.4.1

@pankaj.sharma

It is CBL 2.0.

There was a problem in DB build 20 can you try with DB build 19.

@pankaj.sharma I am already using CBL2.0 Build 19

Although its a moot point since DB19 is in use , want to highlight that the DB20 replication issue is only for .Net. From the other ticket filed by @achint on this related topic, it looks like they are using Android.