Verify a Sync Gateway Install
Step 1: Create a configuration file
To configure Sync Gateway to connect to a Couchbase Server instance, create a new file called sync-gateway-config.json and add the content shown in Example 1.
//
{
// ... additional configuration data as required ...
"log": ["*"],
"databases": {
"getting-started-db": {
"server": "http://localhost:8091",
"bucket": "getting-started-bucket",
"username": "sync_gateway", (1)
"password": "password", (2)
"enable_shared_bucket_access": true, (3)
"import_docs": true,
"num_index_replicas": 0, (4)
"users": {
"GUEST": { "disabled": false, "admin_channels": ["*"] }
}
}
// ... additional configuration data as required ...
}
}
//
- Configuration Properties
-
1 The user’s username that you created on the Couchbase Server Admin Console. 2 The user’s password that you created on the Couchbase Server Admin Console. 3 The Sync with Couchbase Server feature allows Couchbase Server SDKs to also perform operations on this bucket. 4 num_index_replicas
is the number of index replicas stored in Couchbase Server — see Indexing versus Views.
If you’re running a single Couchbase Server node for development purposes the num_index_replicas must be set to 0 .
|
Step 2: Start Sync Gateway
Start Sync Gateway from the command line — see Using Command Line, or if Sync Gateway is running in a service replace the configuration file and restart the service.
~/Downloads/couchbase-sync-gateway/bin/sync_gateway ~/path/to/sync-gateway-config.json (1)
1 | If you are using a Couchbase Lite application, then run this command where that is installed. |
Step 3: Verify that Document Changes Sync
To verify that documents have been replicated, you can:
-
Monitor the Sync Gateway sequence number returned by the database endpoint (
GET /{tkn-db}/
). The sequence number increments for every change that happens on the Sync Gateway database. -
Query a document by ID on the Sync Gateway REST API (
GET /{tkn-db}/{id}
) — see: REST API Access -
Query a document from the Query Workbench on the Couchbase Server Console.