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
5.2 Connecting to Couchbase Server
Chapter Sections
Chapters

5.2.1. Create Your First Bucket

The first thing you will want to do after you set up Couchbase Server and you want to explore the SDKs is to create a data bucket. You can do so with the Couchbase Admin Console, or you can use the REST API. For your first application in this chapter, we will show the REST API approach, which you may be less familiar with after your initial server install. For more information about creating named buckets via the Couchbase Admin Console, see Couchbase Server Manual 2.0, Creating and Editing Data Buckets

You create either a Couchbase or memcached bucket using the REST API. When you make a request, you provide a REST request using a REST client or a UNIX utility such as curl.

  1. Make a new bucket request to the REST endpoint for buckets and provide the new bucket settings as request parameters:

    shell> curl -u Administrator:password \
    					-d name=newBucket -d ramQuotaMB=100 -d authType=none \
    					-d replicaNumber=1 -d proxyPort=11215 http://localhost:8091/pools/default/buckets

    To create a bucket we first provide our credentials for the bucket. These are the same credentials we established when we first installed Couchbase Server. For the sake of convenience, we create a single Couchbase bucket named newBucket with a RAM quota of 100MB. We require no authentication for the bucket and set the proxy port for the bucket to 11215.

    Couchbase Server sends back this HTTP response:

    202
  2. You can check your new bucket exists and is running by making a request REST request to the new bucket:

    curl http://localhost:8091/pools/default/buckets/newBucket

    Couchbase Server will respond with a JSON document containing information on the new bucket:

    {"name":"newcachebucket","bucketType":"couchbase",
    
    ....
    
    "bucketCapabilities":["touch","couchapi"]}

    For this request we go to the same REST URI used when we created the bucket, plus we add the endpoint information for the new bucket, /newBucket. For this type of request we do not need to provide any credentials. The response document contains other REST requests you can make for the bucket as well as bucket settings/properties.

After you create your first data bucket, you can begin interacting with that bucket using a Couchbase SDK. To learn more about the Couchbase REST API, particularly for administrative functions, see Couchbase Server Manual, REST API for Administration