0% found this document useful (0 votes)
8 views19 pages

Couch DB

Apache CouchDB is an open-source NoSQL document database that uses JSON-based documents and is written in Erlang. It features a schema-free data model, bi-directional replication, and a RESTful API for flexible data management and offline capabilities. While it offers scalability and strong community support, CouchDB has drawbacks such as large document sizes, lack of transaction support, and challenges with relational data management.

Uploaded by

entrib02
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views19 pages

Couch DB

Apache CouchDB is an open-source NoSQL document database that uses JSON-based documents and is written in Erlang. It features a schema-free data model, bi-directional replication, and a RESTful API for flexible data management and offline capabilities. While it offers scalability and strong community support, CouchDB has drawbacks such as large document sizes, lack of transaction support, and challenges with relational data management.

Uploaded by

entrib02
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

CouchDB

• Apache CouchDB is an open source NoSQL document database that


collects and stores data in JSON-based document formats. It is written
in Erlang programming language.
• CouchDB uses JavaScript as its query language to transform the
documents, using MapReduce, and HTTP for an API.
• Unlike relational databases, CouchDB uses a schema-free data model,
which simplifies record management across various computing
devices, mobile phones, and web browsers.
• CouchDB is open source, free to use, and easily integrates within your
current data management infrastructure.
• CouchDB gives businesses the flexibility they need to create durable,
reliable, and scalable infrastructures.
CouchDB Data Model:
• Database is the outermost data structure/container in CouchDB.
• Each database is a collection of independent documents.
• Each document is responsible for maintaining its own data and self-
contained schema.
• Document metadata contains revision information, which makes it
possible to merge the differences occurred while the databases were
disconnected.
• CouchDB implements multi version concurrency control, to avoid the
need to lock the database field during writes.
FEATURES:
CouchDB replication:
• One of CouchDB’s defining features is bi-directional replication, which
enables synchronization of data across multiple servers and devices.
• This replication enables enterprises to maximize systems availability,
reduce data recovery times, geo-locate data closest to end users, and
simplify backup processes.

CouchDB views:
• CouchDB uses views as the primary tool for running queries and
creating reports from stored document files.
HTTP API:
• CouchDB uses a RESTful API to access the database from anywhere,
with full CRUD (create, read, update, delete) operations flexibility.
• This simple and effective means of database connectivity makes
CouchDB flexible, fast, and powerful to use while remaining highly
accessible.
Built for offline:
• CouchDB enables applications to store collected data locally on
mobile devices and browsers, then synchronizes that data once it is
back online.
Efficient document storage:
• In CouchDB, documents are the primary units of data used in JSON,
composed of various fields and attachments for easy storage.
• There is no limit to the text size or element count of each document, and
data can be accessed and updated from multiple database sources and
across globally distributed server-clusters.
Compatibility:
• CouchDB was written in Erlang (a general-purpose, concurrent, garbage-
collected programming language and runtime system) making it both
reliable and easy to work with for developers.
• Because of its open source capabilities, CouchDB is extremely flexible and
can be installed and run on various operating systems
and virtualization tools. It also compatible with PouchDB, a lightweight
database designed to run in browser of mobile devices.
ACID Properties:
• The CouchDB file layout follows all the features of ACID properties.
Once the data is entered in to the disc, it will not be overwritten.
• Document updates (add, edit, delete) follow Atomicity, i.e., they will
be saved completely or not saved at all.
• The database will not have any partially saved or edited documents.
Almost all of these update are serialized and any number of clients
can read a document without waiting and without being interrupted.
There are four different CouchDB connectivity:
1. Java CouchDB
2. PHP CouchDB
3. Python CouchDB
4. Node.js CouchDB

We will discuss Python CouchDB in detail with an example.


Python CouchDB Connectivity:
To connect with CouchDB by using the Python. We must have the
following packages installed.
• Python interpreter
• CouchDB database
• python-couchdb driver
We are executing this example in Linux (Ubuntu 16.04). this example
includes the following steps.
1) Install python-couchdb driver
# pip install couchdb
2) Start MongoDB Service
# service couchdb start

3) Create a Python Script


# vi python-couch-connectivity.py
// python-couch-connectivity.py
import couchdb # importing couchdb
# Connecting with couchdb Server
couch = couchdb.Server()
# Creating Database
db = couch.create('javatpoint')
print("Database created");
# Creating document
doc = {'name':'Employee'}
db.save(doc) # Saving document
print("Document created")
# Fetching document from the database
print("Name is: "+doc['name'])
4) Access CouchDB
Follow this URL http://localhost:5984/_utils to access the database on
localhost.
5) Execute Python Script
# python python-couch-connectivity.py

6) Access Created Database.


The values are stored.
BENEFITS:
Scalability:
• CouchDB supports both horizontal partitioning and replication to
create an easily managed solution for balancing both read and write
loads during a database deployment.
No read locks:
• In most relational databases—where data is stored in tables—if you
ever need to update or modify a table, the row of data being changed
becomes locked to other users until the modification request is
processed. This can create accessibility issues for clients and overall
bottlenecks in your data management processes.
• CouchDB uses MVCC (Multi-Version Concurrency Control) to manage
access to databases concurrently.

Open source development:


• Because of its strong backing and support in the open source
community, CouchDB maintains a strong, reliable foundation for
enterprise database management.
DRAWBACKS:
The data is in JSON:
• Which means that documents are quite large (BigData, network
bandwidth, speed), and having descriptive key names actually hurts,
since they add up to the document size.
It doesn't support transactions:
• It means that enforcing uniqueness of one field across all documents is
not safe, for example, enforcing that a username is unique.
• Another consequence of CouchDB's inability to support the typical notion
of a transaction is that things like inc/decrementing a value and saving it
back are also dangerous. There aren't many instances that we would
want to simply inc/decrement some value where we couldn't just store
the individual documents separately and aggregate them with a view.
Relational data:
• If the data makes a lot of sense to be in 3rd normal form, and we try to
follow that form in CouchDB, we are going to run into a lot of trouble. A
possible way to solve this problem is with view collations, but we might
constantly going to be fighting with the system. If the data can be
reformatted to be much more denormalized, then CouchDB will work
fine.
Data warehouse:
• The problem with this is that temporary views in CouchDB on large
datasets are really slow. Using CouchDB and permanent views could
work quite well. However, in most of cases, a Column-Oriented Database
of some sort is a much better tool for the data warehousing job.
NoSQL DBs that are written in Erlang (CouchDB) are the best, since
Erlang is meant for distributed systems.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy