<img border="0" height="50px" src="1116169/Download-Button.png" width="160px" />
Introduction
Size and speed > Data and Calculations > Storage and computing power > Cloud and scalability
Every day new data centers are built all over the world, cloud data storage is expanding, and as result, prices go down. Companies are moving their precious data to the Cloud enriching their business with unlimited space, more processing power, service availability, scalability, mobility, redundancy and data durability.
Not all clients are willing to trust cloud securities or have the liability of staying online during all operational time. There is no need for them to suffer the lack of cloud services in their business. This is why cloud service providers often offer private cloud services or locally deployable solutions.
Background
IBM Cloudant Data Layer Local Edition
IBM Cloudant Data Layer Local Edition is a database management system (DBMS) platform designed to resemble IBM Cloudant Database as a service (DBaaS) in the privacy of your own data center.
Cloudant Local packages up the rich functionality, behavior and tooling of Cloudant Managed DBaaS for companies of all sizes. It offers elastic scalability as it runs on inexpensive servers and you can easily add or remove servers in the cluster to balance your traffic fluctuations. It also offers multi-datacenter and data mobility services replicating data across data centers or between mobile devices in order to have the data closer to the user for fast access. Finally, it offers adaptive deployment options, that allow you to match your application development roadmap needs to the data layer.
Additionally:
- You can run Cloudant Local in a private cloud environment to achieve maximum privacy.
- You can run Cloudant Local in a public cloud on public cloud platforms to achieve geo-location and traffic goals.
- You can run Cloudant Local in hybrid cloud a combination of private and public clouds to achieve optimal cost, reach, service and compliance.
Requirements
Cloudant Local requires minimum of five servers to create a cluster:
- 1 primary load balance
- 1 failover load balancer
- 3 database servers
It runs on 64-bit operating systems - Debian (6.0.10), Ubuntu Server (12.04.4), Red Hat Enterprise Linux Server (6.5) or CentOS (6.5)
Cloudant Developer edition
For the purpose of this post we will install Cloudant Developer edition. This is a fully-featured version of Cloudant Local licensed for development purposes only. The limitations are that you can't create clusters and you can have only one node. On other side there is less hardware and software requirements in comparison to the hardware and software requirements for Cloudant Local installation.
Using the code
Prerequisites
As Cloudant Developer Edition is designed to be used as a design and test tool for developers, it's packaged as Docker standardized unit for software development. It is easy to deploy it using Docker and allows us to choose the best environment to work on.
I will show how Cloudant Developer is installed on both Ubuntu and Windows 10, but first we need to install Docker.
<img height="320px" src="1116169/Docker.PNG" width="640px" />
Installation of Docker on Ubuntu
<img height="125px" src="1116169/doker2.PNG" width="640px" />
Installing Docker on Linux is related to validations and preparations (as is often the case with Linux software)
We need to know two thinks before we start:
- Kernel version: as Docker can be installed on 64-bit Ubuntu versions with kernel above version 3.10
- Release versions: as we need to name the package for download.
<img height="150px" src="1116169/docker-step-0.PNG" width="640px" />
Next steps are:
- Update package information and install https and CA certificates
$ sudo apt-get update
$ sudo apt-get install apt-transport-https ca-certificates
- Add new GPG key (skip this step until you find the certificate thumbprint)
$ sudo apt-key adv --keyserver hkp:
Remark: the certificate thumbprint will be shown as error message when repository pull is requested.
- Edit or create docker.list in /etc/apt/sources.list.d - based on your Ubuntu release you need to set file content to one of the following:
Ubuntu Precise 12.04 (LTS)
|
deb https://apt.dockerproject.org/repo ubuntu-precise main
|
Ubuntu Trusty 14.04 (LTS)
|
deb https://apt.dockerproject.org/repo ubuntu-trusty main
|
Ubuntu Wily 15.10
|
deb https://apt.dockerproject.org/repo ubuntu-wily main
|
Ubuntu Xenial 16.04 (LTS)
|
deb https://apt.dockerproject.org/repo ubuntu-xenial main
|
In order to edit the file, you will need root access.
- Run the APT package update
$ sudo apt-get update
- We need to purge the old repository (if any exists)
$ sudo apt-get purge lxc-docker
- Set new repository for APT to pull Docker
$ apt-cache policy docker-engine
<img height="271px" src="1116169/docker-step-4.PNG" width="640px" />
- Install additional packages to extend Docker functionality. Based on your Ubuntu version this step can have one or multiple commands to execute:
Ubuntu Precise 12.04 (LTS)
|
(check Docker documentation)
|
Ubuntu Trusty 14.04 (LTS)
|
$ sudo apt-get install linux-image-extra-$(uname -r)
|
Ubuntu Wily 15.10
|
Ubuntu Xenial 16.04 (LTS)
|
<img height="122px" src="1116169/docker-step-5.PNG" width="640px" />
- Last update, Install and run Docker
$ sudo apt-get update
$ sudo apt-get install docker-engine
$ sudo service docker start
- Check if Docker is operational
$ sudo docker run hello-world
<img height="407px" src="1116169/docker-step-6.PNG" width="640px" />
This will be all about Docker installation on Ubuntu
Install Docker on Windows 10
<img height="197px" src="1116169/docker-windows.PNG" width="640px" />
It's easy as any other Windows installation:
- Download from Docker site and start the installation
- Accept the license agreement
<img height="502px" src="1116169/docker-windows-1.PNG" width="640px" />
- Finish the installation and check Docker
<img height="1048px" src="1116169/docker-windows-2.PNG" width="640px" />
<img height="562px" src="1116169/docker-windows-3.PNG" width="640px" />
Install Cloudant Developer
After installing Docker the Cloudant Developer installation is fast and easy for both Windows and Ubuntu environments. It's a four step installation process including the license agreement.
- Pull Cloudant Developer from Docker repository
docker pull ibmcom/cloudant-developer
<img height="185px" src="1116169/cloudant-install-ubuntu-1b.PNG" width="640px" />
<img height="242px" src="1116169/cloudant-install-windows-1.PNG" width="640px" />
- Start Cloudant Local with default settings
docker run --privileged --detach --volume cloudant:/srv --name cloudant-developer --publish 8080:80 --hostname cloudant.dev ibmcom/cloudant-developer
<img height="63px" src="1116169/cloudant-install-ubuntu-2.PNG" width="640px" />
- Accept the license agreement
docker exec -ti cloudant-developer cast license –console
<img height="236px" src="1116169/cloudant-install-windows-2.PNG" width="640px" />
- Clear databases
docker exec cloudant-developer cast database init -v -y -p pass
<img height="89px" src="1116169/cloudant-install-ubuntu-4.PNG" width="640px" />
<img height="67px" src="1116169/cloudant-install-windows-3.PNG" width="640px" />
Finally, you have now fully operational local version of Cloudant Database:
Under Ubuntu
<img height="478px" src="1116169/cloudant-install-ubuntu-5.PNG" width="640px" />
And in Windows 10
<img height="360px" src="1116169/2016-07-18__1_.png" width="640px" />
Repeating all those steps you will be pleased to discover how fast and smooth Cloudant Local works.
You can also design and test indexes and search queries without the risk of downtime in production environment.
Local testing
In previous posts we created simple IoT examples for storing data on a Cloudant Database and we did some demo indexing and searching over the collected data. Now we can reuse all those examples addressing local installation on a developer machine. For example, the emulator code can now submit data locally into Cloudant Developer installed under Windows 10. This way we will have a development environment separated from the public network, and solutions suitable for source control and off line mode in order to avoid data collisions.
The change in code is that the address is no longer a Cloudant DBaaS URL, but localhost.
#region CreateHttpClient
private static HttpClient CreateHttpClient(HttpClientHandler handler, string user, string database)
{
return new HttpClient(handler)
{
BaseAddress = new Uri(string.Format("https://localhost:8080/{1}/", user, database))
};
}
#endregion CreateHttpClient
With only this change we have the expected results:
- High speed of processing as it's not delivering any data through the network
- Full access to all Cloudant DB features
<img height="285px" src="1116169/Cloudant.DataLayer-Pic01.png" width="504px" />
Point of interest
IBM Cloudant provides for us a full set of tools and services for efficient application and business development. We can planresults and growth relaying on quality solutions for each step of our roadmap. An IBM Cloudant Developer comforts developers into their preferred operating system and set of tools
IBM Cloudant Data Layer Local comforts businesses into their privacy, accessibility and price expectations.
IBM Cloudant Managed DBaaS gives us the freedom of the Cloud.
The new Universal No-SQL Database Platform allows us to develop once and re-use code on mobile and personal devices, in private clusters, or in the cloud delivering fast results to our users.