You are viewing the documentation for a prerelease version.

Inter-Sync Gateway Replication Configuration

    +

    Using Sync Gateway’s Admin REST API to configure and manage inter-Sync Gateway replications

    Related topics: Overview | Bootstrap | Database | Database Security | Access Control | Import | Inter-Sync Gateway Replication

    Pre-3.0-beta02 Legacy Configuration Equivalents

    This content describes configuration for Sync Gateway 3.0-beta02 and higher — for legacy configuration, see: Legacy Pre-3.0 BETA Configuration

    Introduction

    In 3.0 BETA we use the Admin REST API to provision persistent configuration changes. This content introduces the Add or Update a Replication endpoint for convenience — see Replication for a full description of the endpoints available.

    Add or Update a Replication

    PUT {db}/_config/

    Use the \_replication endpoint to upsert inter Sync Gateway configuration definitions

    Using a PUT request you can update or insert replication details for ad hoc or _persistent replication operations.

    Parameters

    Type Name Description Schema

    Path

    db
    required

    Database name

    string

    Path

    replicationID
    required

    string

    Body

    replication
    optional

    The message body is a JSON document that defines an inter-Sync Gateway replication.

    Responses

    Example

    • Curl

    • HTTP

    curl --location --request PUT 'http://localhost:4985/db1-local/_replication/db1-rep-id1 '\
    --header 'Content-Type: application/json' \
    --data-raw '{
      "direction": "push",
      "purge_on_removal": false,
      "remote": "http://user1:password1@example.com:4984/db1-remote",
      "filter":"sync_gateway/bychannel",
      "query_params": {
        "channels":["channel.user1"]
      },
      "continuous": false
      }'
    PUT /db1-local/_replication/db1-rep-id1 HTTP/1.1
    Host: localhost:4985
    Content-Type: application/json
    Content-Length: 235
    
    {"direction": "push",
      "purge_on_removal":false,
      "remote": "http://user1:password1@example.com:4984/db1-remote",
      "filter":"sync_gateway/bychannel",
      "query_params": {
        "channels":["channel.user1"]
      },
      "continuous": false
    }

    Schema

    This section shows Sync Gateway’s replication configuration settings in schema format for convenience in constructing JSON models for use in the Admin REST API.

    The configuration settings described here are provisioned through the Replication endpoints.