Upgrade
In this lesson you’ll learn how to install upgrades for Sync Gateway with zero downtime.
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@192.168.34.11
wget https://cl.ly/1q300A3v3R1D/deploy.zip
sudo yum install -y unzip
unzip deploy.zip
Throughout this lesson, you will use different scripts located in the deploy folder.
Architecture
To follow this lesson you must first have completed the Install lesson and have 2 Sync Gateway nodes up and running. You have deployed Sync Gateway 1.3 and in this lesson you will deploy Sync Gateway 1.3.1 as a rolling upgrade.
A rolling upgrade means that the nodes are upgraded one at a time. While a node is being upgraded it’s taken offline by rebalancing the traffic to other nodes. The diagram below shows this process.
Upgrading VM2
First you will need to redirect the traffic to only one Sync Gateway node (VM3). Once the traffic is redirected you will upgrade Sync Gateway on VM2.
Try it out
-
Log on VM4 (nginx).
-
cd deploy -
Run the NGINX script passing only the IP of VM3.
sudo ./configure_nginx.sh VM3 -
Log into VM2 (sync-gateway)
-
Run the Sync Gateway upgrade script on VM2.
sudo ./upgrade_sync_gateway.sh -
Change back to VM4
-
Run the NGINX script again this time passing the IP of VM2 and VM3.
sudo ./configure_nginx.sh VM2 VM3 -
Monitor the NGINX operations in real-time.
sudo tail -f /var/log/nginx/access_log -
Change back to VM4.
-
Send a server request to the NGINX port. The response contains the Sync Gateway version. Notice it switches between 1.3.0 and 1.3.1 because only one node was upgraded.
curl 'http://localhost:8000'
Upgrading VM3
In this section you will perform the same sequence of operations to upgrade Sync Gateway on VM3.
Try it out
-
Log on VM4 (nginx).
-
Run the NGINX script passing only the IP of VM2.
sudo ./configure_nginx.sh VM2 -
Log on VM3 (sync-gateway).
-
Run the Sync Gateway upgrade script on VM3.
sudo ./upgrade_sync_gateway.sh -
Log on VM4 (nginx).
-
Run the NGINX script again this time passing the IP of VM2 and VM3.
sudo ./configure_nginx.sh VM2 VM3 -
Verify that the Sync Gateway version is now 1.3.1.
curl VM4:8000 { "couchdb":"Welcome", "vendor":{"name":"Couchbase Sync Gateway","version":1.3}, "version":"Couchbase Sync Gateway/1.3.1(16;f18e833)" }