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
Chapters

Couchbase Developer's Guide 2.0

Copyright © 2010-2013 Couchbase, Inc. Contact copyright@couchbase.com.

For documentation license information, see Documentation License. For all license information, see Licenses.

Abstract

This manual provides information on how to build applications using Couchbase Server 2.0. The guide is designed to be used in conjunction with the language-specific guide for your chosen SDK.

External Community Resources. 

Download Couchbase Server 2.0
Couchbase Server 2.0 Manual
Client Libraries
Couchbase Server Forum

Last document update: 23 May 2013 23:19; Document built: 18 Jun 2013 23:05.

Documentation Availability and Formats.  This documentation is available for download: HTML Zip, PDF, EPUB . For other documentation from Couchbase, see Couchbase Documentation Library

Contact: editors@couchbase.com or couchbase.com


Table of Contents

Preface
1. Manual Conventions
2. Contributors
1. Introduction to Couchbase
1.1. Understanding Couchbase Concepts
1.1.1. Couchbase as Document Store
1.1.2. Data Buckets
1.1.3. Keys and Metadata
1.1.4. Couchbase SDKs
1.1.5. Nodes and Clusters
1.1.6. Information about the Cluster
1.2. Comparing Couchbase and Traditional RDMS
1.3. Support for Memcached Protocol
1.4. Server Rebalancing
1.5. Server Failover
1.6. Applications on Couchbase Server
2. Modeling Documents
2.1. Comparing Document-Oriented and Relational Data
2.2. Using JSON Documents
2.3. Schema-less Data Modeling
2.4. Document Design Considerations
2.5. Modeling Documents for Retrieval
2.6. Using Reference Documents for Lookups
2.7. Sample Storage Documents
3. Accessing Data with Couchbase SDKs
3.1. Couchbase SDKs and SQL Commands
3.2. Reading/Writing Data
3.3. About Document Expiration
3.4. About Asynchronous Methods
3.5. Storing Information
3.5.1. Set
3.5.2. Add
3.6. Retrieving Information
3.6.1. Get
3.6.2. Retrieving Multiple Keys
3.6.3. Get and Touch
3.7. Retrieving Items with CAS Values
3.8. Locking Items
3.9. Updating Information
3.9.1. Touch
3.9.2. Replace
3.9.3. Check and Set (CAS)
3.9.4. Appending and Pre-pending
3.9.5. Incrementing and Decrementing
3.10. Deleting Information
3.11. Permanently Destroying Data
3.12. Monitoring Data (Using Observe)
3.13. Why Observe Items?
3.14. Observing Documents
4. Finding Data with Views
4.1. Understanding Views
4.2. Filtering and Extracting Data
4.3. Building an Index
4.4. Providing Efficient Lookups
4.5. Ordering Results
4.6. Handling Result Sets
4.7. Using Built-In Reduces
4.8. Using Compound Keys and Group-By Functions
4.9. Using Views from an Application
4.10. Creating Custom Reduces
4.11. Understanding Custom Reduces and Re-reduce
4.12. Error Handling for Views
5. Creating Your First Application
5.1. Setting Up the Development Environment
5.2. Connecting to Couchbase Server
5.2.1. Create Your First Bucket
5.2.2. Connecting with Couchbase SDKs
5.2.3. Authenticating a Client
5.3. Performing Connect, Set and Get
5.4. Performing a First Query
5.5. Performing Basic Telnet Operations
6. Storing Data
6.1. About Keys, Values and Meta-data
6.1.1. Specifying Keys
6.1.2. Specifying Values
6.1.3. More on Metadata
6.1.4. Understanding Document Expirations
6.2. Writing JSON Documents to Couchbase
6.3. About Data Buckets
6.4. About Sharding Data
6.5. Creating and Managing Buckets
6.6. Partitioning Data with Buckets
7. Advanced Topics in Development
7.1. Performing a Bulk Set
7.2. Handling Temporary Out of Memory Errors
7.3. Synchronous and Asynchronous Transactions
7.4. Providing Transactional Logic
7.4.1. Using a 'Lease-Out' Pattern
7.4.2. Performing Two-Phase Commits
7.4.3. Getting and Locking
7.5. Improving Application Performance
7.5.1. Performing Cluster Sizing
7.5.2. Improving Document Access
7.5.3. Using the Fastest Methods
7.5.4. Optimizing Client Instances
7.5.5. Maintaining Persistent Connections
7.6. Thread-Safety for Couchbase SDKs
7.7. Handling Common Errors
7.7.1. Client-Side Timeouts
7.8. Troubleshooting
7.8.1. Configuring Logs
7.8.2. Backups and Restores
7.8.3. Handling Failover
8. Developing a Client Library
8.1. Providing SASL Authentication
8.1.1. List Mechanisms
8.1.2. Making an Authentication Request
8.2. Getting Cluster Topology
8.2.1. Parsing the JSON
8.2.2. Handling vBucketMap Information
8.2.3. Encoding the vBucketId
8.2.4. Handling Rebalances in Your Client Library
8.2.5. Fast Forward Map
8.2.6. Redundancy & Availability
8.3. Providing Observe Functions
8.4. Couchbase Protocol Extensions
A. Licenses
A.1. Documentation License
A.2. Couchbase, Inc. Community Edition License Agreement
A.3. Couchbase, Inc. Enterprise License Agreement: Free Edition

List of Figures

1.1. Couchbase SDK to Server Communications
2.1. Conventional RDMS Table and Document-based Information
2.2. Data Normalization in Traditional RDBMS
2.3. Data Modeling with Documents
2.4. Reference All Craters from Asteroid
2.5. Reference Asteroid from all Craters
2.6. Tracking User Count
2.7. Adding New User Document
2.8. Adding Supporting Documents for Lookups
2.9. User Lookup by Email
3.1. Creating Items with Set
3.2. Using Add for Unique Items
3.3. Using Get for Properties
3.4. Using Multiple-Retrieve for Planet Properties
3.5. Using Get-and-Touch to Retrieve Mode
3.6. Using Get-with-Cas to Determine Next Actions
3.7. Using Get-and-Lock to Reserve Inventory
3.8. Using Touch to See if Key Exists
3.9. Create Key after Touch
3.10. Using Replace to Determine Offer Status
3.11. Make Offer After Replace
3.12. Getting Current CAS Value
3.13. Updating with Correct CAS Value
3.14. Using Append and Prepend for Binary Values
3.15. Append and Prepend Updates to Documents
3.16. Using Incr for Unique User Ids
3.17. Node Failure and No Backups
3.18. Node Failure and Backups Observed
4.1. Views, and View Elements
4.2. Results from a Map Function
4.3. Graphing Reddit Posts
4.4. Full Frequency Graph of Reddit Posts
4.5. Storing Pre-Calculations
4.6. Custom Reduces and the Re-Reduce
4.7. Custom Reduces and the Re-Reduce
7.1. Ticketing System
7.2. Ticket Document Updates
7.3. Couchbase SDK Two-Phase Commit
7.4. Couchbase SDK Rollback for Transactions

List of Tables

3.1. SQL Commands/Couchbase Commands
7.1. Available Timeouts for Java Connections
7.2. Available Timeouts for .Net Connections
7.3. Available Timeouts for Ruby Connections
7.4. Available Timeouts for C and PHP SDK