The final step in the installation of CouchDB is to integrate it into Solaris’ Service Management Facility (smf).

First we will create a user couchdb who is used to run the database. Furthermore we have to modify some user-permissions of the CouchDB folders.

root@test:~# mkdir -p /export/home
root@test:~# useradd -d /export/home/couchdb -s /usr/bin/false -m couchdb
root@test:~# groupadd couchdb
root@test:~# usermod -g couchdb couchdb
root@test:~# chown -R couchdb:couchdb /opt/local/var/run/couchdb
root@test:~# chown -R couchdb:couchdb /opt/local/var/log/couchdb
root@test:~# chown -R couchdb:couchdb /opt/local/var/lib/couchdb

Now we can add CouchDB to the SMF, which requires a XML config file with the description of the CouchDB service.
The required file can be found here:
couchdb-smf.xml

root@test:~# wget http://www.dev-eth0.de/wp-content/uploads/2011/07/couchdb-smf.xml
--2011-07-31 18:21:09--  http://www.dev-eth0.de/wp-content/uploads/2011/07/couchdb-smf.xml
Connecting to www.dev-eth0.de|87.238.193.118|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1913 (1.9K) [application/xml]
Saving to: `couchdb-smf.xml'

100%[======================================================================>] 1,913       --.-K/s   in 0s

2011-07-31 18:21:09 (87.6 MB/s) - `couchdb-smf.xml' saved [1913/1913]

root@test:~# svccfg import -V couchdb-smf.xml

Now we have installed CouchDB as a Solaris Service and can start and stop it with the svcadm command and check it’s status with svcs.

Commands:

svcadm enable couchdb
svcadm disable couchdb

The following commands will start CouchDB and check if everything is ok and running.

root@test:~# svcadm enable couchdb
root@test:~# svcs -x couchdb
svc:/application/database/couchdb:couchdb (Apache CouchDB)
 State: online since Sun Jul 31 18:24:48 2011
   See: http://couchdb.apache.org/
   See: /var/svc/log/application-database-couchdb:couchdb.log
Impact: None.

Now it’s time to test if we can connect to our CouchDB:

root@test:~# curl http://localhost:5984
{"couchdb":"Welcome","version":"1.1.0"}

You can find all logs of CouchDB in /opt/local/var/log/couchdb.


Related Posts



Eine Antwort schreiben