How and where are users stored?


#1

Hi all

Basic question, Im trying to understand where SGW user details are stored.

The SGW docs say; “The user must be created on Sync Gateway before it can be used for authentication.”

Scenario: in an office LAN with local PCs running CB Lite (each PC represents a user), these CB Lite DBs need to be in sync, so we use SGW for this & start a push/pull replication between each PC’s CB lite and SGW,
We create Users using Curl or pass them in via the SGW startup json config file.
How does SGW store the Users? and where?

Are the users stored in memory and therefore volatile? ie do we loose them when SGW is stopped? And therefore need to re-create users each time SGW is started?

Many thanks


#2

Sync Gateway stores users persistently in the underlying Couchbase Server bucket in documents prefixed with: _sync:user:


#3

@bbrks Thank you for the explanation.

I wasn’t aware that SGW needed CB Server to work.


#4

Couchbase Server provides the persistent storage for Sync Gateway.

You can run Sync Gateway with a volatile in-memory database if you leave out “server” from the SG config, but this is only intended for development and prototyping purposes. You can see when the in-memory database is used from the logs by looking for “walrus”:

2019-01-31T17:23:54.374Z [INF] Opening db /db as bucket "db", pool "default", server <walrus:>
2019-01-31T17:23:54.374Z [INF] Opening Walrus database db on <walrus:>

#5

Ahh, I see, very helpful.

Thanks for your time