Prepare to Install Sync Gateway

      +

      Prerequisites for installing Sync Gateway; to synchronize your data from cloud to edge.
      This is Step 2 in the Start Here! topic group. It introduces the prerequisites for the installation of Sync Gateway

      Related Start Here! topics: Introduction | Install | Verify

      Steps in Getting Started

      Introduction | Prepare | Install | Verify

      What You Need

      Here’s what you need in order to install Sync Gateway:

      Once you have all that covered …​ go Install Sync Gateway.

      Couchbase Server Requirements

      To use Sync Gateway you need an operational Couchbase Server installation. Ensure that you use compatible versions of Couchbase Server and Sync Gateway — see: Compatibility Requirements.

      You can get Couchbase Server from our Downloads page

      You will then need to configure Couchbase Server by adding a Bucket and an RBAC User for Sync Gateway — see: Configure Server for Sync Gateway.

      Users of Couchbase Server 6.0 should ensure they have addressed the known issue (MB-41255) by upgrading to one of the recommended Couchbase Server versions (6.0.5, 6.5.2, or 6.6.1).

      The known issue can cause re-balance failures and/or failed replica writes of deleted or expired documents that use Xattrs.

      This impacts Sync Gateway deployments running with shared bucket access enabled, which use Xattrs for metadata storage.

      Network Port Requirements

      Sync Gateway uses specific ports for communication with the outside world, mostly Couchbase Lite databases replicating to and from Sync Gateway — see Table 1 for details.

      Table 1. Sync Gateway Network Port Requirements
      Port Description

      4984

      Public port. External HTTP port used for replication with Couchbase Lite databases and other applications accessing the REST API on the Internet.

      The Public REST API is used for client replication. The default port for the Public REST API is 4984.

      4985

      Admin port. Internal HTTP port for unrestricted access to the database and to run administrative tasks.

      The Admin REST API is used to administer user accounts and roles. It can also be used to look at the contents of databases in superuser mode. The default port for the Admin REST API is 4985. By default, the Admin REST API is reachable only from localhost for safety reasons.

      4986

      Metrics port. By default 4986 is the internal HTTP port designated for providing access to Sync Gateway’s Metrics REST API. Like the admin port, it is bound to 127.0.0.1 by default.

      The Metrics REST API returns Sync Gateway metrics, in JSON and-or Prometheus-compatible formats, for performance monitoring and-or diagnostic purposes,

      Couchbase Server Host Ports

      For mobile deployment on premise or in the cloud (for example, AWS or Red Hat) open the following ports on the host to enable Couchbase Server to operate correctly:

      • Unencrypted: 8091-8093, 11210

      • Encrypted: 18091-18093, 11207

      Check that any firewall configuration allows communication on the specified ports.

      Compatibility with Couchbase Server

      Users of Couchbase Server 6.0 should ensure they have addressed the known issue (MB-41255) by upgrading to one of the recommended Couchbase Server versions (6.0.5, 6.5.2, or 6.6.1).

      The known issue can cause re-balance failures and/or failed replica writes of deleted or expired documents that use Xattrs.

      This impacts Sync Gateway deployments running with shared bucket access enabled, which use Xattrs for metadata storage.

      Sync Gateway/Couchbase Server

      Compatibility Matrix

      Sync Gateway ↓

      Couchbase Server →

      Version

      Scenario

      5.0 [1]

      5.1 [1]

      5.5-6.0

      6.5-7.0

      7.1

      7.2

      7.6

      1.4 [2]

      feed_type: "DCP"

      yes

      yes

      yes

      yes

      yes

      yes

      yes

      1.5 [3]

      shared_bucket_access: false

      yes

      yes

      yes

      yes

      yes

      yes

      yes

      1.5 [3]

      shared_bucket_access: true

      yes

      yes

      yes

      yes

      yes

      yes

      yes

      2.0

      shared_bucket_access: false

      yes

      yes

      yes

      yes

      yes

      yes

      yes

      2.0

      shared_bucket_access: true

      yes

      yes

      yes

      yes

      yes

      yes

      yes

      2.1

      shared_bucket_access: false
      use_views: true

      yes

      yes

      yes

      yes

      yes

      yes

      yes

      2.1

      shared_bucket_access: true

      yes

      yes

      yes

      yes

      yes

      yes

      yes

      2.1

      use_views: false

      no

      no

      yes

      yes

      yes

      yes

      yes

      2.5-2.8

      shared_bucket_access: false
      use_views: true

      yes

      yes

      yes

      yes

      yes

      yes

      yes

      2.5-2.8

      shared_bucket_access: true

      yes

      yes

      yes

      yes

      yes

      yes

      yes

      2.5-2.8

      use_views: false

      no

      no

      yes

      yes

      yes

      yes

      yes

      3.0.3

      no

      no

      no

      yes

      yes

      yes

      yes

      3.1.0

      no

      no

      no

      yes

      yes

      yes

      yes

      3.1.0

      Using Scopes and Collections

      no

      no

      no

      no

      yes

      yes

      yes

      3.2.0

      no

      no

      no

      no

      yes

      yes

      yes

      3.2.0

      Using Scopes and Collections

      no

      no

      no

      no

      yes

      yes

      yes

      Starting from CBS 7.0, the use_views feature is deprecated.

      • SGW 3.1 will only run with use_views with a default scope/collection configuration

      • You cannot run use_views with a defined scope/collection

      Couchbase Server Bucket Types
      Use only Couchbase bucket types in Couchbase Mobile. We do not support the use of Couchbase Server’s Ephemeral or Memcached bucket types — for more on bucket types see: Couchbase Server bucket types.

      Compatibility with Couchbase Lite

      The table below summarizes the compatible versions of Couchbase Lite with Sync Gateway.

      Table 2. Sync Gateway and Couchbase Lite Compatibility Matrix

      Sync Gateway Versions ↓

      Couchbase Lite →

      1.4 [4]

      2.0

      2.1

      2.5 - 2.8

      3.0.3

      3.1.0

      3.2.0

      1.4 [2] and 1.5 [3]

      yes

      no

      no

      no

      no

      no

      no

      2.0 and 2.1

      yes

      yes

      yes

      yes

      yes

      yes

      yes

      2.5 to 2.8
      with delta sync disabled

      yes

      yes

      yes

      yes

      yes

      yes

      yes

      2.5 to 2.8
      with delta sync enabled

      no

      no

      no

      yes

      yes

      yes

      yes

      3.0.3

      no

      yes

      yes

      yes

      yes

      yes

      yes

      3.1.0

      no

      yes

      yes

      yes

      yes

      yes

      yes

      3.2.0

      no

      yes

      yes

      yes

      yes

      yes

      yes

      Supported Operating Systems

      Table 3. Supported Operating Systems for Development, Testing, and Production
      Operating System Supported Versions

      Red Hat Enterprise Linux (RHEL)

      9.x

      8.x — Deprecated at 3.2.0

      Alma Linux

      9.x

      Rocky Linux

      9.x

      Ubuntu

      24.04 LTS ARM, 24.04 LTS x86

      22.04 LTS ARM, 22.04 LTS x86

      20.04 LTS ARM, 20.04 LTS x86

      Debian

      12.x

      11.x

      10.x — Deprecated at 3.2.0

      Windows Server

      2022

      2019 — Deprecated at 3.2.0

      Table 4. Supported Operating Systems for Development and Testing Only
      Operating System Supported Versions

      macOS

      14

      13

      12 — Deprecated at 3.2.0

      Windows Desktop

      11

      10

      Apple M1 ARM64

      macOS 14

      macOS 13

      macOS 12 — Deprecated at 3.2.0

      Table 5. Supported Cloud Environments for Development, Testing, and Production
      Platform Operating System Supported Versions

      AWS

      Amazon Linux 2023 (ARM, x86), Amazon Linux 2 (ARM, x86)

      LTS

      Azure

      Ubuntu

      24.04 LTS (ARM, x86), 22.04 LTS (ARM, x86), 20.04 LTS (ARM, x86)

      Google Cloud

      Ubuntu

      24.04 LTS (ARM, x86) 22.04 LTS (ARM, x86), 20.04 LTS (ARM, x86)

      OpenShift (RedHat Portal)

      RHEL

      9

      RHEL

      8 — Deprecated at 3.2.0

      Ubuntu

      24.04 LTS, 22.04 LTS, 20.04 LTS

      Cluster Configuration for Sync Gateway

      We will create a new cluster on a fresh Couchbase Server installation.

      1. Access the Admin Console at http://localhost:8091

        couchbase new installation
      2. Click Setup New Cluster

      3. Fill in the details for the new cluster on the New Cluster screen:

        new cluster details
      4. Then press Next: Accept Terms

      5. On the Terms and Conditions screen, accept the terms and conditions, then click on Configure Disk, Memory, Services to configure the cluster.

        configure cluster for sync gateway
      6. Ensure that you have selected Data, Query, and Index before clicking on Save & Finish

      Configure Server for Sync Gateway

      Step 1 — Create a Bucket

      We will use this bucket to test the deployment of Sync Gateway, later in the Getting Started section.

      1. Login to Couchbase Server’s Admin Console

        1. Go to http://localhost:8091

        2. Enter your administrator credentials.

      2. Within the Admin Console’s toolbar,

        1. Select the Buckets tab

        2. Add Bucket to continue

          cb create bucket
        3. In the pop-up window, enter get-started-bucket for the name and click Add Bucket. You can leave the other options to their defaults.

          Couchbase Server Bucket Types
          Use only Couchbase bucket types in Couchbase Mobile. We do not support the use of Couchbase Server’s Ephemeral or Memcached bucket types — for more on bucket types see: Couchbase Server bucket types.
        cb create bucket popup

      Step 2 — Create RBAC User

      You will need to create at least one RBAC user in Couchbase Server as sync gateway requires RBAC user credentials to authenticate and authorize access not only to Couchbase Server buckets, but also to its Admin and Metrics API. If you plan to use these API then you are advised to create at least one user for each of:

      • Couchbase Server Access
        Add an RBAC user that Sync Gateway uses to authenticate and authorize access to Couchbase Server. Use the sync_gateway role.

      • Admin API
        Add an RBAC user that administrators can use to authenticate and authorize access to the sync gateway Admin REST API Use the Full Admin role.

      • Metrics API
        Add an RBAC user that devops can use to authenticate and authorize access to the sync gateway Metrics REST API Use the Read-Only Admin or Application Access roles.

      Enterprise edition users can exert a finer-grained control using additional roles appropriate to the functionality required for the specific user.

      For more on creating Couchbase Server users see: Server — Manage Users and Roles.

      How-to
      1. Within Couchbase Server’s Dashboard, Open the Security tab and click the Add User button.

        create user
      2. Create the RBAC user with appropriate access roles, this will differ for each of the user types.

        The steps for this are shown in Example 1. Note that they differ, depending on your Couchbase Server version.

        Example 1. Select RBAC roles
        • Couchbase Server 6.6+ (Enterprise)

        • Couchbase Server 5.5 - 7.x

        • Couchbase Server 5.1

        This content relates only to ENTERPRISE EDITION
        1. In the pop-up window, provide

          • A Username (sync_gateway)

          • A Password (password).

        2. Assign the Sync Gateway role to the user

          user settings 6 6
          Users are encouraged to move away from using the Application Access and Read-Only Admin roles for this purpose.
        1. In the pop-up window, provide:

          • A Username (sync_gateway)

          • A Password (password).

        2. Assign these RBAC roles to the user(as shown on the image below):

          • Application Access

          • Read Only Admin

            user settings 5 5
        1. In the pop-up window, provide:

          • A Username (sync_gateway)

          • A Password* (password).

        2. Assign these RBAC roles to the user:

          • Bucket Full Access

          • Read Only Admin

        user settings

      Step 3 — Set-up Network Access

      When installing Couchbase Server on the cloud, ensure that network permissions (or firewall settings) allow incoming connections to Couchbase Server ports.

      For mobile deployment on premise or in the cloud (for example, AWS or Red Hat) open the following ports on the host to enable Couchbase Server to operate correctly:

      • Unencrypted: 8091-8093, 11210

      • Encrypted: 18091-18093, 11207

      Check that any firewall configuration allows communication on the specified ports.

      If this is not done, the Couchbase Server node can experience difficulty joining a cluster.

      You can refer to the Couchbase Server Ports guide to see the full list of available ports and their associated services.



      1. The 3.0 is compatible with these versions but its use is not recommended
      2. This Sync Gateway version is End of Support
      3. This Sync Gateway version is End of Life
      4. This Couchbase Lite version is End of Support