Monthly Archives: October 2015

Couchbase Cluster using Docker Compose

Couchbase 4.0 provides lots of features that allows you to develop with agility and operate at any scale. Some of the features that allow you to operate at any scale are:

  • Elastic Scalability
  • Consistent High Performance
  • Always-On Availability
  • Multi-Data Center Deployment
  • Simple and Powerful Administration
  • Enterprise-grade Security

Learn more about these enterprise features at couchbase.com/operate-at-any-scale.

A complete overview is available in Couchbase Server 4.0 datasheet.

This blog will explain how you can easily setup a 3-node Couchbase Cluster using Docker Compose.

Docker Couchbase Cluster

The source code and latest instructions are available at github.com/arun-gupta/docker-images/tree/master/couchbase-cluster.

Create Couchbase Nodes

Couchbase cluster can be easily created using the following Docker Compose file:

This file has service definition for three Couchbase nodes. Admin ports are exposed for only one node as other nodes will talk to each other use Docker-internally assigned IP addresses.

  1. Create three directories ~couchbase/node1, ~couchbase/node2, ~couchbase/node3 – one for each node.
  2. Start three Couchbase nodes as using the docker-compose.yml shown earlier:
    This command is given on a Docker Machine.
  3. Check status of the nodes:
    Docker Compose can also show the status:
  4. Check logs of the nodes:

Configure Couchbase Cluster

Lets configure these nodes to be part of a cluster now.

  1. Find IP address of the Docker Machine:
  2. Access Couchbase Admin Console at http://<DOCKER_MACHINE_IP:8091. This is http://192.168.99.104:8091 in our case. It will show the output as:

    Docker Couchbase Cluster Setup

    Click on “Setup”.

  3. Each container is given an internal IP address by Docker, and each of these IPs is visible to all other containers running on the same host. We need to use these internal IP address when adding a new node to the cluster.Find IP address of the first container:

    Use this IP address to change the Hostname field:

    Docker Couchbase Cluster Node 1

  4. Click on “Next”. Adjust the RAM if necessary. Read more about Couchbase Cluster Settings.
  5. Pick a sample bucket that you’d like to get installed, and click on Next.
  6. Change Per Node RAM Quota from 400 to 100. This is required as we’ll add other nodes later.Docker Couchbase Cluster Per Node RAM Quota
  7. Click on Next, accept T&C, and click on Next.
  8. Enter a password that you can remember as we’ll need this later to add more nodes.

Default view of the cluster looks like as shown:

Docker Couchbase Cluster Default View

Add More Couchbase Nodes

Now, lets add the other two nodes that were created earlier by Docker Compose.

  1. Click on “Server Nodes” to see the default view as:

    Docker Couchbase Cluster Server Nodes Default View

  2. Find IP address of one of the remaining nodes:

  3. Click on “Add Server”, specify the IP address:

    Docker Couchbase Cluster Add Server Node1
    and click on “Add Server”.

  4. Repeat the previous two steps with the server name couchbasecluster_couchbase2_1.

Couchbase Cluster Rebalance

A cluster needs to be rebalanced to ensured that the data is well distributed amongst the newly added or removed nodes. Read more about Couchbase Cluster Rebalance.

Clicking on “Pending Rebalance” tab shows the nodes that have been added to the cluster but are not rebalanced yet:

Docker Couchbase Cluster Pending Rebalance

Click on “Rebalance” and this will automatically rebalance the cluster:

Docker Couchbase Cluster Rebalanced

You just deployed a Couchbase cluster using Docker Compose, enjoy!

Some more references:

  • Couchbase 4 Administration Guide
  • Couchbase 4 Server Architecture
  • Couchbase 4 Cluster Setup

Why Couchbase over MongoDB? #SayNoToMongoDB

MongoDB is one of the most popular NoSQL databases. Its easy to start, has good documentation, works well with a few nodes. But it starts to fall apart as the number of users increase or more nodes are added.

Do you keep struggling with MongoDB? Thought about Couchbase over MongoDB? But don’t know where to start.

Couchbase Logo MongoDB Logo

Why are companies switching from MongoDB to Couchbase?

  1. MongoDB is hard to scale from a single replica set to a fully sharded environment
  2. MongoDB’s performance rapidly degrades with increasing users
  3. MongoDB is significantly susceptible to data loss under failure
  4. MongoDB requires a third-party cache to help it perform
  5. When deployed in multiple geographies, MongoDB can’t perform all writes locally
  6. MongoDB lacks a mobile solution
  7. MongoDB is time-consuming to manage and maintain

