Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Installing and conguring CouchDB My Life With Pi

08/02/13

My Life With Pi
Living and Working with Raspberry Pi's

Buy It

Build it

Configure it

Use it

Program it

Installing and configuring CouchDB

Search
Search

CouchDB is a database that uses JSON for documents, JavaScript for MapReduce
queries, and regular HTTP for an API
UPDATE: See the addendum at the bottom of the page for a full update of how to get
couchdb running after reboot. You still need to follow these instructions, then pop down

Recent Posts

the bottom for final piece of the puzzle

Monitoring the super computer with


Nagios Part 2: Adding More Hosts

I struggled with this several times, until a colleague of mine called Stephen Lock

Why oh Why do I use RS

showed me the light, so shout out to him for showing me how to make it work post

Configuring Eclipse to run MPI4PY

install.
sudo apt-get install couchdb

Parallel Programming with Python


The Basics
Pi Back !!!

UPDATE: The latest version no longer fails and you end up with the last view lines of
you console looking like
[ ok ] Starting database server: couchdb.
Setting up wwwconfig-common (0.2.2) ...
Setting up javascript-common (7) ...
Setting up libsctp1 (1.0.11+dfsg-2) ...
Setting up lksctp-tools (1.0.11+dfsg-2) ...
Processing triggers for menu ...

If you do get an error, then its probably the problem reported in at the bottom of this
blog, but now we can just continue by making sure couch is binding to the correct IP
address so we can connect to it from another machine
cd /etc/couchdb
sudo vi local.ini

To change the bind_address to the address of the machine you are installing on, look
for the following line
;bind_address = 127.0.0.1

Remove the ; from the beginning and then change the ip address to the address of the
server on which couch is installed. Finall restart the couchdb service
/etc/init.d/couchdb restart

This time youll see the following line which signifies Couch is up and running
[ ok ] Starting database server: couchdb.

Recent Comments
Jon "maddog" Hall on Building Colossus
II ?
Parallel Programming with Python - The
Basics My Life With Pi on Parallel
Programming in Python
keith on Parallel Processing on a Pi
it works !
apaik on Parallel Processing on a Pi
it works !
Tobias on Installing and configuring
CouchDB

Archives
January 2013
October 2012
September 2012
August 2012

Categories
Configuration
Development
Hardware/Peripherals

To check its all working, open a browser and enter the url http://hostname:5984 and
youll see a single line of text along the lines of

Learning
Python

{"couchdb":"Welcome","version":"1.2.0"}

We can then bring up the admin console by entering in a browser, the url

http://www.myraspberrypi.info/?p=315

Raspberry Pi
Super Computer

1/4

Installing and conguring CouchDB My Life With Pi

08/02/13

http://hostname:5984/_utils which will show something like this

Uncategorized

If install fails

Unrelated

When this is finished it will probably report an error that it couldnt start couch. Typically
the install will finish with the following lines

Blogroll

[....] Starting database server: couchdbApache CouchDB needs write permissionKeith


on the
PID file: /var/run/couchdb/couchdb
Sterling
failed!
Raspberrypi.org
invoke-rc.d: initscript couchdb, action "start" failed.
dpkg: error processing couchdb (--configure):
RPi Hub
subprocess installed post-installation script returned error exit status 1
Setting up libsctp1 (1.0.11+dfsg-2) ...
Setting up lksctp-tools (1.0.11+dfsg-2) ...
News from Raspberry Pi
Processing triggers for menu ...
Errors were encountered while processing:
couchdb
Raspberry Pi camera module sneak
E: Sub-process /usr/bin/dpkg returned an error code (1)
peek, and Model A unboxing

Model A now for sale in Europe buy


one today!

Dont panic !, we just need to do some jiggery-pokery to set the permissions and ip
addresses that couch uses. First we need to make sure that couch owns the right
folders which are not set correctly during install

MagPi issue 9
New York Times article and video
Red Pi at night

sudo chown couchdb:couchdb -R /var/lib/couchdb /var/log/couchdb /var/run/couchdb


sudo update-rc.d couchdb defaults
No Starch Press discounts for Pi users

(now 40% off see below for update)

Then we need to make sure couch is binding to the correct IP address so we can
connect to it from another machine
cd /etc/couchdb
sudo vi local.ini

Computer Science added to EBacc


Voyage: an interactive art installation
Introducing a new(ish) face
15,000 Raspberry Pis for UK schools
thanks Google!

To change the bind_address to the address of the machine you are installing on, look
for the following line
;bind_address = 127.0.0.1

Remove the ; from the beginning and then change the ip address to the address of the
server on which couch is installed. Finall restart the couchdb service
/etc/init.d/couchdb start

This time youll see the following line which signifies Couch is up and running
[ ok ] Starting database server: couchdb.

To check its all working, open a browser and enter the url http://hostname:5984 and
youll see a single line of text along the lines of
{"couchdb":"Welcome","version":"1.2.0"}

We can then bring up the admin console by entering in a browser, the url
http://hostname:5984/_utils which will show something like this

http://www.myraspberrypi.info/?p=315

2/4

Installing and conguring CouchDB My Life With Pi

08/02/13

Addendum
Ive had problems with couchdb starting because of permissions and searching the
internet shows this to be a common bug with the current version and is because
/var/run/couchdb has its permissions set back to root after reboot. The easiet way to fix
this for now is to modiy rc.local and make it reset the permissions on startup
sudo vi /etc/init.d/couchdb

And look for the method that starts with the following at about line 84
start_couchdb () {

Add a new line after mkdir -P $RUN_DIR


and add the following
start_couchdb () {
# Start Apache CouchDB as a background process.
mkdir -P "$RUN_DIR"
#Add this line
chown couchdb:couchdb -R "$RUN_DIR"
command="$COUCHDB -b"

Category: Configuration, Development

October 13, 2012 at 1:40 pm

2 comments

keith

2 Responses
Lu says:
Thanks, it works. You may could add a hint after /etc/init.d/couchdb start pointing to
the Addendum.
Great blog
October 22, 2012 at 6:51 pm

Reply

Tobias says:
You can also put the permission fixing in /etc/default/couchdb by adding these lines to

http://www.myraspberrypi.info/?p=315

3/4

Installing and conguring CouchDB My Life With Pi

08/02/13

that file:
mkdir -p $RUN_DIR
chown couchdb $RUN_DIR -R
December 1, 2012 at 1:43 pm

Reply

Leave a Comment
Your email address will not be published. Required fields are marked *

Name *

Email *

Website

Comment

Send Comment

Notify me of follow-up comments by email.


Notify me of new posts by email.
Proudly powered by WordPress. Design by WPlook

http://www.myraspberrypi.info/?p=315

4/4

You might also like