I have a couchbase-server running successfully at http://172.20.21.11:8091, and I am trying to connect my sync_gatway to the server. Here is my config.json
and I am running sync_gateway config.json. It seems like it’s somehow finding the server, but it’s failing because of SASL_AUTH. Is there something I am missing here?
17:01:44.500445 Enabling logging: [REST]
17:01:44.501112 ==== Couchbase Sync Gateway/master(0db4913+CHANGES) ====
17:01:44.502480 Opening db /sync_gateway as bucket "sync_gateway", pool "default", server <http://172.20.21.11:8091>
17:01:44.502924 Opening Couchbase database sync_gateway on <http://172.20.21.11:8091> as user "admin"
17:01:44.655575 WARNING: Error from Incr in _reserveSequences(0): MCResponse status=0x20, opcode=SASL_AUTH, opaque=0, msg: Auth failure -- db.(*sequenceAllocator)._reserveSequences() at sequence_allocator.go:59
17:01:44.657072 FATAL: Error opening database: MCResponse status=0x20, opcode=SASL_AUTH, opaque=0, msg: Auth failure -- rest.RunServer() at config.go:415
Nice! Thank you. I was under the impression the username & password fields are for accessing the couchbase server, but that’s really for the bucket. It sounds like username is always the same as the name, in this case sync_gateway. Is that true, or can I change the username?
Also if there is no password, I can just leave off the two fields, and it seems like the connection will be successful.
The credential name must always match the name of the CBS bucket, there is no option to use a different name.
If you are developing an application and don’t need security in that environment, you can leave the password empty on the CBS bucket and then you do not require credentials in your sync gateway configuration file.
Using Docker Compose (this scenario works, because I have added delay for 10 seconds “sleep 10” between Couchbase Server start and Couchbase Sync start):
First setup Couchbase Server and the bucket: docker-compose up and kill it later Ctrl + C
or docker-compose start couchbaseserver
when it’s ready stop it: docker-compose stop couchbaseserver
Now start the server and sync again: docker-compose up
Everything will work, because there is a delay between the services, otherwise the same error: Error opening database: 502 Unable to connect to server: HTTP error 401 Unauthorized is occurred.
Probably the docker image should be changed like adding delay options or maybe something else?
I can see there are a lot of examples here: https://github.com/couchbase/sync_gateway/tree/master/examples , but none of them are using docker compose + real server (not walrus)
Hello, did you solve this? I’ve tried everything and still the same error. If change the entrypoint for a sleep 5000000 and then get inside the container with docker exec -it [containerid] bash, and run the syncgateway command it works! but thats not the idea. Please Help!!!