Edit on GitHub

In this lesson you'll learn how to scale Sync Gateway and Couchbase Server in real-time with zero downtime.


Three instances with the following:

  • Centos 7
  • RAM >= 2GB

Getting Started

This lesson contains some scripts to automatically deploy and configure Sync Gateway with Couchbase Server. Download those scripts on each VM using wget.

ssh vagrant@
sudo yum install -y unzip

Throughout this lesson, you will use different scripts located in the deploy folder.


In this lesson you will deploy a 3rd Sync Gateway node behind the reverse proxy.

Scaling Sync Gateway

Similarly to previous lessons you will first deploy Sync Gateway with the configuration file passing the IP of the VM running Couchbase Server.

There will be 3 Sync Gateway nodes but the reverse proxy is forwarding the load to only 2 of them. To balance the traffic across all 3 you must update the NGINX config file with the IP of VM5.

Try it out

  1. Log on VM5 (sync-gateway).
  2. cd deploy
  3. Run the Sync Gateway install latest script passing the IP of VM1 where Couchbase Server is running.

    sudo ./ VM1
  4. Log on VM4 (nginx).

  5. Run the NGINX install script passing the IP of VM2, VM3 and VM4 where the Sync Gateway instances are running.

    sudo ./ VM2 VM3 VM5
  6. Send a curl request to http://localhost:8000. This will return information about the running sync_gateway behind the reverse proxy.

    curl localhost:8000


Well done! You've completed this lesson on scaling. Feel free to share your feedback, findings or ask any questions on the forums.