Read how Couchbase avoids all of these problems in Struggling With MongoDB.

Couchbase vs MongoDB Architectural Differences and Their Impact whitepaper provide more details.

Talk to a Couchbase Solutions Engineer and learn if/how  Couchbase can yield better results for your non-performing MongoDB.

Some more useful references:

  • NoSQL Evaluation Guide
  • Getting Started with Couchbase
  • FREE Online Training for NoSQL and Couchbase
  • Couchbase Developer Portal

Viber replaced MongoDB with 50% fewer Couchbase servers. AT&T, Comcast, eBay, GE, LinkedIn, Marriott, PayPal, Tesco, Verizon, VISA, Wells Fargo and many other customers are using Couchbase.

You can too! Why wait?

#MakeTheSwitch and #SayNoToMongoDB!

Couchbase at JavaOne 2015

JavaOne Logo

JavaOne 2015 is just a couple of weeks away. Why you should attend?

  • 450+ sessions over a wide variety of topics around Java
  • 5 days of geekgasm with toys, technology, and discussions
  • Best of the best developers gather here
  • Special 20th edition of the event is going to be cherished for ever
  • Venue is the most lovely city in the world – San Francisco!

Couchbase, one of the leading open-source, NoSQL, document datastore company is going to be there with a few talks. Here is where you’ll find us:

Saturday, Oct 24

JavaOne4Kids Day – Arun Gupta (@arungupta)
5pm – 8pm: Chinascaria (invite only)
7pm – 11:30pm: NetBeans Party (invite only)

Sunday, Oct 25

8am – 9:30am: Java Champions/JUG Leaders Brunch – Arun Gupta (@arungupta)
6:30pm – 7:30pm: WildFly, Hadoop, JavaFX and HTML5 in the Enterprise (UGF10306) – Arun Gupta (@arungupta)
8pm – 10pm: NetBeans, GlassFish, and Payara Party (Thirsty Bear)

Monday, Oct 26

8:30am – 10:30am: Docker and Kubernetes Recipes for Java Developers (TUT1708) – Arun Gupta (@arungupta)
12:30pm – 1:30pm: Refactor your Java EE Applications with Microservices and Containers (CON1700) – Arun Gupta (@arungupta)

Tuesday, Oct 27

12:30pm – 1:30pm: Build Scalable And Secure Mobiles with Java That Work Offline (CON11281) – Wayne Carter (@waynecarter), Ali LeClerc (@ali_leclerc)
5:15pm – 7:15pm: JavaOne Ignite – Arun Gupta (@arungupta)

Wednesday, Oct 28

4:30pm – 5:30pm: SQL for JSON: Rich, Declarative Querying for NoSQL Databases and Applications (CON11282) – Keshav Murthy (@rkeshavmurthy), Gerald Sangudi (@sangudi)

Of course, we’ll also be running the “hallway track” and so feel free to meet us there.

8 Things About Couchbase is a good place to start learning about Couchbase!

Couchbase Logo

If you’ve any doubts about San Francisco being the most beautiful city, go visit Golden Gate, Fisherman’s Wharf, Crooked Street, Alcatraz Island, Cable cars, Chinatown, MOMA, and much more :)

Couchbase 4.0 Datasheets – Server, N1QL, Multi-dimensional Scaling

Couchbase Server 4.0 was released recently and getting good reviews so far.

Couchbase Datasheets

Are you looking for Couchbase datasheets that provide a quick overview of the key features?

Now you’ve them!

  • Couchbase Server 4.0 – Develop with Agility, Operate at Any Scale
  • What’s New – N1QL, Multi-dimensionsal Scaling, Global Secondary Indexes, Enhanced Security, ForestDB Storage Engine, Cross-Data Center Replication Filtering, Geospatial views, and much more
  • N1QL
  • Multi-Dimensional Scaling

Download Couchbase Server 4.0 and start building your web, mobile, and IoT applications in a true polyglot fashion using Java, Go, Python, .NET, PHP, or Node.js SDKs.

Complete list at Couchbase Server.

Enjoy!

Getting Started with Couchbase using Docker

Couchbase Server 4.0 was recently released and can be downloaded and easily installed. Getting Started with Couchbase explains in very simple and easy steps on how to get started with Couchbase.  But when living in a container world, everything is a Docker image. And Couchbase also has a Docker image.

Couchbase Logo

