You are previewing Pro Couchbase Development: A NoSQL Platform for the Enterprise.
O'Reilly logo
Pro Couchbase Development: A NoSQL Platform for the Enterprise

Book Description

Pro Couchbase Development: A NoSQL Platform for the Enterprise discusses programming for Couchbase using Java and scripting languages, querying and searching, handling migration, and integrating Couchbase with Hadoop, HDFS, and JSON. It also discusses migration from other NoSQL databases like MongoDB.

This book is for big data developers who use Couchbase NoSQL database or want to use Couchbase for their web applications as well as for those migrating from other NoSQL databases like MongoDB and Cassandra. For example, a reason to migrate from Cassandra is that it is not based on the JSON document model with support for a flexible schema without having to define columns and supercolumns. The target audience is largely Java developers but the book also supports PHP and Ruby developers who want to learn about Couchbase. The author supplies examples in Java, PHP, Ruby, and JavaScript.

After reading and using this hands-on guide for developing with Couchbase, you'll be able to build complex enterprise, database and cloud applications that leverage this powerful platform.

Table of Contents

  1. Cover
  2. Title
  3. Copyright
  4. Contents at a Glance
  5. Contents
  6. About the Author
  7. About the Technical Reviewer
  8. Chapter 1: Why NoSQL?
    1. What Is JSON?
    2. What Is Wrong with SQL?
    3. Advantages of NoSQL Databases
      1. Scalability
      2. Ultra-High Availability
      3. Commodity Hardware
      4. Flexible Schema or No Schema
      5. Big Data
      6. Object-Oriented Programming
      7. Performance
      8. Failure Handling
      9. Less Administration
      10. Asynchronous Replication with Auto-Failover
      11. Caching for Read and Write Performance
      12. Cloud Enabled
    4. What Has Big Data Got to Do with NoSQL?
    5. NoSQL Is Not without Drawbacks
      1. BASE, Not ACID
      2. Still New to the Field
      3. Vendor Support Is Lacking
    6. Why Couchbase Server?
      1. Flexible Schema JSON Documents
      2. Scalability
      3. Auto-Sharding Cluster Technology
      4. High Performance from High Throughput and Low Latency
      5. Cluster High Availability
      6. Cross Data Center Replication
      7. Data Locality
      8. Rack Awareness
      9. Multiple Readers and Writers
      10. Support for Commonly Used Object-Oriented Languages
      11. Administration and Monitoring GUI
    7. Who Uses Couchbase Server and for What?
    8. Summary
  9. Chapter 2: Using the Java Client
    1. Setting Up the Environment
    2. Creating a Maven Project
    3. Creating a Data Bucket
    4. Connecting to Couchbase Server
    5. Creating a Document
    6. Getting a Document
    7. Updating a Document
    8. Creating a View
    9. Querying a View
    10. Deleting a Document
    11. Summary
  10. Chapter 3: Using Spring Data
    1. Setting Up the Environment
    2. Creating a Maven Project
    3. Installing Spring Data Couchbase
    4. Configuring JavaConfig
    5. Creating a Model
    6. Using Spring Data with Couchbase with Template
    7. Running Couchbase CRUD Operations
      1. Save Ops
      2. Remove Ops
      3. Insert Ops
      4. Exists Method
      5. Find Ops
      6. Query View
      7. Update Ops
      8. Bucket Callback
    8. Using Spring Data Repositories with Couchbase
      1. Creating the all View
      2. Document Count
      3. Finding Entities from the Repository
      4. Finding if an Entity Exists
      5. Saving Entities
      6. Deleting Entities
    9. Summary
  11. Chapter 4: Accessing Couchbase with PHP
    1. Setting the Environment
    2. Installing PHP
    3. Installing Couchbase PHP SDK
    4. Connecting with Couchbase Server
    5. Creating a Document
    6. Upserting a Document
    7. Getting a Document
    8. Replacing a Document
      1. Incrementing and Decrementing a Document
    9. Deleting a Document
    10. Summary
  12. Chapter 5: Accessing with Ruby
    1. Setting the Environment
    2. Installing Ruby
    3. Installing DevKit
    4. Installing Ruby Client Library
    5. Connecting with Couchbase Server
    6. Creating a Document in Couchbase Server
      1. Setting a Document
      2. Adding a Document
    7. Retrieving a Document
    8. Updating a Document
    9. Deleting a Document
    10. Querying a Document with View
    11. Summary
  13. Chapter 6: Using Node.js
    1. Setting Up the Environment
      1. Installing Node.js
      2. Installing Node.js Client Library
    2. Connecting with Couchbase Server
    3. Creating a Document in Couchbase Server
      1. Upserting a Document
      2. Inserting a Document
    4. Getting a Document
    5. Updating a Document
    6. Deleting a Document
    7. Summary
  14. Chapter 7: Using Elasticsearch
    1. Setting the Environment
    2. Installing the Couchbase Plugin for Elasticsearch
      1. Configuring Elasticsearch
      2. Installing the Elasticsearch Head Third-Party Plugin
    3. Starting Elasticsearch
    4. Providing an Index Template in Elasticsearch
    5. Creating an Empty Index in Elasticsearch
    6. Setting the Limit on Concurrent Requests in Elasticsearch
    7. Setting the Limit on Concurrent Replications in Couchbase Server
    8. Creating an Elasticsearch Cluster Reference in Couchbase
    9. Creating a Replication and Starting Data Transfer
    10. Querying Elasticsearch
    11. Adding Documents to Couchbase Server while Replicating
    12. The Document Count in Elasticsearch
    13. Summary
  15. Chapter 8: Querying with N1QL
    1. Setting Up the Environment
    2. Running a SELECT Query
    3. Filtering with WHERE Clause
    4. JSON with Nested Objects
    5. JSON with Nested arrays
    6. JSON with Nested Objects and Arrays
    7. Applying Arithmetic & Comparison Operators
    8. Applying ROUND( ) and TRUNC( ) Functions
    9. Concatenating Strings
    10. Matching Patterns with LIKE & NOT LIKE
    11. Including and Excluding Null and Missing Fields
    12. Using Multiple Conditions with AND
    13. Making Multiple Selections with the OR Clause
    14. Ordering Result Set
    15. Using LIMIT and OFFSET to Select a Subset
    16. Grouping with GROUP BY
    17. Filtering with HAVING
    18. Selecting Distinct Values
    19. Summary
  16. Chapter 9: Migrating MongoDB
    1. Setting Up the Environment
    2. Creating a Maven Project
    3. Creating Java Classes
    4. Configuring the Maven Project
    5. Creating a BSON Document in MongoDB
    6. Migrating the MongoDB Document to Couchbase
    7. Summary
  17. Chapter 10: Migrating Apache Cassandra
    1. Setting Up the Environment
    2. Creating a Maven Project in Eclipse
    3. Creating a Database in Cassandra
    4. Migrating the Cassandra Database to Couchbase
    5. Summary
  18. Chapter 11: Migrating Oracle Database
    1. Overview of the cbtransfer Tool
    2. Setting the Environment
    3. Creating an Oracle Database Table
    4. Exporting Oracle Database Table to CSV File
    5. Transferring Data from CSV File to Couchbase
    6. Displaying JSON Data in Couchbase
    7. Summary
  19. Chapter 12: Using the Couchbase Hadoop Connector
    1. Setting Up the Environment
      1. Installing Couchbase Server on Linux
      2. Installing Hadoop and Sqoop
    2. Installing Couchbase Hadoop Connector
    3. Listing Tables in Couchbase Server
    4. Exporting from HDFS to Couchbase
    5. Importing into HDFS from Couchbase
      1. Importing the Key-Value Pairs Previously Exported
      2. Importing the BACKFILL Table
      3. Importing JSON from Couchbase Server into HDFS
    6. Summary
  20. Index