CouchDB might be your best option when creating a custom app or service that requires a simple, scalable database. Find out how to install this NoSQL database on CentOS 7.
CouchDB is unlike a relational database, in that each database is a collection of independent documents with each document maintaining its own data and self-contained schema. Because of its outstanding replication and synchronization capabilities, CouchDB makes an ideal database for mobile device apps and similar service-based needs. This NoSQL database is also perfectly suited for applications with accumulating data (where versioning is key), such as CRM and CMS systems.
SEE: Hiring kit: Database administrator (Tech Pro Research)
I want to walk you through the process of installing CouchDB on CentOS 7.
What you need
The only things you need to make this work is a running instance of CentOS 7 and a user account with sudo privileges.
The first thing you need to do is to install the database. Before you do that, you must install the necessary repository. You will also need to install the epel-release repository (to pick up a few dependencies), which can be done with the command:
sudo yum install epel-release -y
When that completes, it's time to add the CouchDB repository. Issue the following command to create the necessary file:
sudo nano /etc/yum.repos.d/bintray-apache-couchdb-rpm.repo
In this new file, paste the following:
[bintray--apache-couchdb-rpm] name=bintray--apache-couchdb-rpm baseurl=http://apache.bintray.com/couchdb-rpm/el$releasever/$basearch/ gpgcheck=0 repo_gpgcheck=0 enabled=1
Save and close that file. Now you can install CouchDB with the following command:
sudo yum install couchdb -y
When that completes, start and enable the database service with the commands:
sudo systemctl start couchdb sudo systemctl enable couchdb
There are two basic configurations to do both of which are taken care of in the same config file. In your terminal window, issue the command:
sudo nano /opt/couchdb/etc/local.ini
In that file, look for the [chttpd] section (Figure A). By default CouchDB only listens to localhost, so you cannot connect to the database from any machine that is not the host. Change the line:
;bind_address = 127.0.0.1
bind_address = 0.0.0.0
Next scroll to the bottom of the file and look for the [admins] section. Here you want to define the admin user password like so:
admin = PASSWORD
where PASSWORD is a strong, unique password (Figure B).
Save and close that file. To hash the newly added password, restart the CouchDB service with the command:
sudo systemctl restart couchdb
Testing the connection
There are two ways to test your newly installed CouchDB system. The first is using the curl command like so:
where SERVER_IP is the IP address of the CouchDB server. You should see a Welcome message that includes the CouchDB version number and a few more bits of information (Figure C).
The web interface
Thanks to Fauxton, CouchDB includes a handy web-based interface. Point your browser to http://SERVER_IP:5984/_utils/ (where SERVER_IP is the IP address of your hosting server) and log in with the user admin and the password you set in the configuration file. Once logged in, you can start creating databases and documents (Figure D).
And that's all there is to installing and configuring the CouchDB database on your CentOS 7 data center server. This new NoSQL database is ready for use in whatever manner is necessary for your business. Next time we visit CouchDB, we'll start creating databases with both the command line and the web interface.
- How to set, change, and recover a MySQL root password (TechRepublic)
- How to create tables and add data to MySQL database with MySQL Workbench (TechRepublic)
- How to use WHERE statements in MySQL (TechRepublic)
- How to add data into MySQL tables from the command line (TechRepublic)
- Hyperconverged infrastructure: A cheat sheet (TechRepublic)
- 10 things companies are keeping in their own data centers (TechRepublic download)
- How hyperscale data centers are reshaping all of IT (ZDNet)
- Best cloud services for small businesses (CNET)
- DevOps: More must-read coverage (TechRepublic on Flipboard)