docker-logo

This blog will explain how you can easily start a Couchbase Server 4.0 as a Docker image.

Install and Configure Docker

Docker is natively supported on Linux. So apt get docker-engine on Ubuntu or yum install docker-engine on CentOS will get you ready to use Docker.

On Mac or Windows, this is achieved by install Docker Machine. Docker Machine to Setup Docker Host explain in detail on how to install and configure Docker Machine.

Here is a brief summary to get you started with Docker:

  1. Download Docker client:
  2. Download Docker Machine script:
  3. Create Docker Machine host:
  4. Setup Docker client to connect to this host:

Now your current shell is configured where the Docker client can run containers on the Docker Machine.

Run Couchbase Docker Container

  1. Starting a Docker container on this machine is pretty straight forward. The CLI downloads the image from Docker Hub and then runs it on the Machine:
    In this CLI, run command runs the container using the image id specified as the last argument, -p publish port 8091 from the container to 8091 on the Docker Machine, -d runs the container in background and prints the container id.
  2. Watch the container status as:
  3. Find out IP address of the Docker Machine:
  4. Access the setup console at 192.168.99.100:8091, make sure to specify the exact IP address in your case. This will show the screen:Couchbase Docker Getting Started 1

Configure Couchbase Server

First run of Couchbase Server requires you to configure it, lets do that next!

  1. Click on the Setup button. Scroll to bottom of the screen, change the Data RAM Quota to 500 (MB-16530), and click on Next.Couchbase Docker Getting Started 2
  2. In Couchbase, data is stored in buckets. The server comes pre-installed with some sample buckets. Select the travel-sample bucket to install it and click on Next.Couchbase Docker Getting Started 3
  3. Configure the bucket by taking defaults:Couchbase Docker Getting Started 4

    Click on Next.
  4. Enter personal details, agree to T&C, click on Next:Couchbase Docker Getting Started 5
  5. Provide administrator credentials:Couchbase Docker Getting Started 6

    Click on Next to complete the installation. This brings up Couchbase Web Console:

    Couchbase Docker Web Console

It takes a few seconds for the travel-sample bucket to be fully loaded. And once that is done, your Couchbase server is ready to roll!

You can also watch the following presentation from Couchbase Connect:

Talk to us at Couchbase Forums or @couchbase.

We Are Hiring a Couchbase Developer Advocate

Couchbase, a leading, open source, NoSQL database company to power your Digital Economy, is hiring a Developer Advocate.

Apply now!

What is a Couchbase Developer Advocate?

Couchbase Developer Advocate helps other developers be effective users of NoSQL and Couchbase products.

What does a Developer Advocate do?

Developer Advocate role has become quite common for the past few years now, and here are some of the responsibilities:

  • Content is king! A Developer Advocate creates lots and lots of content. This could be blogs, samples, screencasts, webinars, tutorials, and a lot more. This helps you understand the product better, makes you genuine, builds credibility, and you also feel the developer pain points (and file them in issue tracker).
  • Try latest release of the product and create demos, samples and presentations explaining different features in simple terms
  • Actively write blogs and engage on social media (Twitter, Forums, etc)
  • Author books and articles on third-party websites
  • Prepare hands-on lab / workshops and deliver them
  • Work with multiple languages and frameworks
  • Work as a two-way channel, from inside the company to developers outside and vice versa
  • Speak at different events around the world
  • Constantly seek champions within community and encourage them to be advocate for your technology
  • Are, or become, thought leaders in their topic
  • We are all geeks at heart and like playing with technology

A Couchbase Developer Advocate will play all these roles.

Think of yourself as a swiss army knife that can play different roles at different times!

Developer Advocate

Does a Developer Advocate code?

Hell yeah!

One of the common myth about the role is that it does not involve coding.

Let me clarify that, at least at Couchbase, this is a very coding intensive role. We expect 50% of your time, may be more, will be spent creating top notch content that requires extensive coding and playing with the bleeding edge frameworks.

At Couchbase, some of these tasks are:

  • Try out a JavaScript framework and see how it integrates with Couchbase
  • Figure out how to make Couchbase work with a new application server
  • Investigate N1QL integration with any technology or framework that can produce JSON
  • Work with different cloud providers and show Couchbase hosting there
  • Show (or create) integration of Couchbase with different tools like NetBeans, Eclipse, and IntelliJ. Or Maven, Gradle, Ant, or whatever developers want to use.
  • Hack code or discuss architecture/design of the product with other engineers

