CouchDB: Learn and Understand Database Design with CouchDB
Posted By : Ankit Uniyal | 31-Dec-2018
In this blog, we are going to learn about CouchDB and understand the database design with CouchDB.
CouchDB is a document-oriented database and it is relatively a new management system which has been designed from the ground up to suit modern software applications. It is actually intended to have something related document-oriented type. If you are aware of MongoDB then you will easily understand the CouchDB concepts.
So, CouchDB is something which is more conceptually related to the document-oriented thing. It is quite different as compared to Oracle, SQL and MySQL kind of concepts. So, CouchDB is purely based on one thing like if you are aware of big data and many more things, you can easily get a better idea. It has a licence with Apache, so its not an open source software.It is like appropriately thing in contrast to any of the systems that you have to be it is in schema free manner.
You don't have to design a particular schema for having it said in system or if you have a set of requirements. For example, So first thing you do is that you have this set of schema design and then then later you design the database so that is not a big question we're hearing for couchDB.
What does this Couch stands for?
This Couch stands for cluster of unreliable commodities. So, it is like acronymn of this thing i.e cluster of unreliable commodity hardware. It's indicating that CouchDB is intended to run across a distribution. In the document oriented way, it does not have any kind of schema or relational database concepts included in it.
So these are some of the basic points which will give a better description like why we are choosing CouchDB:
1.CouchDB have an HTTP-based REST API.
2.As we can store data in the flexible document-based structure.
3.Users are provided with powerful data mapping.
4.CouchDB provides easy-to-use replication, using which you can copy, share and synchornize the data.
Installation of Apache CouchDB on Ubuntu:
1. Install Apache:
apt-get install apache2
Now, you can start the apache and then run below commands:
systemctl start apache2
systemctl enable apache2
Run the below commands:
echo "deb http://apache.bintray.com/couchdb-deb xenial main" \ | sudo tee -a /etc/apt/sources.list
curl -L https://couchdb.apache.org/repo/bintray-pubkey.asc \ | sudo apt-key add -
apt-get install couchdb
Understanding Curl and Futon:
1.Curl utility is a way to communicate with CouchDB.
2.Futon is the built-in, web-based, administration interface of CouchDB.
So, these two factors are very important while communication with CouchDB ie. how to create a database, how to maintain the database and so on.
Curl utility is a tool to transfer the data and it has a support of protocols namely HTTP, HTTPS,FTP, FTPS. This Curl command is actually designed to work with user interaction as you fetch whatever the information you needed from the specified protocols. The curl utiility is available in each Operating systems.
Creating a Database in CouchDB:
1.Using Curl Utility:
A database can be created in CouchDB by sending HTTP PUT request to the server. Below is the syntax to create database in CouchDB:
$ curl -X PUT http://127.0.0.1:5984/your_database_name
Open http://127.0.0.1:5984/_utils/ to create a database. Now, you will get an Overview/index page of CouchDB which is shown below.
Now, you can see the list of database and also a button on the left side to create a new database. Now, once you click on the database create link then you will see a pop up window Create new Databases and then add the database name which we need to create and click on the create button which is showing in below image.