My synch-gateway stopped, How to revert?


#1

Hi, Suddenly today my sync gatway stopped responding. so i stopped and started again. But now it is showing running. But still it is not working. even my couchbase server showing empty bucket as well. Is it mean of did i lost my entire data on server?

Please, someone, help me.


#2

@itssrinadh can you be more specific in:

  • What version of Sync Gateway you are running
  • What version of Couchbase Server you are running
  • How SG stopped responding. Did it return errors from the API, or just hang on requests?
  • Provide, or look in the Sync Gateway logs to see if there’s anything indicating why it stopped responding in the first place? SG shouldn’t need to be restarted, so it suggests an underlying problem elsewhere.

#3

@bbrks thanks for reply.

here are the details.

couchbase-server-community_5.0.1-ubuntu16.04_amd64
couchbase-sync-gateway-community_1.5.1_x86_64
couchbase-lie 2.0
sync gateway error logs link

When i hit http://myipadress:4984/db/ not responding. i have data in my server. i want to use it wihtout any lose. please help me on this.


#4

It appears you’re not authenticating with Couchbase server correctly from Sync Gateway.

2018-05-11T14:13:41.308Z Opening db /db as bucket “default”, pool “default”, server http://myipaddress:8091
2018-05-11T14:13:41.308Z GoCBCustomSGTranscoder Opening Couchbase database default on http://myipaddress:8091 as user “default”
2018-05-11T14:13:41.311Z WARNING: Error opening bucket: default. Error: authentication error – base.GetCouchbaseBucketGoCB() at bucket_gocb.go:118

Make sure you have an RBAC user created in Couchbase Server that has the “Bucket Admin” role, and specify that username and password in your Sync Gateway config.


#5

FYI, I don’t have any users added right now. please find the attachment.

Can i create a new user and added into sync gateway config as well right now?

I am not able to see any data in my bucket as well.


How to restart sync gateway to work?
#6

@bbrks For your reference,
Here is my sync gateway config file

{
	"log": ["*"],	
	"databases": {
		"db": {
			"server": "http://myipaddress:8091",
			"bucket": "default",
			"users": {
				"GUEST": {"disabled": false, "admin_channels": ["*"] }
			}
		}
	}
}

#7

Create a user in Couchbase Server with the Bucket Admin role, and then update your SG config to include the following fields inside the db property:

"username": "your_cb_username",
"password": "your_cb_password",

This will solve the authentication issue you’re seeing.

As for the empty bucket, check if you have any filters set in the Couchbase Server UI that would be hiding things, and also check the values on the main ‘Bucket’ page to verify the number of documents you have:


#8

Here showing 0 records. i thought after i restart server and synch gateway data gone from my server.

Here is the link for my sync gateway error logs.


#9

i added user name and password in sync gateway, but still facing the same issue. Even I restarted couchbase sync gateway as well.

Still showing errors like erarlier.


#10

Your logs show the first run of Sync Gateway was using a Walrus database, which is an in-memory store that is not persisted by default. This explains why you see no documents in Couchbase Server, and this also explains your out of memory error, as you would have put in more documents than can fit in your system memory.

You need to connect Sync Gateway to a Couchbase server for persistence of documents. You’re still facing the same authentication issues, so check the RBAC user you created in Couchbase has the correct permissions for the bucket you’re connecting to, and verify that the username and password used in your sync gateway config are correct.


#11

Can I get data back from walrus to new bucket without any lose of data.

I created user and gave admin access for all buckets. But still facing same issue. How to check couchbase bucket previliges.


#12

All the data that was in Walrus was only stored in-memory, and as soon as the process stopped it was lost. See this section of the docs for detail:

https://developer.couchbase.com/documentation/mobile/current/installation/sync-gateway/index.html#walrus-mode

RE: Authentication… Does your SG config now look like this?

{
	"log": ["*"],	
	"databases": {
		"db": {
			"server": "http://myipaddress:8091",
			"bucket": "default",
			"username": "your_cb_username",
			"password": "your_cb_password",
			"users": {
				"GUEST": {"disabled": false, "admin_channels": ["*"] }
			}
		}
	}
}

#13

Can you confirm me, whatever user name and password we are given in couxbase UI. Those are need to give in config file. Am i rifht?

I did like that only. But still same issue.

Why default data stired inti walrns instrad of default bucket.


#14

Yes, the username and password you specified when you created an RBAC user are the ones you need to add into the config.

The default data store for Sync Gateway is Walrus so that developers can get started without the need for Couchbase Server to be running. However, as noted in the “Getting Started” page of the documentation, documents in Walrus are not persisted, and Walrus is not intended to be used for production data.


#15

But still I’m getting the same issue as like earlier, Even I added username and password into the config file and restarted syn gateway.

Did i miss anything?


#16

What access did you give the user that you created on the server ? Make sure user has Bucket Full Access and Read Only Admin roles. See details here.

And then restart the Sync Gateway with appropriate credentials


#17

I gave admin access to a user. PFA

I did restart sync gateway like below.

sudo service sync_gateway restart

Following are my sync gateway config file

{
	"log": ["*"],	
	"databases": {
		"db": {
			"server": "http://myipaddress:8091",
			"usernam" :"admin",
			"password":"password",
			"bucket": "default",
			"users": {
				"GUEST": {"disabled": false, "admin_channels": ["*"] }
			}
		}
	}
}

#18

hmmmm…looks like a typo in “username” or is it a copy and paste error to this post?


How to restart sync gateway to work?
#19

Anyway, I am doing new one due to I was stored my data into Walrus. Thank you for promt reply.

Can you please guide me on this.