All posts by arungupta

Docker Networking with Couchbase and WildFly

Docker Multi-Host networking allows you to create virtual networks and attach containers to them so you can create the network topology that is right for your application. This blog will show how to use it with Docker Compose.

CRUD Java Application with Couchbase, Java EE, and WildFly explained how to use a Java EE application to provide a CRUD/REST interface on a data bucket in Couchbase. It required to manually download and run WildFly. The blog also used Couchbase server using Docker and required manual configuration to load travel-sample bucket.

Configure Couchbase Docker Container using REST API explained how to use Couchbase REST API to configure Couchbase Server.

Docker Multi-Host Networking

This blog will remove the explicit download of WildFly and manual configuration of Couchbase server:

  • Use Docker Compose to start WildFly and Couchbase (no download required)
  • Use a Maven profile to configure Couchbase server (no manual configuration required)
  • Uses Docker multi-host networking so that WildFly and Couchbase server can talk to each other

Lets get started!

Start Couchbase and WildFly using Docker Multi-Host Networking and Compose

  1. Start WildFly and Couchbase server using docker-compose.yml file from github.com/arun-gupta/docker-images/blob/master/wildfly-couchbase-javaee7/docker-compose.yml:
    arungupta/wildfly-admin image is used as it binds WildFly’s management to all network interfaces, and in addition also exposes port 9990. This enables WildFly Maven Plugin to be used to deploy the application.

    container_name is specified for Couchbase service and referred in WildFly service using COUCHBASE_URI. This is then used to connect to Couchbase from the Java EE application.

    The application environment is started as:

    --x-networking is an experimental switch added to Docker Compose 1.9 that allows to create a bridge or an overlay network. By default, it creates a bridge network that works on a single host. The network created can be seen as:

    Issue 2221 provide more explanation about the default networks created. wildflycouchbasejavaee7 is the new bridge network created for our application.  Issue #2345 provide some details about incorrect driver name in the output message.

Configure Couchbase Server

  1. Clone couchbase-javaee repo:

  2. Configure Couchbase server:

    exec-maven-plugin is used to invoke REST API and configure Couchbase server and is configured in a Maven profile. Make sure to setup docker.host property in pom.xml.

  3. Deploy the application to WildFly:

    Make sure to specify the correct host on CLI. In this case, this is the IP address obtained using docker-machine ip default.

Invoke the Application

  1. Invoke the REST endpoint using cURL:

    Complete set of REST endpoints are documented at CRUD Java Application with Couchbase, Java EE and WildFly. They are listed here for convenience:

    1. GET a single airline:
    2. Create a new airline using POST:

    3. Update an existing airline using PUT:
    4. Delete an existing airline using DELETE:

Enjoy!

Configure Couchbase Docker Container using REST API

Couchbase Docker image is published at hub.docker.com/_/couchbase. The easiest way to start this image is:

8091 is the network port used by Couchbase Web Console for REST traffic. Complete set of ports are documented at Couchbase Network Configuration. This image can be configured using Single Host Single Container configuration as explained at hub.docker.com/_/couchbase.

This blog will show you can create a single node Couchbase cluster using Docker, configure it with Data, Index, and Query service, load a sample bucket, and query it.

Couchbase Docker Container

Start Couchbase Docker Container

Start Couchbase Docker Container using the following docker-compose.yml:

This Docker Compose file can be downloaded from github.com/arun-gupta/docker-images/tree/master/couchbase-server.

The container can be started as:

Status of the running container can be seen as:

Logs can be seen as:

Configure Couchbase Docker Container

  1. Get IP address of the Docker Host:

    Use this IP address in all the subsequent commands.

  2. Configure memory for Data and Index services:

  3. Configure Data, Query, and Index services:

  4. Setup credentials for the cluster:

Install Couchbase Travel Sample Bucket

Query Couchbase Docker Container using CBQ

  1. List container id of Couchbase server:

    This output shows the complete information about the container. Alternatively, just the container id can be obtained as:

  2. Run Couchbase Query tool:

  3. Run a query:

    Did you realize, this was a SQL query for JSON document? How cool.  Learn more about in this interactive N1QL tutorial.

Cluster overview can be seen at 192.168.99.100:8091:

Couchbase Docker Container Cluster Overview

Data buckets can seen as:

Couchbase Docker Container Databucket

Ask your questions at forums.couchbase.com, learn more about Couchbase REST API or read more in Couchbase 4 Docs.

A subsequent blog will show how all of these steps can be fully automated.

Enjoy!

Attach Shell to Docker container

Docker Logo

Often there is a need to attach a shell to an already running Docker container. This is very useful, especially for debugging. This blog will explain how to attach a shell to an already running Docker container.

So let’s say you run a Couchbase Docker container in detached mode:

Running the container gives you the complete container id, 02061ddf0a3d1b2806a1ee6e354f4064d9d2ff4d84d8c96c0273c8883917a92f in this case.

This can be verified as:

Or complete container id can be verified as:

Attach Shell to Docker Container

Bash shell can be attached to an already running container using docker exec -it {CID} bash. The {CID} can be the complete container id, truncated container id, or even the first few digits of the container ids amongst all the currently running containers.

