You are previewing Pro Couchbase Server, Second Edition.
O'Reilly logo
Pro Couchbase Server, Second Edition

Book Description

This new edition is a hands-on guide for developers and administrators who want to use the power and flexibility of Couchbase Server 4.0 in their applications. The second edition extends coverage of N1QL, the SQL-like query language for Couchbase. It also brings coverage of multiple new features, including the new generation of client SDKs, security and LDAP integration, secondary indexes, and multi-dimensional scaling. Pro Couchbase Server covers everything you need to develop Couchbase solutions and deploy them in production.

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. Never have document databases been so powerful and performant. 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.
  • • Covers the latest features such as the N1QL query language.
  • • 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 Reviewer
    9. Acknowledgments
    10. Foreword
    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 Antisocial 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
          3. Versioning Consideration with N1QL Queries
        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 Client
        2. The .NET SDK
          1. Manually Referencing the Assemblies
          2. Using NuGet Package Manager
          3. Using the Client
        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. Mac OS X
          4. Using the Python SDK
          5. Asynchronous Framework Integration
        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
        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
        5. Managing the Cluster
        6. 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. Multidimensional and 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
          6. Index Equivalence
          7. Building Indexes Asynchronously
          8. Data Manipulation with N1QL
        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: Under the Hood
      1. Chapter 9: Sizing and Deployment Considerations
        1. Multidimensional Scaling
        2. Planning the Couchbase Cluster
          1. RAM
          2. Storage
          3. Storage Performance
          4. CPU
          5. Nodes
          6. Network Topology
          7. Replication
          8. Swap Space
        3. 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
    14. Part IV: Couchbase at Scale
      1. 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. DCP Queues
        5. Views
        6. Index
          1. Query
          2. XDCR
          3. Memcached Buckets
        7. Statistics and Cluster Health
          1. Using cbstats
          2. Retrieving Statistics from the HTTP API
        8. Server Warm-up
        9. Logs
        10. Alerts
        11. Optimizing Disk Throughput
        12. Summary
      2. 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
      3. Chapter 13: Cross-Datacenter Replication (XDCR)
        1. Prerequisites
        2. Setting Up Unidirectional XDCR
        3. Advanced XDCR Settings
        4. Conflict Resolution
        5. Bidirectional Replication and Advanced Topologies
        6. Monitoring XDCR
          1. Outbound XDCR Operations
          2. Incoming XDCR Operations
        7. Recovering Data from a Remote Cluster
        8. Summary
      4. 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
      5. 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
    15. Part V: Mobile Development with Couchbase
      1. 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
    16. Index