Remote Sync with App Services / Sync Gateway
Prerequisites
To set up replication, you must first configure Sync Gateway, Couchbase Capella App Services, or another Edge Server installation, to allow Edge Server to connect.
To replicate with a Couchbase Capella database:
-
You must have created an App Service connected to the Couchbase Capella database you want to replicate.
-
You must have created an App Endpoint connected to the App Service, with access to the collections you want to replicate.
-
The App Endpoint must be active.
-
You must have set up a username, password, and authentication providers to enable Edge Server to connect to the App Endpoint.
-
You must have allowed IP access from the address that the Edge Server client uses.
-
You must have copied the public connection URL for the App Endpoint.
For more information about Capella App Services, see cloud:app-services:index.adoc.
To replicate with a remote Sync Gateway:
-
You must have access to a working Couchbase Server deployment configured for Sync Gateway. See Configure Server for Sync Gateway.
-
You must have configured the appropriate RBAC Roles on Sync Gateway.
-
You must have set
database.import_docsanddatabase.enable_shared_bucket_accessto true in the Sync Gateway Database Configuration Schema.
For more information about Couchbase Sync Gateway, see Sync Gateway.
Sync Your Changes
The replicate endpoint enables you to synchronize Couchbase Edge Server with another server.
You can configure Edge Server so that replication starts automatically when Edge Server starts. This is used for continuous replication.
The following example shows a configuration that replicates a local database to a remote {sync-gateway-name} instance continuously, using basic authentication.
{
databases: {
travel-sample: {
path: "/var/lib/edge-server/travel-sample.cblite2",
create: true,
enable_client_sync: "bidirectional"
}
},
interface: "0.0.0.0:59840",
users: "/etc/edge-server/users.json",
replications: [
{
source: "travel-sample",
target: "wss://sync-gateway.example.com/travel-sample",
continuous: true,
auth: {
user: "replicator",
password: "s3cr3t"
}
}
]
}
For more information about continuous replication, see Start Replication Automatically.
You can also start replication using the REST API. You do not need to set up replication in the configuration file to do this. Instead, you pass the replication options in the JSON request body.
For more information, see REST API Replication.
For information about monitoring and pushing changes, see Push Changes.