You are previewing Pro Couchbase Server.
O'Reilly logo
Pro Couchbase Server

Book Description

Pro Couchbase Server is a hands-on guide for developers and administrators who want to take advantage of the power and scalability of Couchbase Server in their applications. This book takes you from the basics of NoSQL database design, through application development, to Couchbase Server administration. Never have document databases been so powerful and performant.

The NoSQL movement has fundamentally changed the database world in recent years. Influenced by the growing needs of web-scale applications, NoSQL databases such as Couchbase Server provide new approaches to scalability, reliability, and performance. With the power and flexibility of Couchbase Server, you can model your data however you want, and easily change the data model any time you want. Pro Couchbase Server shows what is possible and helps you take full advantage of Couchbase Server and all the performance and scalability that it offers.
  • Helps you design and develop a document database using Couchbase Server.
  • Takes you through deploying and maintaining Couchbase Server.
  • Gives you the tools to scale out your application as needed.
  • Table of Contents

    1. Cover
    2. Title
    3. Copyright
    4. Dedication
    5. Contents at a Glance
    6. Contents
    7. About the Authors
    8. About the Technical Reviewers
    9. Acknowledgments
    10. Introduction
    11. Part I: Getting Started
      1. Chapter 1: Getting Started with Couchbase Server
        1. From SQL to NoSQL
          1. The CAP Theorem
          2. NoSQL and Couchbase Server
        2. Couchbase as Key-Value Store vs. Document Database
        3. Couchbase Server Architecture
        4. Data Storage
        5. Installing Couchbase Server
          1. Selecting a Couchbase Server Edition
          2. Installing Couchbase on Different Operating Systems
        6. Configuring Couchbase Server
          1. Creating a Bucket
        7. Summary
      2. Chapter 2: Designing Document-Oriented Databases with Couchbase
        1. RanteR: The Anti-Social Network
        2. Mapping Application Entities
          1. Using a Relational Database
          2. Using a Document-Oriented Approach with Couchbase
        3. Designing Keys
          1. Natural Keys
          2. Creating Your First Document
          3. Counters
          4. Universally Unique Identifiers (UUID)
        4. Metadata
        5. Document Versioning
          1. Versioning Considerations when Using the Couchbase SDKs
          2. Versioning Considerations in Couchbase Views
        6. Summary
    12. Part II: Development
      1. Chapter 3: The Couchbase Client Libraries
        1. The Java SDK
          1. Adding the Java SDK Manually
          2. Using Maven
          3. Using the CouchbaseClient Class
        2. The .NET SDK
          1. Manually Referencing the Assemblies
          2. Using NuGet Package Manager
          3. Using the CouchbaseClient Class
        3. The C SDK
          1. Linux
          2. Windows
          3. Mac OS X
          4. Using libcouchbase
        4. The Node.js SDK
        5. The PHP SDK
          1. Linux
          2. Windows
          3. Mac OS X
          4. Using the PHP SDK
        6. The Python SDK
          1. Linux
          2. Windows
          3. Using the Python SDK
        7. The Ruby SDK
          1. A Simple Ruby Script
          2. Building a Rails Application
        8. Inside the Couchbase Client Libraries
          1. Thread Safety
          2. Couchbase Client Initialization
          3. Performing Operations Using the Couchbase Client
          4. Reconfiguration
        9. Summary
      2. Chapter 4: CRUD and Key-Based Operations
        1. Persistence and Replication
        2. Concurrency
        3. Document Expiration
        4. Database Operations
          1. Storing Data
          2. Retrieving Data
          3. Retrieving and Updating Data Concurrently
          4. Pessimistic Concurrency through Locking
          5. Appending and Prepending Binary Data
          6. Numeric Data
          7. Deleting Data
          8. Observing Data
          9. General SDK-Related Notes
        5. Summary
      3. Chapter 5: Working with Views
        1. MapReduce 101
        2. Creating a View in Couchbase
          1. The Map Function
          2. Creating Views from Code
          3. Querying Views
          4. The Reduce Function
        3. Views and Persistence
          1. Updating Indexes
          2. Views and Expiration
        4. Geospatial Views
          1. Creating Geospatial Views
        5. Summary
      4. Chapter 6: The N1QL Query Language
        1. Executing N1QL Queries
        2. The N1QL Language
          1. The FROM Clause
          2. Query Conditions and Expressions
          3. Sorting and Grouping
          4. Indexing Properties
          5. Exploring the Query Execution Details
        3. Summary
      5. Chapter 7: Advanced Couchbase Techniques
        1. Software Error Handling
        2. Reading Replica Documents
        3. Handling Temporary Out-of-Memory Errors
        4. Implementing Transactions with Two-Phase Commit
        5. Maintaining Sets of Items
        6. Using CAS as an ETag
        7. Using Couchbase as an Out-of-Process Session Store
        8. Summary
      6. Chapter 8: ElasticSearch Integration
        1. Setting Up ElasticSearch Clusters
          1. Forming a Cluster
          2. Setting Up Replication between Couchbase and ElasticSearch
        2. Querying with ElasticSearch
          1. The ElasticSearch Query DSL
        3. Summary
    13. Part III: Couchbase at Scale
      1. Chapter 9: Sizing and Deployment Considerations
        1. Planning the Couchbase Cluster
          1. RAM
          2. Storage
          3. Storage Performance
          4. CPU
          5. Nodes
          6. Network Topology
          7. Replication
          8. Swap Space
        2. Summary
      2. Chapter 10: Basic Administration
        1. Building the Cluster
          1. Adding a Node to the Couchbase Cluster
          2. Removing a Node from the Cluster
          3. Rebalancing
          4. Swap Rebalancing
          5. Changing the Data and Index Path
        2. Backing Up and Restoring
          1. Using cbbackup to Back Up Data
          2. Using cbrestore to Restore Backed-Up Data
          3. Using cbtransfer to Transfer Data
          4. Backing Up and Restoring Using Data Files
        3. Database and View Compaction
          1. Dealing with Compaction
          2. Auto-Compaction
          3. Triggering Compaction Externally
          4. Compaction in Action
        4. Failover
          1. Automatic Failover
          2. Manual or Monitored Failover
          3. Dealing with Failed Nodes
        5. Summary
      3. Chapter 11: Monitoring and Best Practices
        1. Less Obvious Couchbase Mechanisms
          1. Replication and Queues
          2. Working-Set Management and Ejection
        2. Controlling the Purge Interval
        3. Monitoring
          1. Monitoring Couchbase at the System Level
          2. Detailed Per-Bucket Monitoring
          3. Server Resources
          4. Summary (the Category)
          5. vBucket Resources
          6. Disk Queues
          7. TAP Queues
        4. Views
          1. XDCR
          2. Memcached Buckets
        5. Statistics and Cluster Health
          1. Using cbstats
          2. Retrieving Statistics from the HTTP API
          3. Generating a Cluster Health Report with cbhealthchecker
        6. Server Warmup
        7. Logs
        8. Alerts
        9. Optimizing Disk Throughput
        10. Summary
      4. Chapter 12: Couchbase Server in the Cloud
        1. Couchbase Server on Amazon Web Services
          1. Considerations for Deploying Couchbase Server on AWS
          2. Setting up Couchbase Server on AWS
        2. Couchbase Server on Microsoft Azure
          1. Considerations for Deploying Couchbase on Microsoft Azure
          2. Setting Up Couchbase Server on Microsoft Azure
          3. Best Practices for Running Couchbase in Microsoft Azure
        3. Summary
      5. Chapter 13: Cross-Datacenter Replication (XDCR)
        1. Prerequisites
        2. Setting Up Unidirectional XDCR
        3. Advanced XDCR Settings
        4. Conflict Resolution
        5. Bi-Directional Replication and Advanced Topologies
        6. Monitoring XDCR
          1. Outbound XDCR Operations
          2. Incoming XDCR Operations
        7. Recovering Data from a Remote Cluster
        8. Summary
    14. Part IV: Mobile Development with Couchbase
      1. Chapter 14: Couchbase Lite on Android
        1. Getting Started with Couchbase Lite
          1. Adding Couchbase Lite to an Android Project
          2. Creating a Couchbase Lite Manager
          3. Creating a Couchbase Lite Database
        2. Using Couchbase Lite
          1. CRUD Operations
          2. Attachments
        3. Views
          1. Defining Views
          2. Querying Views
        4. Summary
      2. Chapter 15: Couchbase Lite on iOS
        1. Getting Started with Couchbase Lite on iOS
          1. Adding Couchbase Lite to an iOS Project
          2. Creating a Couchbase Lite Manager
          3. Creating a Couchbase Lite Database
        2. Using Couchbase Lite
          1. CRUD Operations
          2. Attachments
        3. Views
          1. Defining Views
          2. Querying Views
        4. Summary
      3. Chapter 16: Synchronizing Data with the Couchbase Sync Gateway
        1. Couchbase Sync Gateway
          1. Installing the Sync Gateway
          2. Running the Sync Gateway
          3. Working with the Sync Gateway
          4. Channels
          5. The Sync Function
        2. Sync Gateway Administration
          1. Authenticating Users
          2. Access Control
          3. Shadowing Couchbase Server Buckets
          4. Deploying the Sync Gateway
        3. Summary
    15. Index