Remote Sync with App Services / Sync Gateway

    April 6, 2025
    + 12
    remote upstream sync diagram

    Concepts

    When Internet connectivity is available, the Edge Server can synchronize data with a remote App Services using a WebSocket-based replication protocol.

    You can read and write data or listen for data changes from Edge Server over a RESTful interface from any HTTP client. Such as Insomnia or Postman.

    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 will use.

    • You must have copied the public connection URL for the App Endpoint.

    For more information about Capella App Services, see Manage App Services for Mobile and Edge.

    To replicate with a remote Sync Gateway:

    For more information about Couchbase Sync Gateway, see Introduction

    Push Upstream Changes

    You can monitor changes in a keyspace using the keyspaces’s changes feed. The changes feed is based on sequences, which are abstract integer counters applied to documents. The changes feed returns the metadata (and optionally the contents) of documents that have changed since a specified sequence.

    Couchbase Edge Server adopts a push, not poll approach to changes using two methods:

    • Longpoll mode - Waiting until changes are present to report to update.

    • Continuous mode - Each change is reported as a separate JSON object, delimited by a newline (\n). The server sends all current changes, but never ends the response; instead it sends more changes as they occur.

    For more information, see Push Changes.

    Syncing 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 usually used for continuous replication.

    For more information about continuous replication, see Start Replication Automatically.

    You can also start replication using the REST API. You don’t need to set up reduplication 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.