Configure Server for Sync Gateway

Assuming you have an operational Couchbase Server deployment then:

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 getting-started-bucket for the name and click Add Bucket. You can leave the other options to their defaults.

      cb create bucket popup

STEP 2 — Create RBAC user

In order for Sync Gateway to connect to Couchbase Server, you must create an RBAC user. The RBAC user credentials will be used in a later section to start Sync Gateway.

  1. Open the Security tab and click the Add User button.

    create user
  2. The steps to create the RBAC user differ slightly depending on the version of Couchbase Server that you have installed. We explain the differences below.

    • Couchbase Server 5.5 or above

    • Couchbase Server 5.1

    In the pop-up window, provide a Username (sync_gateway) and Password (password).

    These credentials are used by Sync Gateway to connect to Couchbase Server (see: Configure Sync Gateway).

    You must grant these RBAC roles to the user(as shown on the image below):

    • Application Access

    • Read Only Admin .

      user settings 5 5

    In the pop-up window, provide a Username and Password, those credentials will be used by Sync Gateway to connect later on. Next, you must grant RBAC roles to that user. If you are using Couchbase Server 5.1, you must enable the Bucket Full Access and Read Only Admin roles.

    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:

  • 8091 to 8094 inclusive

  • 11207, 11210 and 11211

  • 18091 to 18093 inclusive.

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 Network Configuration guide to see the full list of available ports and their associated services.

Do more:
  • Import Filters: To use Sync Gateway on clusters with a large amount of data you can configure an import filter (see: Configure import filter).

  • Sync Functions: For finer gained control of document access, you can Configure Sync Function.