Skip to end of metadata
Go to start of metadata

Migrating your Data

Before you can begin migration, you need to create a target bucket in Couchbase Server. [Link to instructions]

A subtle difference between Couchbase Single and Couchbase Server, that won't effect most people, but is worth noting: Couchbase Server is optimized for a handful of very large databases ("buckets" in Couchbase server terminology), rather than many smaller databases. If you are using many databases, you may want to consider migrating them into one bucket in Couchbase Server, as having large numbers of buckets can cause unnecessary resource utilization by Couchbase Server.

The first step to migrating is low-risk and shouldn't take much time. The gist is to load the documents from your Single Server database into Couchbase Server, and then deploy any Map Reduce views you've defined. Couchbase provides helper scripts to do this in a few languages: [Python], [Ruby], [Node.js]

If you prefer to write your own scripts, the basic algorithm is simple enough to describe here. These steps should be followed once per Single Server database:

1. Connect to the `_changes` feed on the source database
2. For each row in the result set, fetch the original document
?? what to do about attachments ??
3. Write the document to the target bucket
4. Record the sequence number (`seq`) of the document after it is written

Sequence numbers in Single Server `_changes` API request are monotonically increasing, so by tracking the last sequence number processed (by writing it to a file or a Couchbase Server document), you will be able to pick up where you left off without any duplicate or missed documents, should the migration process or supporting hardware fail in the middle. By tracking the _changes feed for import, it is even possible to import from a database that is under live load, without missing data. For smaller datasets the chance of an interruption during the import process is small. For larger sets, import could talk days or longer, so it is important to use a migration strategy that can restart in the middle without having to throw away progress.

Once the data has been migrated, you may want to browse it in Couchbase Server. To view your data in the admin console, browse to http://YOURSERVER:8091/ and you will be presented with the admin console you used to create the original bucket. You can browse the documents in your bucket by clicking [X]

This is also a good opportunity to apply your Map Reduce index definitions to Couchbase Server. After importing the raw documents, any design documents in the source database, are now stored in the target bucket. All it takes to begin using them is to browse to the "views" section of the Couchbase Server admin console. A full description of views in Couchbase Server (and especially development and production mode) is beyond the scope of this article. [Link to full documentation of views in admin console]

Migrating your Application

Now that you've had a chance to see your data and queries in Couchbase Server, it's time to update your application code to work with the upgraded database. This will be different for every application, but should involve relatively mechanical changes to your code, as Single Server and Couchbase Server share many of the same data operations. There are patterns used by Single Server developers (usually for performance reasons) which may not be necessary when working with Couchbase Server. See this documentation for a detailed understanding of performance patterns with Couchbase Server.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.