So the following three commands are equivalent in our case:

Attach Using Complete Container Id

Attach Using Truncated Container Id

Attach Using Unique Numbers from Container Id

In this case, just specifying 0 would work because this is the only running container. If multiple containers are running that have 0 as the starting number then the first few digits that make the container id unique are required.

Enjoy!

CRUD Java Application with Couchbase, Java EE and WildFly

Couchbase is an open-source, NoSQL, document database. It allows to access, index, and query JSON documents while taking advantage of integrated distributed caching for high performance data access.

Developers can write applications to Couchbase using different languages (Java, Go, .NET, Node, PHP, Python, C) multiple SDKs. This blog will show how you can easily create a CRUD application using Java SDK for Couchbase.

REST with Couchbase

The application will use curl to issue REST commands to a JAX-RS endpoint deployed on WildFly. These commands will then perform CRUD operations on travel-sample bucket in Couchbase. N1QL (SQL query language for JSON) will be used to communicate with Couchbase to retrieve results. Both the “builder pattern” and raw N1QL commands will be used.

Couchbase CRUD using WildFly and Curl

TL;DR

Complete source code and instructions for the sample are available at github.com/arun-gupta/couchbase-javaee.

Lets get started!

Run Couchbase Server

Couchbase server can be easily downloaded from Couchbase Server Downloads page. In a containerized world, its a lot easier to fire up a Couchbase server using Docker.

If Docker is configured on your machine then the easiest way is to use Docker Compose for Couchbase:

Starting up the application server shows:

And then the logs can be seen as:

The database needs to be configured and is explained at Configure Couchbase Server. Make sure to install travel-sample bucket.

Deploy the Java EE Application on WildFly

  • Download WildFly 9.0.2 , unzip, and start WildFly application server as ./wildfly-9.0.0.Final/bin/standalone.sh.
  • Git clone the repo: git clone https://github.com/arun-gupta/couchbase-javaee.git
  • Change directory cd couchbase-javaee
  • Deploy the application to WildFly: mvn install -Pwildfly.

The application uses Java SDK for Couchbase by importing the following Maven coordinates:

Invoke the REST Endpoints Using cURL

GET Airline resources (limit to 10)

Lets query the database to list 10 Airline resources.

Request

Response

The N1QL query for this is written as:
And can also be alternatively written as:
You may optionally update the code to include ORDER BY clause as shown in N1QL Tutorial.

GET one Airline resource

Use id attribute to query a single Airline resource

Request

Response

POST a new Airline resource

Learn how to run N1QL queries from the CLI using CBQ tool and verify the existing sample data:

This query retrieve documents where airline’s name is Airlinair. The count is shown in metrics.resultCount.

Create a new document using POST.

Request

Response

Query again using CBQ and now the results are shown as:
Note that two JSON documents are returned instead of one as before the POST command was issued.

PUT an existing Airline resource

Update an existing resource using HTTP POST.

The data model for travel-sample bucket requires to include “id” attribute in the payload and in the URI as well.

Request

Name of the airline is updated from “Airlinair” to “Airlin Air”, all other attributes stay the same.

Response

The updated record is shown in the response.

Querying for Airlinair gives:

So the previously added record is now updated and thus does not appear in query results. Querying for Airlin Airgives:

This shows the newly updated document.

DELETE an existing Airline resource

Query for a unique id:

Notice that one document is returned.

Lets delete this document.

Request

Response

The deleted document is shown in the response.

Query again for the deleted id:

And no results are returned!

As mentioned earlier, the complete code base is at github.com/arun-gupta/couchbase-javaee.

Enjoy!

Docker, Kubernetes, and Microservices Replay from Devoxx 2015

Devoxx 2015 BE Arun

Java gives us Write Once Run Anywhere (WORA) because of the common abstraction provided by Java Virtual Machine. The binary byte code produced by Java is understood by the JVM running on multiple operating systems. This allows Java code to run on any operating system. But deploying such applications typically requires to tune the JVM, setup application server, install appropriate database drivers, other similar configuration. Docker nicely complements WORA by defining a way to package Java applications, and include all the configuration in a an easy to describe format. This can be called as Package Once Deploy Anywhere, or PODA.

Docker PODA

Do you want to learn more about how Docker helps with PODA?
How do you create multi-container applications using Docker Compose?
How do you deploy this multi-container application on multiple hosts running in a Docker Swarm cluster?
What new features Docker introduced in 1.9 release – particularly multi-host networking and persistent storage?
How do you deploy Docker containers using Kubernetes?
How does Kubernetes help with scaling applications?
How does Docker Swarm compare with Kubernetes?

I had the privilege of delivering a 3-hour university on Docker and Kubernetes followed by a 3-hour hands-on lab. The replay of the university session is now available:

Slides for the university are available at: github.com/javaee-samples/docker-java/tree/master/slides

The contents from the hands-on lab are available at bit.ly/dockerlab.

