Skip to content

Introduction to Sync Gateway

Jens Alfke edited this page Sep 9, 2013 · 6 revisions

Couchbase Sync Gateway

Gluing Couchbase Lite to Couchbase Server

About

This is an adapter that can allow Couchbase Server 2* to act as a replication endpoint for Couchbase Lite and other compatible libraries like PouchDB. It does this by running an HTTP listener process that speaks enough of CouchDB's REST API to serve as a passive endpoint of replication, and using a Couchbase bucket as the persistent storage of all the documents.

It also provides a mechanism called channels that makes it feasible to share a database between a large number of users, with each user given access only to a subset of the database.

* It can actually run without Couchbase Server, using a simple built-in database called Walrus. This is useful for testing or for very lightweight use. More details below.

Limitations

  • Can't currently operate on pre-existing Couchbase buckets with app data in them. (The gateway has its own document schema and needs to create and manage documents itself.) You can migrate existing data by creating a new bucket for the gateway and then using its REST API to PUT your documents into it.
  • Only a subset of the CouchDB REST API is supported: this is intentional. The gateway is not a CouchDB replacement, rather a compatible sync endpoint.
  • Explicit garbage collection is required to free up space, via a REST call to /_compact. This is not yet scheduled automatically, so you'll have to call it yourself.
  • Document IDs longer than about 180 characters will overflow Couchbase's key size limit and cause an HTTP error.

Architecture

The Sync Gateway provides an HTTP front-end for Couchbase Server, that syncs with Couchbase Lite.

Couchbase Mobile Architecture

License

Apache 2 license, like all Couchbase stuff.

NEXT: Installing And Upgrading

Clone this wiki locally