And once the content is ready, then you spread the message around the world.

I’ve been building developer communities for 10+ years now, and to date its been a very satisfying and extremely joyful experience!

Why Couchbase is the right company?

NoSQL is going to be an essential component for companies going through Digital Transformation. The flexibility, scalability, agility, and performance offered by NoSQL database is not available in traditional and structured RBDMS.

Couchbase Logo

Couchbase 4.0, recently announced, is highly scalable and getting great enterprise adoption. With innovative features like N1QL and multi-dimensional scaling, we are very well positioned to significantly leapfrog competition in developer adoption.

This is a huge opportunity to join Couchbase, and shape the NoSQL industry for the years to come. Some more articles to help you validate this positioning:

  • NoSQL isn’t hip any more (InfoWorld)
  • How Couchbase is cranking up its developer appeal (ZDNet)
  • Couchbase Server 4.0 Significantly Expands Usecases with N1QL and Multi-Dimensional Scaling (Database Trends & Applications)
  • Couchbase Passes MongoDB in Functionality (Datanami)
  • Couchbase, Time to take a seat? (Constellation Research)

Conclusion

Overall, Couchbase Developer Advocate is going to help companies go through Digital Transformation and become an industry leader by working with the best in the industry.

So, don’t wait and apply for Couchbase Developer Advocate position today!

8 Things to know about Couchbase

Couchbase Badges

This freshly minted Couchbase Badge shows 8 most important aspects of Couchbase. Starting from the top-left in a clockwise fashion:

  1. N1QL is a comprehensive, declarative query language that brings SQL-like query capabilities to JSON documents.
  2. Source code is fully open sourced under Apache 2.0 License
  3. Very easy to start, extensive documentation, free training makes it easy for developers to get started
  4. GeoJSON
  5. Couchbase 4.0 introduces innovative multi-dimensional scaling that enables to separate, isolate, and scale individual services – Query, Index, and Data – to improve application performance and resource utilization. This is in contrast to one-size-fits-all approach used by other NoSQL vendors.
  6. Developer Community since 2011
  7. Couchbase Mobile delivers the full power and flexibility of NoSQL to mobile. Developers can build online and offline application easily.
  8. Consistent high Performance with push-button scalability, always on 24×7 with High Availability and Disaster Recovery, easy administration with WebUI, REST API, and CLI

Excited?

Couchbase Server 4.0 was released earlier this week, download now!

We’ll soon be coming at an event closer to you with tshirts and other swag printed with these badges!

Couchbase 4.0 Server: N1QL (SQL + JSON), Multi-dimensional scaling, Global secondary index, more

Couchbase is an open source, document-oriented NoSQL database for modern web, mobile, and IoT applications. It is designed for ease of development and Internet-scale performance.

Couchbase Logo

Couchbase 4.0 is a major release of the NoSQL database server  that includes significant advances in both architecture and features.

Download Couchbase Server 4.0 now!

The key features introduced in this version are:

  • N1QL (pronounced “nickel”): SQL-compatible query language for JSON documents
  • Multi-dimensional Scaling (MDS): Allows enterprises to isolate different workloads and independently scale the index, query, and data services.
  • Global Secondary Index: is a new access path to your data for faster lookup and higher throughput
  • Enhanced Security: Simplified compliance with security standards, LDAP integration, and auditing capabilities
  • Geospatial Indexes for location-aware applications
  • ForestDB, a new database engine
  • New filtering capabilities on Cross Data Center Replication (XDCR) allowing specific data to be replicated to specific geographical locations

With MDS and N1QL, Couchbase 4.0 becomes the first and only database to combine the powerful query capabilities of a relational database with the performance, scalability, and flexibility of a NoSQL database.

This is in addition to already an existing set of impressive features:

  • Developer-Focused
  • Consistent High Performance
  • Elastic Scalability
  • Always-On Availability
  • Enterprise Grade Administration
  • Data Mobility

and a lot more. Read more details each of these features in About Couchbase Server or Announcing Couchbase Server 4.0.

Lets look at some of the major features introduced in this version.

N1QL = SQL + JSON

N1QL is a comprehensive, declarative query language that brings SQL-like query capabilities to JSON documents. N1QL provides a rich set of features that let you retrieve, manipulate, transform, and create JSON document data.

N1QL Logo

