couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Gonzalez <gonva...@gonvaled.com>
Subject Configuring a second couchdb instance in a debian-based system
Date Wed, 19 Mar 2014 06:51:35 GMT
Hi all,

(My system is CrunchBang waldorf, debian-based)

Currently I have one couchdb instance, and I want to setup a second
couchdb2 with very similar configuration.

Second instance requirements:
- it can be managed like the main one, just by doing /etc/init.d/couchdb2
start|stop|restart|status
- it will start automatically with system reboot
- it will not conflict in any way with the main instance: databases, views,
logs & pid files
- it will run in a different port 5985/6985 vs 5984/6984 (for http/https)

This is the shell script that I plan to use to prepare the configuration of
couchdb2, starting from the current setup for the main couchdb instance:

#!/bin/bash

# Copy the config files
cd /etc
cp -R couchdb couchdb2
chown -R couchdb:couchdb couchdb2

# Change the config files for couchdb2: make sure both servers are not
sharing databases/views/logfiles
cd /etc/couchdb2
cat <<EOF > /tmp/sedfile
s!/var/lib/couchdb/!/var/lib/couchdb2/!g
s!/var/log/couchdb/!/var/log/couchdb2/!g
s!^port = 5984!port = 5985!
s!^port = 6984!port = 6985!
s!/var/run/couchdb/!/var/run/couchdb2/!
EOF
sed -f /tmp/sedfile default.ini > /etc/couchdb2/default.ini
mkdir /var/log/couchdb2 ; chown -R couchdb:couchdb /var/log/couchdb2
mkdir /var/run/couchdb2 ; chown -R couchdb:couchdb /var/run/couchdb2
mkdir -p /var/lib/couchdb2/1.2.0 ; chown -R couchdb:couchdb
/var/lib/couchdb2

# The startup file has some hard-coded values which need to be changed
cat <<EOF > /tmp/sedfile
s!^RUN_DIR=/var/run/couchdb!RUN_DIR=/var/run/couchdb2!
EOF
sed -f /tmp/sedfile /etc/init.d/couchdb > /etc/init.d/couchdb2

rm /tmp/sedfile

(the script is untested, so it may contain bugs, but you get the idea)

But I do not know how to tell /etc/init.d/couchdb2 to use my config files
for couchdb2.

This is the command which is running couchdb, and which I want to replicate
for couchdb2:
/bin/sh -e /usr/bin/couchdb -a /etc/couchdb/default.ini -a
/etc/couchdb/local.ini -b -r 5 -p /var/run/couchdb/couchdb.pid -o /dev/null
-e /dev/null -R

Ideally I would get:
/bin/sh -e /usr/bin/couchdb -a /etc/couchdb2/default.ini -a
/etc/couchdb2/local.ini -b -r 5 -p /var/run/couchdb2/couchdb.pid -o
/dev/null -e /dev/null -R

But I do not know where some of the flags are set:
-a /etc/couchdb2/default.ini
-a /etc/couchdb2/local.ini
-p /var/run/couchdb2/couchdb.pid

So my question is: where do I set those flags? They are not set in
/etc/init.d/couchdb!

Thanks!
Daniel Gonzalez

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message