In addition, I also gave a 3-hour university on Refactor your Java EE Applications using Microservices and Containers. This session explained:

  • Basic characteristics of Microservices
  • Showed a simple shopping cart monolithic application, and how it was refactored to multiple microservices (github.com/arun-gupta/microservices)
  • Talked about transactions, event sourcing and CQRS
  • How KumuluzEE was used to create standalone JARs
  • Explained how such microservices can be deployed using Docker

Slides from this session are available at: github.com/arun-gupta/microservices/tree/master/slides

Replay is available at:

The response on twitter was quite positive:

And in case you are interested, watch a quick interview with Voxxed team:

Enjoy!

 

Docker 1.9 – Virtual networks, persistent storage, production-ready Swarm

Docker 1.9 Logo

Docker 1.9 is released, read Announcing Docker 1.9 for complete details. This release contains:

  • Docker 1.9.0 Client Binary
  • Docker Machine 0.5.0
  • Docker Compose 0.5.0
  • Docker Toolbox 1.9.0
  • Docker Swarm 1.0.0

Some of the key features are:

  • Create virtual networks that span multiple hosts and backed by multiple plugins such as Calico, Weave, Cisco, and others (full details)
  • Persistent storage support using new volume management system and backed Flocker or Ceph (full details)
  • Docker Swarm is 1.0.0 and ready for production, tested with 1000 nodes and 30,000 containers (complete list, Announcing Swarm 1.0)
  • Docker Machine code is split into core Docker Machine client and multiple binaries, one each for the driver (complete list)
  • Docker Compose now runs on Windows, environment variables are supported in docker-compose.yml file (complete list)

Getting Started with Docker

If you’ve never installed Docker on your machine, then Docker Toolbox 1.9.0 installs everything you need to get started with Docker on Mac OS X and Windows. It even includes Virtual Box 5.0.8.

Docker 1.9 Toolbox

Download Docker Toolbox 1.9.0 for Mac or Windows.

Of course, you can apt-get install docker-engine on Ubuntu or yum install docker-engineon CentOS.

If you like to update binaries independently or learn how to use them to get started, read ahead!

Install Docker 1.9.0 CLI Binary

Download the latest Docker CLI binary:

Install Docker Machine 0.5.0

Docker Machine allows you to create Docker Engines on your laptop, on cloud, or inside your data center.

Docker Machine Logo

Download the latest Docker Machine binary:

Docker Machine has been split into multiple binaries – one for the core Docker Machine client and a binary for each driver. So the installation is different from the previous releases.

And create a new machine as:

A new machine created using this could not be queried by Docker CLI (#2147). Upgrading the machine explicitly using docker-machine upgrade lab helped resolve the issue.

Hopefully this is just a timing issue and will not occur going forward.

Docker Compose 0.5.0

Docker Compose allows to easily run multi-container applications.

A simple way to verify is to run three node Couchbase Cluster.

And the list of running containers:

A later blog will show how to use persistent storage volumes to store the data.

Currently, Docker Compose requires docker-compose.yml from the local filesystem. It would be useful for docker-compose to use these files from a URI (#2313).

Docker Swarm 1.0.0

Docker Swarm provides native clustering for Docker. It converts a pool of Docker Engines into a single virtual engine. The tools, such as Docker CLI, that work with a single engine continues to work Swarm. So your applications that would run on a single Docker Engine can now easily run on multiple Docker Engines.

Docker Swarm Logo

Read more in Clustering using Docker Swarm for more details on how to setup cluster.

Download or upgrade your binaries to Docker 1.9, and use the latest features!

Docker Hands-on Workshop and Slides

Docker hands-on workshop will be updated to use Docker 1.9 in the coming days, stay tuned!

Latest slides to introduce Docker are available at github.com/javaee-samples/docker-java/tree/master/slides.

Docker Machine “client is newer than server” error

Docker 1.9.0 is getting ready to be released. Docker Release Candidate builds can be downloaded from github.com/docker/docker/releases. Matching Docker Machine Release Candidate builds can be downloaded from github.com/docker/machine/releases.

So, you downloaded Docker Machine and Docker CLI Release Candidate build. The latest one at this time is 1.9.0 RC4 for Docker and 0.5.0 RC4 for Docker Machine.

Download is pretty straight forward:

And now Docker Machine:

A big change in Docker Machine is where implementation of drivers such as virtualbox, digitalocean, amazonec2, etc are no longer packaged in the main binary. Instead the distribution is a zip bundle with multiple drivers packaged and referenced from the main binary. These are now packaged separately and has the following benefits:

  1. Each driver can evolve rapidly without waiting for merging into upstream
  2. Additional drivers can be written and used without merging into the upstream
  3. New version of the drivers can be released more frequently. Hopefully more clarity will be available on how these drivers will be distributed.

That’s why installation is slightly different and looks like:

After installation, the Docker Machine can be created as:

And Docker CLI is configured to talk to this machine as:

But now when you try to see the list of images on this machine as docker images, it gives the following error:

This was filed as #2147.

Fortunately, the fix is rather simple even though non-intuitive. Docker Machine needs to be created as:

This is so because use a RC Docker binary require to specify to use a release candidate ISO. This can be done by using -virtualbox-boot2docker-url option as shown.

Now when the Docker Machine is created this way, the empty list of images is shown correctly:

Voila, back in business!

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.