Problem in connecting sync gateway to Couchbase server

Hi ,
I have configure the couchbase server on server side machine and trying to connect sync gateway from client . but it not able to connect and showing error as 502, I am not able to figure out problem .

below is the config.json file

{
  "interface": ":4984",
  "adminInterface": ":4985",
  "log": ["*"],
  "databases": 
  {
    "database_1": 
		{
    "server": "http:// External_IP_Of_VM :8091",
    "bucket": "default",
    "sync": `function(doc) {channel(doc.channels);}`,
	"users":
			{
			"user1": 
				{
				"password": "password",
				"disabled": false
				}			
			}  
		}
	}
  }

and getting error as

please suggets what i am doing wrong or what else is missing !

The sync gateway config looks correct. Are you able to login to the Couchbase Server Console on http:// External_IP_Of_VM :8091 in a browser?

James

@jamiltz
Yes. I am able to login thro’ console , but problem in connecting sync gate way .
one more doubt I have to clear, Users defined in the config file should be present user or it’ll create new user for given details in config file?

I’m not sure why it’s not working then. Users specified in the config file are created automatically when Sync Gateway starts.

James

The problem looks unrelated to Sync Gateway user setup - it’s the failed connection between Sync Gateway and Couchbase Server.

Are the required Couchbase Server ports visible from your Sync Gateway machine? (i.e. can you hit External_IP_Of_VM:8091/pools with a curl request from the machine your Sync Gateway is running on)

Hello @shriram.punde.

Check for the " to be in utf encoding or linux encoding, if the config contains strange characters the sync server does not start correctly, in your case check the " character.

@faguirre @adamf @jens @jamiltz

Hi all,

I am trying to connect sync gateway which is on external IP, Problem is that I am not able to connect with sync gateway by code (trying to do replication) . It is continuesly emmiting error as Connection refused by :4984/bucketName.

Error :

SEVERE: RemoteRequest: RemoteRequest{GET, http://:4984/default/_session}: executeRequest() Exception: org.apache.http.conn.HttpHostConnectException: Connection to http://:4984 refused. url: http://***********:4984/default/_session

My doubt is should I have to create a proxy settings by code for connecting with sync gateway???

But when I am trying to add the data directly on couchbase server thro’ code it is not giving such kind of error . So Problem is of proxy settings or something else?

Please suggest

In your config file, default is the name of the Couchbase Server bucket. To connect to Sync Gateway for replications you must provide the database name in the URL http://******:4984/database_1.

James

@jamiltz
that was by mistacally added in config.json, I changed database name to “default” my bucket name and database name is same i.e. “default”, but I am facing above issue.

Oh ok
Can you access Sync Gateway when removing the proxy? And if so which proxy server are you using?

James

Hi Shriram, i have just started working on Couchbase and trying connectivity between CB server and Sync Gateway. I am getting the exact same error as you mentioned above. I have tried re-installing both server and sync gateway, changed the port no.in config file and tried starting the sync gateway but noway i can start it.What did you do to get this issue resolved?