Difference between revisions of "Couchdb"

From ArchWiki
Jump to: navigation, search
(Started a couchdb page, finishing up couchdb book this weekend and will more detail (if someone else doesn't first))
 
(Blurb on how to test to see if CouchDB is running properly. Mention of bind_address = 0.0.0.0 because this is a common request after setting up couch.)
(16 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 +
[[Category:Database management systems]]
 +
''"Apache CouchDB is a document-oriented database that can be queried and indexed in a MapReduce fashion using JavaScript."'' - [http://couchdb.apache.org/ CouchDB homepage]
 +
 
== Installation ==
 
== Installation ==
  
Install the Couchdb package:
+
Install the {{Pkg|couchdb}} package:
 
  # pacman -S couchdb
 
  # pacman -S couchdb
 +
 +
By default, the package depends on a version of {{Pkg|erlang}} including GTK. The {{Pkg|erlang-nox}} package satisfies the requirements without GTK
 +
# pacman -S erlang-nox couchdb
  
 
== Running ==
 
== Running ==
  
 
Start Couch
 
Start Couch
  # rc.d start couchdb
+
  # systemctl start couchdb
  
 +
To launch on startup, enable it:
 +
 +
# systemctl enable couchdb
 +
 +
Test to see if the service is running by doing "curl -XGET http://127.0.0.1:5984/". Ping will not work (it's not supposed to unlike on other systems where it does).  Note that in order to access this instance of CouchDB from another system you'll need to configure it (see below).
  
To launch on startup add to it to your daemons array in /etc/rc.conf
 
  
DAEMONS=(syslog-ng network netfs crond sshd httpd couchdb)
 
  
 
== Using Futon ==
 
== Using Futon ==
Line 18: Line 27:
 
You can now access the Futon admin interface by going to [http://localhost:5984/_utils http://localhost:5984/_utils]
 
You can now access the Futon admin interface by going to [http://localhost:5984/_utils http://localhost:5984/_utils]
  
 +
== Configuring ==
 +
 +
Change the default port, bind address (set to 0.0.0.0 to access CouchDB from any computer other than local), log-level and other useful nuggets in {{ic|/etc/couchdb/local.ini}}.
 +
 +
If you want to run CouchDB on port 80 you will have to run the daemon as root or use an iptables rule such as:
 +
 +
  iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 5984
 +
 +
'''Note:''' Do not modify {{ic|/etc/couchdb/default.ini}} as it gets overwritten whenever couchdb is updated, copy any values you would like to change and put them in your local.ini. Also be sure to restart couchdb after changes to this file.
 +
 +
If you would like to use ssl with a self-signed certificate you can create one like this:
 +
 +
  # cd /etc/couchdb
 +
  # openssl genrsa -des3 -out server.key 1024
 +
  # openssl req -new -key server.key -out server.csr
 +
  # cp server.key server.key.org
 +
  # openssl rsa -in server.key.org -out server.key
 +
  # openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
 +
 +
Then uncomment httpsd and update the path in the '''[ssl]''' section
 +
 +
  [daemons]
 +
  httpsd = {couch_httpd, start_link, [https]}
 +
 +
  [ssl]
 +
  cert_file = /etc/couchdb/server.crt
 +
  key_file = /etc/couchdb/server.key
 +
 +
Futon can be accessed over ssl on port 5984 via https://localhost:5984/_utils/
 +
 +
Admin users can be created in your {{ic|local.ini}} file. Add the username and password in plaintext, next time couch is restarted it will hash the password. See [http://lizconlan.github.com/sandbox/securing-couchdb.html create a read-only database] for locking down databases and further security.
 +
 
 +
  [admins]
 +
  admin = magicalunicorns
  
 
== More Resources ==
 
== More Resources ==
* http://wiki.apache.org/couchdb/FrontPage
+
 
 +
* [http://couchdb.apache.org/ Official CouchDB page]
 +
* [http://wiki.apache.org/couchdb/FrontPage CouchDB Wiki]
 
* [http://guide.couchdb.org/ CouchDB - The Definitive Guide]
 
* [http://guide.couchdb.org/ CouchDB - The Definitive Guide]
* http://couchdb.apache.org/
 
 
* [http://lizconlan.github.com/sandbox/securing-couchdb.html create a read-only database]
 
* [http://lizconlan.github.com/sandbox/securing-couchdb.html create a read-only database]

Revision as of 18:10, 18 June 2013

"Apache CouchDB is a document-oriented database that can be queried and indexed in a MapReduce fashion using JavaScript." - CouchDB homepage

Installation

Install the couchdb package:

# pacman -S couchdb

By default, the package depends on a version of erlang including GTK. The erlang-nox package satisfies the requirements without GTK

# pacman -S erlang-nox couchdb

Running

Start Couch

# systemctl start couchdb

To launch on startup, enable it:

# systemctl enable couchdb

Test to see if the service is running by doing "curl -XGET http://127.0.0.1:5984/". Ping will not work (it's not supposed to unlike on other systems where it does). Note that in order to access this instance of CouchDB from another system you'll need to configure it (see below).


Using Futon

You can now access the Futon admin interface by going to http://localhost:5984/_utils

Configuring

Change the default port, bind address (set to 0.0.0.0 to access CouchDB from any computer other than local), log-level and other useful nuggets in /etc/couchdb/local.ini.

If you want to run CouchDB on port 80 you will have to run the daemon as root or use an iptables rule such as:

  iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 5984

Note: Do not modify /etc/couchdb/default.ini as it gets overwritten whenever couchdb is updated, copy any values you would like to change and put them in your local.ini. Also be sure to restart couchdb after changes to this file.

If you would like to use ssl with a self-signed certificate you can create one like this:

 # cd /etc/couchdb
 # openssl genrsa -des3 -out server.key 1024
 # openssl req -new -key server.key -out server.csr
 # cp server.key server.key.org
 # openssl rsa -in server.key.org -out server.key
 # openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Then uncomment httpsd and update the path in the [ssl] section

 [daemons]
 httpsd = {couch_httpd, start_link, [https]}
 [ssl]
 cert_file = /etc/couchdb/server.crt
 key_file = /etc/couchdb/server.key

Futon can be accessed over ssl on port 5984 via https://localhost:5984/_utils/

Admin users can be created in your local.ini file. Add the username and password in plaintext, next time couch is restarted it will hash the password. See create a read-only database for locking down databases and further security.

 [admins]
 admin = magicalunicorns

More Resources