In part I post, I explained step by step how to install CouchDB in your machine and how to use it. in this post we will go over a little bit further to find out how we can use the couchDB to do what we really need in Clustering environment. for example how to modify the Local.ini and default.ini files to get what we want to.
after you install a fresh copy of the couchdb database. you can modify and adjust the configuration to make that enable to work on a seperate machine and let the other applications communicate with it over HTTP or HTTPS. in this post we will focus over the HTTP communication only.
get the couchdb configuration files’ location from command line.
below will be the result
then you can use VI and also using the sudo since it needs root access; then modify below parts in these files to make sure it can be redeuce the security and allow others to communiate with this DB for now.
make a backup and modify the local.ini file for accepting all the traffic and make sure couchDB service can listen to traffics from all IP addresses. NOTE: if you have any specifiv IP address you can just add that expcept 0.0.0.0
sudo cp /etc/couchdb/local.ini /etc/couchdb/local.ini_bak
then edit the file with your favorit text editor.
sudo vi /etc/couchdb/local.ini
or using gedit
sudo gedit /etc/couchdb/local.ini
look for a section that has the
;bind_address = 127.0.0.1
and change that to
bind_address = 0.0.0.0
then restart the couchdb service
sudo service couchdb restart
then try with your IP address, you can use ifconfig to find your ip address for example mine is something like
curl -k http://10.0.2.15:5984
and the result will be the same as part 1 with a JSOn representation of a greeting message. now you have a functioning running Couchdb.
NOTE: right now everyone can do everything in that couchdb so for further security you need to modify the local.ini or default.ini with the proper admin account and password, the password will entered as cleartext however it will get encrypted in the file after save so no worries with that.