Search:

Search all manuals
Search this manual
Manual
Couchbase Client Library: .NET (C#) 1.2
Community Wiki and Resources
Wiki: .NET Client Library
Download Client Library
.NET Client Library
Couchbase Developer Guide 2.0
Couchbase Server Manual 2.0
SDK Forum
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
Couchbase Client Library: .NET (C#) 1.2
Chapters

Appendix E. Cluster Management with the .NET Client Library

The following sections provide details about using the Couchbase .NET Client to manage buckets and design documents.

Cluster management is performed by using methods of the CouchbaseCluster class, which implements the ICouchbaseCluster interface, both of which are in the Couchbase.Management namespace.

using Couchbase.Management;

The CouchbaseCluster is configured using the same config definitions (code or XML) used to create instances of a CouchbaseClient. When managing the cluster with the .NET client, the cluster username and password must be provided.

<couchbase>
    <servers username="Administrator" password="qwerty" >
      <add uri="http://127.0.0.1:8091/pools"/>
    </servers>
</couchbase>

The default constructor for CouchbaseCluster looks for a section named "couchbase". It is possible to use a named section, as follows:

var config = ConfigurationManager.GetSection("anothersection") as CouchbaseClientSection;
var cluster = new CouchbaseCluster(_config);

To configure CouchbaseCluster in code, pass an instance of an ICouchbaseClientConfiguration to the constructor.

var config = new CouchbaseClientConfiguration();
config.Urls.Add(new Uri("http://localhost:8091/pools/"));
config.Username = "Administrator";
config.Password = "qwerty";

var cluster = new CouchbaseCluster(config);

To get a list of buckets from the server, there are two methods.

To get a single of bucket from the server, there are two methods.

To get the count of items in a bucket, or across buckets use the following methods:

To get the count of items in a bucket, or across buckets use the following methods:

To manage the buckets in a cluster, there are three methods.

To remove the data (but not design documents) from a bucket, use the FlushBucket method.

There are four methods for managing design documents with the CouchbaseCluster.