CouchDB is distributed, NoSQL database which means that it is very good at scaling up to handle huge quantities of data by simply adding more machines to your database. CouchDB can transparently handle scaling out your database across multiple machines, or you can define specifically how it should distribute your data.
The best scenario when you want to use CouchDB in your environment is:
- Have a relatively simple data structure not focused on creating unique records
- Have flexible data that might not follow a particular structure in all cases
- Have the need to work with huge amounts of data that needs to be inserted quickly
Before you start the installation make sure that you have installed curl. This is one of the way to talk to the CouchDB, it is a command line utility that gives you control over raw HTTP requests and you can see right away what is happening in your CouchDB.
sudo apt-get update sudo apt-get install curl sudo apt-get install couchdb
These command will update system, install curl in case your do not have it and of course install the CouchDB database on your machine. To check and confirm that CouchDB is installed on your system you will need to run this command in terminal
You should see the confirmation message as it is shown in the picture.
To access the CouchDB via GUI we can use utility called Futon which is part of the CouchDB installation. Open your browser and enter this: localhost:5984/_utils – and you should see now graphical interface for CouchDB.
As a first thing you should change the ADMIN credentials as for now – everyone is admin 🙂 – go to the left down corner and click on Fix This to make the changes.
Here are some CLI example to work with your CouchDB:
# List of all databases curl -X GET localhost:5984/_all_dbs # Create database mytestdb (it has to be lowercase ONLY) curl -X PUT localhost:5984/mytestdb # Delete database mytestdb curl -X DELETE localhost:5984/mytestdb # Retrieve information about database mytestdb curl localhost:5984/mytestdb # Get server information curl localhost:5984 # See current configuration curl localhost:5984/_config
Here is good reference on CouchDB:
curl -X GET localhost:5984/mytestdb/_all_docs?include_docs=true > MyDBBackup.txt
Here is some projects on Github with backup tools for CouchDB:
The one like most comes with 2 scripts – backup.sh and restore.sh – you can grab the project from here on GitHub