Sample applications for Cloudera Operational Database

Cloudera Operational Database is an operational database-as-a-service that brings ease of use and flexibility to Apache HBase. Cloudera Operational Database enables developers to quickly build future-proof applications that are architected to handle data evolution.

In the previous blog posts, we looked at application development concepts and how Cloudera Operational Database (COD) interacts with other CDP services. In this blog post, let us see how easy it is to create a COD instance, and deploy a sample application that runs on that COD instance. 

You must have CDP public cloud access and entitlement to use COD. Complete the steps provided in the quick start documentation to create your first COD instance. You can access the COD web user interface from your CDP console.

Enterprise Data Cloud

Quick start to deploy your application

Deploying your application is a simple five-step process. 

Cloudera OpDB Quickstart

Step 1: Create an environment on AWS or Azure

Step 2: Create a database

Step 3: Create users and set up privileges

Step 4: Develop your application

Step 5: Compile your application for COD

We are mainly going to focus on steps 4 and 5 in this blog post; ensure that your COD instance is running and you have set up and configured one of the supported programming languages on the machine where you want to develop these applications. After you compile your application, you run it on a COD edge node.  

Download and use a sample application 

You can use one of the many sample applications in this GitHub repository: cloudera/cod-examples: cod-examples. You either clone this repository to your machine or download and use these sample applications. 

To run these sample applications, you must follow the following workflow.


If you already have an application written for COD, you can skip to the Get connectivity information and Compile an application section in this blog post. 

The repository contains sample applications that are organized based on the programming language used.


Apache HBase (NoSQL), Java, Maven: Read-Write

A Java application that creates an HBase table, writes some records and validates that it can read those records from the table via the HBase Java API. 

Apache Phoenix (SQL), Java, Dropwizard: Stock ticker

A Java application built on Dropwizard which is a simple tracker for the price of various company’s stock prices.


Apache Phoenix (SQL), Java, Maven: Read-Write

A Java application that creates a Phoenix table writes some rows and validates that it can read those rows back from the table via Phoenix JDBC API. Variants exist for the Phoenix thick JDBC driver and Phoenix thin JDBC driver.

Apache Phoenix (SQL), Python: Read-Write

A Python application built on Flask which creates a simple blog using the Phoenix Python adapter.

C# using ODBC driver

Apache Phoenix (SQL), C#, .NET, ADO.NET

A C# application that uses an ODBC driver to interact with Apache Phoenix via the ADO.NET extensions in .NET Framework 4.5.2 and above.

Get connectivity information 

When compiling your application for your Cloudera Operational Database (COD) you need information about the connectivity options that helps your applications interact with COD. You can get that information either using CLI or the COD user interface.

Connectivity Information

For more information about client connectivity information, see Client connectivity information

Compile your applications

Once you have created your application and a database using Cloudera Operational Database (COD), you have to compile your application for your database.

For more information about compiling applications for your database, see Compile an application for your COD database


Run your application

To run your application on COD, you need an edge node. The edge node is a dedicated Data Hub cluster that enables you to communicate with your COD instance and your applications. You need an edge node because the subnet security group and ingress rules of your public cloud providers prevent you from accessing your database from a public network.

You can deploy a Data Hub cluster that works as an edge node to access your COD instance. Deploy the edge node Data Hub cluster in the same environment as the COD instance to ensure that the security groups and data ingress rules that apply to the COD instance must also apply to the edge node Data Hub cluster.

For instructions on how to create an edge node, see Configure edge node using Data Hub.

Once you are done creating an edge node, you are ready to deploy your application on the edge node. 

If your application uses the HBase native APIs,  it is easier to build your project on your local machine and copy the JAR files to the remote node, rather than install a JDK and Apache Maven on your edge node. For example, you can run the following commands by replacing the ec2 instance names and file names with what you have used for your applications. 

Run the following commands on your machine to copy your JARs to the edge node:

$ scp -r target
$ scp
$ ssh "sudo yum install -y java-1.8.0-openjdk"
$ ssh "unzip"

Run the following commands on the edge node to deploy your application: 

$ kinit cdp_username
Password: ***********
$ export JAVA_HOME="/usr/lib/jvm/java-1.8.0"
$ java -cp target/nosql-libs/*:target/hbase-read-write-0.1.0.jar:hbase-conf com.cloudera.cod.examples.nosql.ReadWriteExample

If your application uses the Python PhoenixDB library, you must install the required libraries on the edge node before you can run your application. The requirements can vary based on whether you use a framework or not. In the Apache Phoenix (SQL), Python: Read-Write example, the Flask microframework must be installed.  

Run the following commands  to install Flask and run your application on the edge node: 

A virtual environment is created in this example, but you can run these commands directly on your edge node without creating a virtual environment. 

$ virtualenv e
$ source e/bin/activate
$ pip install -r requirements.txt
$ cp config.ini.template config.ini
$ <modify config.ini with your credentials>

Run the following commands to initialize the database and start the application:

$ FLASK_APP=flaskr FLASK_DEBUG=true flask init-db
$ FLASK_APP=flaskr FLASK_DEBUG=true flask run


It is easy to start developing applications for Cloudera Operational Database. Try running one of the sample applications or write your application now. For more information about COD, see Cloudera Operational Database.  

Gokul Kamaraj
More by this author
Liliana Kadar
More by this author
Krishna Maheshwari
Director of Product Management
More by this author

Leave a comment

Your email address will not be published. Links are not permitted in comments.