Search:

Search all manuals
Search this manual
Manual
Couchbase Developer's Guide 2.0
Community Wiki and Resources
Download Couchbase Server 2.0
Couchbase Server 2.0 Manual
Client Libraries
Couchbase Server Forum
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
8.2 Getting Cluster Topology
Chapter Sections
Chapters

8.2.2. Handling vBucketMap Information

The vBucketMap value within the returned JSON describes the vBucket organization. For example:

"serverList":["10.1.4.11:11210","10.1.4.12:11210"], "vBucketMap":[[0,1],[1,0],[1,0],[1,0],:,[0,1],[0,1]]

The vBucketMap is zero-based indexed by vBucketId. So, if you have a vBucket whose vBucketId is 4, you'd look up vBucketMap[4]. The entries in the vBucketMap are arrays of integers, where each integer is a zero-based index into the serverList array. The 0th entry in this array describes the primary server for a vBucket. Here's how you read this stuff, based on the above config:

The vBucket with vBucketId of 0 has a configuration of vBucketMap[0], or[0, 1]. So vBucket 0's primary server is at serverList[0], or 10.1.4.11:11210.

While vBucket 0's first replica server is at serverList[1], which is 10.1.4.12:11210.

The vBucket with vBucketId of 1 has a configuration of vBucketMap[1], or[1, 0]. So vBucket 1's primary server is at serverList[1], or 10.1.4.12:11210. And vBucket 1's first replica is at serverList[0], or 10.1.4.11:11210.

This structure and information repeats for every configured vBucket.

If you see a -1 value, it means that there is no server yet at that position. That is, you might see:

"vBucketMap":[[0,-1],[0,-1],[0,-1],[0,-1],:]

Sometimes early before the system has been completely configured, you might see variations of:

"serverList":[], "vBucketMap":[]