Common SQL statements such as SELECT statement, Data Manipulation Language (DELETE, INSERT, UPDATE, UPSERT), Indexes, Primary Key Access, Aggregations, Joins, Nesting, Unions, Sub-queries, Union, Intersect, and much more can now be applied to JSON. Just use your knowledge of SQL and apply it to JSON documents.

The following query:

will give the result as:

Try yourself in this interactive N1QL tutorial.

A later blog will show how to get started with N1QL using Couchbase 4.0. But in the meanwhile, here are some resources to get started with N1QL:

  • Interactive N1QL Tutorial is an online interactive tutorial that runs in a browser and allows you to learn about N1QL without having Couchbase Server installed in your own environment. The tutorial covers SELECT statements in detail, including examples of JOIN, NEST, GROUP BY, and other typical clauses.
  • N1QL Cheat Sheet provides a concise summary of the basic syntax elements. 
  • N1QL Reference Guide contains details about N1QL syntax and usage.
  • N1QL Forums or N1QL at Stackoverflow is a community resource where you can ask questions, find answers, and discuss N1QL with other developers and the Couchbase team.

Difference between SQL and N1QL highlights the key difference between two.

N1QL has full compatibility with the SQL ecosystem via connectors and standard JDBC/ODBC drivers. This allows enterprises for the first time to connect popular ETL, reporting, and BI tools to Couchbase. Companies like Databricks, Looker, Simba Technologies, Informatica, Tableau, and Metanautix are all partnering with Couchbase to provide supported integrations.

Multi-dimensional Scaling

Query, Index, and Data are the three key database services. Query is CPU-intensive operation and so require a faster processor. Index is disk heavy and so require a faster solid state drive. Data needs to be read/written fast and so require more memory.

The needs for these services is quite different but yet existing databases put them together on a single node causing resource contention. For example, storing data and executing queries on the same node will cause CPU contention. Similarly, storing data and indexes on the same node will cause disk IO contention. There is network over head if a query needs to run by distributing to every node or an index needs to be stored on every node.

Couchbase 4.0 introduces innovative multi-dimensional scaling that enables to separate, isolate, and scale individual services – Query, Index, and Data – to improve application performance and resource utilization. This is in contrast to one-size-fits-all approach used by other NoSQL vendors.

Multi Dimensional Scaling in Couchbase

 

This is quite different from Oracle, MongoDB and Cassandra’s one-size-fits-all one dimensional scaling. It helps in improved performance, reduced hardware costs, and enables enterprises to support a much broader set of applications with a single database: Couchbase Server.

http://www.couchbase.com/press-releases/database-scaling-redefined-by-couchbase-multi-dimensional-scaling-outperforms-one-dimensional-scale-limitations-of-oracle-mongodb-and-cassandra

Global Secondary Index

Traditional local secondary indexes reside with data on every node of a Couchbase cluster. They’re great when you need to query all of the data, but because they query every node every time — even to return data that’s stored on a subset of the nodes — performance gets worse as the number of nodes increases.

Global Secondary Indexes (GSI) provide a new access path to your data for faster lookup and higher throughput. It’s a global index, so index lookup is much easier — there’s no need to query a local index on each data node and aggregate the results.

Learn more about GSI in this presentation from Couchbase Connect 2015:

Subsequent blogs will provide more details about each of these features and how to use them.

Here are some top-level links for you to get started:

  • Download Couchbase Server 4.0
  • Release Notes
  • Step-by-step Getting Started Guide
  • Developer Guide using SDKs with Java, Go, C, Node.JS, .NET, PHP, Python, and Ruby
  • Online, classroom, virtual, on-site training at training.couchbase.com

Here is some media coverage:

  • Couchbase Releases V4 of NoSQL Database
  • Couchbase 4.0 released, adds multi dimensional scaling and more
  • Couchbase Makes Case for Enterprise-Class Document Database
  • How Couchbase 4.0 is cranking up its developer appeal
  • Couchbase announces general availability of its 4.0 Release: Introduces breakthrough developer agility and scaling innovations enabling broad enterprise re-platforming
  • SQL on NoSQL? Couchbase 4.0 has a plan
  • Couchbase Passes MongoDB in Functionality, CEO Claims
  • Couchbase Server 4.0 Lets SQL Users Take A Seat
  • Simba Technologies Introduces ODBC, JDBC Drivers for Couchbase Server 4.0
  • How to Setup Couchbase as a Linked Server in Microsoft SQL Server
  • Couchbase Server 4.0 opens the door to SQL on NoSQL

Couchbase Server 4.0 – Develop with Agility and Operate at any Scale.