You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Michael McDaniel <co...@autosys.us> on 2009/10/24 03:19:27 UTC

[long] multiple couchdb invocations, single machine

 SHORT VERSION:  

   Multiple couchdb invocations on a single machine are not
   behaving as I would expect to isolate databases.

   Does someone have a tested configuration they will share ?



 LONG VERSION:

 I have installed 

   couchdb - Apache CouchDB 0.11.0b828784

 and am trying to do what I thought would be simple.

 Run two independent invocations of couchdb on the same machine.
 With the expectation that by running separate invocations, I
 could keep respective databases isolated from each.


 Here's what I want

  * one invocation on default port 5984   (let's call this one PAT)
  * other invocation on non-default port 5985 (let's call this one MIKE)
  * PAT should not see or have access to MIKE databases
  * MIKE should not see or have access to PAT databases
  * PAT can hang with no effect on MIKE
  * MIKE can hang and have no effect on PAT
  * long running events on either have no effect on the other

 Here's what I tried (all pertinent directories and files are created with
 rw permissions to invoking user).  default.ini is as created by couchdb
 build/install.
---

 Added the following to /usr/local/etc/couchdb/local.ini

[couchdb]

database_dir   = /usr/local/var/lib/couchdb_pat
view_index_dir = /usr/local/var/lib/couchdb_pat

[log]
file = /home/erl/couchdb/logs/couch_pat.log
level = info
---

 Added the following to  /usr/local/etc/couchdb/mike/local_mike.ini

[couchdb]
database_dir   = /usr/local/var/lib/couchdb_mike
view_index_dir = /usr/local/var/lib/couchdb_mike


[log]
file = /home/erl/couchdb/logs/couch_mike.log
level = info

[httpd]
port = 5985
---

  start PAT with
couchdb  -b  -p  /usr/local/var/run/couchdb_pat.pid        \
             -o  /home/erl/couchdb/logs/couchdb_pat.stdout \
             -e  /home/erl/couchdb/logs/couchdb_pat.stderr
---

  start MIKE with
couchdb  -b  -p  /usr/local/var/run/couchdb_mike.pid        \
             -a  /usr/local/etc/couchdb/mike/local_mike.ini \
             -o /home/erl/couchdb/logs/couchdb_mike.stdout  \
             -e /home/erl/couchdb/logs/couchdb_mike.stderr
---


 NOW, in Futon, for PAT http://localhost:5984/_utils/config.html


   database_dir       /usr/local/var/lib/couchdb
   database_dir       /usr/local/var/lib/couchdb_pat
   view_index_dir     /usr/local/var/lib/couchdb_pat

 AND, for MIKE http://localhost:5985/_utils/config.html

   database_dir       /usr/local/var/lib/couchdb
   database_dir       /usr/local/var/lib/couchdb_pat
   view_index_dir     /usr/local/var/lib/couchdb_pat


 BUT ... both show all the databases already existing in the default
 /usr/local/var/lib/couchdb directory.


 AND

 If I create a new database from either PAT or MIKE URI
   http://localhost:5984/_utils/index.html
   http://localhost:5985/_utils/index.html

 the new database winds up in the /usr/local/var/lib/couchdb
 directory (and, as previously mentioned, either invocation
 of couchdb can see all of the databases there).
 

 If I comment out database_dir and view_index_dir in default.ini
 then both invocations see the databases (in Futon Overview) as,
 e.g.

    couchdb/foo_db
    couchdb/bar_db

 Although each Futon Configuration shows only the respective
  database_dir    /usr/local/var/lib/couchdb_pat
  view_index_dir  /usr/local/var/lib/couchdb_pat

  database_dir    /usr/local/var/lib/couchdb_mike
  view_index_dir  /usr/local/var/lib/couchdb_mike
 .


 Logs are getting written per respective PAT and MIKE local ini files.


 QUESTION:

  How do I run more than one invocation of couchdb on a single machine
  with database and process isolation ?


~Michael

Re: [long] multiple couchdb invocations, single machine

Posted by Michael McDaniel <co...@autosys.us>.
On Fri, Oct 23, 2009 at 08:44:24PM -0700, Chris Anderson wrote:
> On Fri, Oct 23, 2009 at 7:42 PM, Paul Davis <pa...@gmail.com> wrote:
> > You could also set the log level to debug and start each without -b to
> > see what config files are being read.
> >
> 
> We have this use case working for couch.io's hosting, but we haven't
> upgraded to 0.11. Anyway, it's been known to work in the past. Keep
> digging and we'll help.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  Chris, this answers a question in my just-prior email.  That is
  good to know that you have it running on a prior couchdb version.

  Please send the configuration or whatever portion is deemed 
  non-proprietary.

~M

> 
> Chris
> 
> > Paul Davis
> >
> > On Fri, Oct 23, 2009 at 10:25 PM, Chris Stockton
> > <ch...@gmail.com> wrote:
> >> I would try starting them with strace -f and see what ini files they are
> >> reading and look for other clues.
> >>
> >> On Oct 23, 2009 6:19 PM, "Michael McDaniel" <co...@autosys.us> wrote:
> >>
> >>
> >>  SHORT VERSION:
> >>
> >>  Multiple couchdb invocations on a single machine are not
> >>  behaving as I would expect to isolate databases.
> >>
> >>  Does someone have a tested configuration they will share ?
> >>
> >>
> >>
> >>  LONG VERSION:
> >>
> >>  I have installed
> >>
> >>  couchdb - Apache CouchDB 0.11.0b828784
> >>
> >>  and am trying to do what I thought would be simple.
> >>
> >>  Run two independent invocations of couchdb on the same machine.
> >>  With the expectation that by running separate invocations, I
> >>  could keep respective databases isolated from each.
> >>
> >>
> >>  Here's what I want
> >>
> >>  * one invocation on default port 5984   (let's call this one PAT)
> >>  * other invocation on non-default port 5985 (let's call this one MIKE)
> >>  * PAT should not see or have access to MIKE databases
> >>  * MIKE should not see or have access to PAT databases
> >>  * PAT can hang with no effect on MIKE
> >>  * MIKE can hang and have no effect on PAT
> >>  * long running events on either have no effect on the other
> >>
> >>  Here's what I tried (all pertinent directories and files are created with
> >>  rw permissions to invoking user).  default.ini is as created by couchdb
> >>  build/install.
> >> ---
> >>
> >>  Added the following to /usr/local/etc/couchdb/local.ini
> >>
> >> [couchdb]
> >>
> >> database_dir   = /usr/local/var/lib/couchdb_pat
> >> view_index_dir = /usr/local/var/lib/couchdb_pat
> >>
> >> [log]
> >> file = /home/erl/couchdb/logs/couch_pat.log
> >> level = info
> >> ---
> >>
> >>  Added the following to  /usr/local/etc/couchdb/mike/local_mike.ini
> >>
> >> [couchdb]
> >> database_dir   = /usr/local/var/lib/couchdb_mike
> >> view_index_dir = /usr/local/var/lib/couchdb_mike
> >>
> >>
> >> [log]
> >> file = /home/erl/couchdb/logs/couch_mike.log
> >> level = info
> >>
> >> [httpd]
> >> port = 5985
> >> ---
> >>
> >>  start PAT with
> >> couchdb  -b  -p  /usr/local/var/run/couchdb_pat.pid        \
> >>            -o  /home/erl/couchdb/logs/couchdb_pat.stdout \
> >>            -e  /home/erl/couchdb/logs/couchdb_pat.stderr
> >> ---
> >>
> >>  start MIKE with
> >> couchdb  -b  -p  /usr/local/var/run/couchdb_mike.pid        \
> >>            -a  /usr/local/etc/couchdb/mike/local_mike.ini \
> >>            -o /home/erl/couchdb/logs/couchdb_mike.stdout  \
> >>            -e /home/erl/couchdb/logs/couchdb_mike.stderr
> >> ---
> >>
> >>
> >>  NOW, in Futon, for PAT http://localhost:5984/_utils/config.html
> >>
> >>
> >>  database_dir       /usr/local/var/lib/couchdb
> >>  database_dir       /usr/local/var/lib/couchdb_pat
> >>  view_index_dir     /usr/local/var/lib/couchdb_pat
> >>
> >>  AND, for MIKE http://localhost:5985/_utils/config.html
> >>
> >>  database_dir       /usr/local/var/lib/couchdb
> >>  database_dir       /usr/local/var/lib/couchdb_pat
> >>  view_index_dir     /usr/local/var/lib/couchdb_pat
> >>
> >>
> >>  BUT ... both show all the databases already existing in the default
> >>  /usr/local/var/lib/couchdb directory.
> >>
> >>
> >>  AND
> >>
> >>  If I create a new database from either PAT or MIKE URI
> >>  http://localhost:5984/_utils/index.html
> >>  http://localhost:5985/_utils/index.html
> >>
> >>  the new database winds up in the /usr/local/var/lib/couchdb
> >>  directory (and, as previously mentioned, either invocation
> >>  of couchdb can see all of the databases there).
> >>
> >>
> >>  If I comment out database_dir and view_index_dir in default.ini
> >>  then both invocations see the databases (in Futon Overview) as,
> >>  e.g.
> >>
> >>   couchdb/foo_db
> >>   couchdb/bar_db
> >>
> >>  Although each Futon Configuration shows only the respective
> >>  database_dir    /usr/local/var/lib/couchdb_pat
> >>  view_index_dir  /usr/local/var/lib/couchdb_pat
> >>
> >>  database_dir    /usr/local/var/lib/couchdb_mike
> >>  view_index_dir  /usr/local/var/lib/couchdb_mike
> >>  .
> >>
> >>
> >>  Logs are getting written per respective PAT and MIKE local ini files.
> >>
> >>
> >>  QUESTION:
> >>
> >>  How do I run more than one invocation of couchdb on a single machine
> >>  with database and process isolation ?
> >>
> >>
> >> ~Michael
> >>
> >
> 
> 
> 
> -- 
> Chris Anderson
> http://jchrisa.net
> http://couch.io

-- 
Michael McDaniel
Portland, Oregon, USA
http://autosys.us
http://trip.autosys.us


Re: [long] multiple couchdb invocations, single machine

Posted by Chris Anderson <jc...@apache.org>.
On Fri, Oct 23, 2009 at 7:42 PM, Paul Davis <pa...@gmail.com> wrote:
> You could also set the log level to debug and start each without -b to
> see what config files are being read.
>

We have this use case working for couch.io's hosting, but we haven't
upgraded to 0.11. Anyway, it's been known to work in the past. Keep
digging and we'll help.

Chris

> Paul Davis
>
> On Fri, Oct 23, 2009 at 10:25 PM, Chris Stockton
> <ch...@gmail.com> wrote:
>> I would try starting them with strace -f and see what ini files they are
>> reading and look for other clues.
>>
>> On Oct 23, 2009 6:19 PM, "Michael McDaniel" <co...@autosys.us> wrote:
>>
>>
>>  SHORT VERSION:
>>
>>  Multiple couchdb invocations on a single machine are not
>>  behaving as I would expect to isolate databases.
>>
>>  Does someone have a tested configuration they will share ?
>>
>>
>>
>>  LONG VERSION:
>>
>>  I have installed
>>
>>  couchdb - Apache CouchDB 0.11.0b828784
>>
>>  and am trying to do what I thought would be simple.
>>
>>  Run two independent invocations of couchdb on the same machine.
>>  With the expectation that by running separate invocations, I
>>  could keep respective databases isolated from each.
>>
>>
>>  Here's what I want
>>
>>  * one invocation on default port 5984   (let's call this one PAT)
>>  * other invocation on non-default port 5985 (let's call this one MIKE)
>>  * PAT should not see or have access to MIKE databases
>>  * MIKE should not see or have access to PAT databases
>>  * PAT can hang with no effect on MIKE
>>  * MIKE can hang and have no effect on PAT
>>  * long running events on either have no effect on the other
>>
>>  Here's what I tried (all pertinent directories and files are created with
>>  rw permissions to invoking user).  default.ini is as created by couchdb
>>  build/install.
>> ---
>>
>>  Added the following to /usr/local/etc/couchdb/local.ini
>>
>> [couchdb]
>>
>> database_dir   = /usr/local/var/lib/couchdb_pat
>> view_index_dir = /usr/local/var/lib/couchdb_pat
>>
>> [log]
>> file = /home/erl/couchdb/logs/couch_pat.log
>> level = info
>> ---
>>
>>  Added the following to  /usr/local/etc/couchdb/mike/local_mike.ini
>>
>> [couchdb]
>> database_dir   = /usr/local/var/lib/couchdb_mike
>> view_index_dir = /usr/local/var/lib/couchdb_mike
>>
>>
>> [log]
>> file = /home/erl/couchdb/logs/couch_mike.log
>> level = info
>>
>> [httpd]
>> port = 5985
>> ---
>>
>>  start PAT with
>> couchdb  -b  -p  /usr/local/var/run/couchdb_pat.pid        \
>>            -o  /home/erl/couchdb/logs/couchdb_pat.stdout \
>>            -e  /home/erl/couchdb/logs/couchdb_pat.stderr
>> ---
>>
>>  start MIKE with
>> couchdb  -b  -p  /usr/local/var/run/couchdb_mike.pid        \
>>            -a  /usr/local/etc/couchdb/mike/local_mike.ini \
>>            -o /home/erl/couchdb/logs/couchdb_mike.stdout  \
>>            -e /home/erl/couchdb/logs/couchdb_mike.stderr
>> ---
>>
>>
>>  NOW, in Futon, for PAT http://localhost:5984/_utils/config.html
>>
>>
>>  database_dir       /usr/local/var/lib/couchdb
>>  database_dir       /usr/local/var/lib/couchdb_pat
>>  view_index_dir     /usr/local/var/lib/couchdb_pat
>>
>>  AND, for MIKE http://localhost:5985/_utils/config.html
>>
>>  database_dir       /usr/local/var/lib/couchdb
>>  database_dir       /usr/local/var/lib/couchdb_pat
>>  view_index_dir     /usr/local/var/lib/couchdb_pat
>>
>>
>>  BUT ... both show all the databases already existing in the default
>>  /usr/local/var/lib/couchdb directory.
>>
>>
>>  AND
>>
>>  If I create a new database from either PAT or MIKE URI
>>  http://localhost:5984/_utils/index.html
>>  http://localhost:5985/_utils/index.html
>>
>>  the new database winds up in the /usr/local/var/lib/couchdb
>>  directory (and, as previously mentioned, either invocation
>>  of couchdb can see all of the databases there).
>>
>>
>>  If I comment out database_dir and view_index_dir in default.ini
>>  then both invocations see the databases (in Futon Overview) as,
>>  e.g.
>>
>>   couchdb/foo_db
>>   couchdb/bar_db
>>
>>  Although each Futon Configuration shows only the respective
>>  database_dir    /usr/local/var/lib/couchdb_pat
>>  view_index_dir  /usr/local/var/lib/couchdb_pat
>>
>>  database_dir    /usr/local/var/lib/couchdb_mike
>>  view_index_dir  /usr/local/var/lib/couchdb_mike
>>  .
>>
>>
>>  Logs are getting written per respective PAT and MIKE local ini files.
>>
>>
>>  QUESTION:
>>
>>  How do I run more than one invocation of couchdb on a single machine
>>  with database and process isolation ?
>>
>>
>> ~Michael
>>
>



-- 
Chris Anderson
http://jchrisa.net
http://couch.io

Re: [long] multiple couchdb invocations, single machine

Posted by Benoit Chesneau <bc...@gmail.com>.
On Fri, Nov 6, 2009 at 5:00 PM, Michael <co...@autosys.us> wrote:
>  Thanks for your additional information, Enda.
>
>  Does everyone who uses this technique have complete database
>  isolation between each invocation ?
>
>  So, if you were to open Futon on one port, you would *only* see
>  the databases for that invocation ?
>
yes

>  And you can run completely independent couchdb tests via each Futon ?
>
>
yes

>  My current configuration is to have my startup script cd into
>  the respective directory, and then everything works (i.e.
>  databases go there, and isolation of databases between invocations
>  as per my above questions).
>
>
>  When I have more time I will remove and reinstall everything and
>  see if it works without having to cd into the respective directories
>  before starting couchdb.  I do not have much motivation to do this
>  because everything is working right now by simply cd'ing to the
>  db before starting couch.  If/when I check it out, I'll let the
>  list know.
>
> ~Michael
>

Youc could also try couchdbproxy which allows you to manage multiple
couchdb node behind one ip/port :

http://github.com/benoitc/couchdbproxy

- benoît

Re: [long] multiple couchdb invocations, single machine

Posted by Michael <co...@autosys.us>.
 Thanks for your additional information, Enda.

 Does everyone who uses this technique have complete database
 isolation between each invocation ?  

 So, if you were to open Futon on one port, you would *only* see
 the databases for that invocation ?  

 And you can run completely independent couchdb tests via each Futon ?


 My current configuration is to have my startup script cd into
 the respective directory, and then everything works (i.e.
 databases go there, and isolation of databases between invocations
 as per my above questions).


 When I have more time I will remove and reinstall everything and
 see if it works without having to cd into the respective directories
 before starting couchdb.  I do not have much motivation to do this
 because everything is working right now by simply cd'ing to the
 db before starting couch.  If/when I check it out, I'll let the
 list know.

~Michael


On Thu, Nov 05, 2009 at 03:03:56PM +0000, Enda Farrell wrote:
> Really sorry to have taken so long to add in a few pointers - been busy.
>
> * We always run 4 nodes/invocations on each machine.
> * We leave the "default.ini" alone.
> * We create 4 separate $PORT.ini files - you MUST give each one their  
> own dir for [couchdb] (you can if you're careful share the logs dir)
> 	[httpd]
> 	port = 5984
> 	bind_address = 0.0.0.0
>
> 	[couchdb]
> 	database_dir = /data/couchdb/5984 ; keep last dir same as port!
> 	view_index_dir = /data/couchdb/5984 ; keep last dir same as port!
> 	[log]
> 	file = /data/app-logs/couchdb/5984.log
> 	level = error
>
> * Our rc.d/couchdb file is not at all like the default. Perhaps one day 
> I'll get the chance to clean it up and publicise it, but at the core 
> there a major change or two:
> 	We bring up and down all 4 at the same time.
> 	When you have many running instances all controlled  by a single rc.d/ 
> couchdb that script needs to know about all 4
> 	Due to the Erlang VM not unhooking properly, we have had to setsid  
> ourselves and bypass the "normal" PID files
> 		setsid $COUCHDB -c $CONF/default.ini -c $CONF/$PORT.ini -o $LOG/ 
> start.$PORT.o.log -e $LOG/start.$PORT.e.log \
>                                         0</dev/null 1>$LOG/start. 
> $PORT.i.log 2>&1 & echo $! > $VR/couchdb.$PORT.pid
> 		$CONF = config dir = the normal one
> 		$PORT = local looping variable in the script
> 		$LOG = log dir - as above in the $PORT.ini
> 		$VR = "normal" var/run dir
> 	Note that you must give separate files for any output - including the  
> pid files.
>
> * We did find that there's code in CouchDB that stomped over the default 
> "couchdb.pid" file which meant servers wouldn't stay up - but by 
> redirecting the output of $! and not using -p you can avoid that.
>
> /e
>
>
> On 24 Oct 2009, at 20:03, Michael McDaniel wrote:
>
>> On Sat, Oct 24, 2009 at 02:49:32PM -0400, Adam Kocoloski wrote:
>>> On Oct 24, 2009, at 2:37 AM, Paul Davis wrote:
>>>
>>>> On Sat, Oct 24, 2009 at 2:26 AM, Michael McDaniel
>>>> <co...@autosys.us> wrote:
>>>>> On Sat, Oct 24, 2009 at 02:18:33AM -0400, Paul Davis wrote:
>>>>>>> And, just now, I realized that it is wanting to create databases
>>>>>>> in whatever directory I start from. (I do not understand why
>>>>>>> it wasn't trying to create them in /usr/local/var/lib but rather
>>>>>>> /usr/local/var/lib/couchdb before).
>>>>>>>
>>>>>>> I start PAT in /usr/local/var/lib/couchdb_pat
>>>>>>> and start
>>>>>>> MIKE in /usr/local/var/lib/couchdb_mike
>>>>>>>
>>>>>>> and I can run separate test suites and create databases with
>>>>>>> each invocation that the other invocation does not see.
>>>>>>>
>>>>>>>
>>>>>>> The trivial workaround to have it function as I want is to
>>>>>>>
>>>>>>> cd path/to/invocation/database/directory && couchdb -n -a ...
>>>>>>>
>>>>>>>
>>>>>>> Of course, not a long-term strategy but will work for now.
>>>>>>
>>>>>> Michael,
>>>>>>
>>>>>> Hmm, you must've uncovered a bug here in the recent boot sequence
>>>>>> updates. You've probably reduced it well enough that we should be
>>>>>> able
>>>>>> to get it fixed though. Thanks for the report.
>>>>>>
>>>>>> Paul Davis
>>>>> ^^ 
>>>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>>>
>>>>> glad it helped, Paul - and thanks for the laugh w/the bug report
>>>>>                       (I still lurk on dev@)
>>>>>
>>>>>
>>>>> I'll grab a new version in a day or few ...
>>>>>
>>>>> ~M
>>>>>
>>>>
>>>> If you're not having fun, you're Doing It Wrong.
>>>
>>> Actually, I'm having trouble reproducing this bug.  I must be missing
>>> something.  All I did was write the config file (this is pat.ini,
>>> mike.ini is analogous)
>>>
>>>> macbook:~ $ cat /usr/local/couchdb/trunk/etc/couchdb/pat.ini
>>>> [couchdb]
>>>> database_dir = /tmp/pat
>>>>
>>>> [log]
>>>> level = debug
>>>>
>>>> [httpd]
>>>> port = 5986
>>>
>>> and start the server
>>>
>>>> macbook:~ $ /usr/local/couchdb/trunk/bin/couchdb -a /usr/local/
>>>> couchdb/trunk/etc/couchdb/pat.ini
>>>> Apache CouchDB 0.11.0b829113 (LogLevel=debug) is starting.
>>>> Configuration Settings ["/usr/local/couchdb/trunk/etc/couchdb/
>>>> default.ini",
>>>>                        "/usr/local/couchdb/trunk/etc/couchdb/
>>>> local.ini",
>>>>                        "/usr/local/couchdb/trunk/etc/couchdb/
>>>> pat.ini"]:
>>> <snip>
>>>>  [couchdb] database_dir="/tmp/pat"
>>>
>>>
>>> and do the same for Mike, and I get the correct behavior -- Pat's  
>>> DBs go
>>> in /tmp/pat, Mike's in /tmp/mike.  I also tried running in the
>>> background,  Nothing that I do seems to trigger this bug.
>>>
>>> I will note, though, that the code which looks up the database_dir  
>>> falls
>>> back to "." if it's not defined (see couch_server:init/1).  So that  
>>> tells
>>> me the config values in Michael's setup aren't accessible to
>>> couch_server.
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>>  Though they show up via Futon config.html
>> ~M
>>
>>>
>>> Michael, can you check one more thing for me -- did you upgrade in  
>>> place
>>> to a newer version of CouchDB?  What are the contents of /usr/
>>> local/lib/couchdb/erlang/lib?  We have a bug we need to fix in trunk
>>> where Couch can accidentally use old versions of modules if they  
>>> show up
>>> in the same directory.  If that happens, well, all bets are off.   
>>> Best,
>>>
>>> Adam
>>>
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>> I do not remember if I upgraded in place.  The fact that my couchdb
>> build directory contains a BUG and bootstrap file from 2009/09/20
>> may indicate that I did layer the newest version over top of my
>> existing couchdb dir contents.  And then
>>  ./bootstrap
>>  make
>>  sudo make install
>>
>>
>> $ ls -rlast /usr/local/lib/couchdb/erlang/lib
>> total 32
>> 4 drwxr-xr-x 3 mmcdanie mmcdanie 4096 2009-02-23 15:52 ..
>> 4 drwxr-xr-x 3 mmcdanie mmcdanie 4096 2009-03-07 01:27 mochiweb-r97
>> 4 drwxr-xr-x 3 root     root     4096 2009-09-20 16:00 ibrowse-1.5.2
>> 4 drwxr-xr-x 3 root     root     4096 2009-09-20 16:00 erlang-oauth
>> 4 drwxr-xr-x 5 root     root     4096 2009-09-20 16:00  
>> couch-0.11.0a817117
>> 4 drwxr-xr-x 5 root     root     4096 2009-10-22 10:00  
>> couch-0.11.0b828784
>> 4 drwxr-xr-x 3 root     root     4096 2009-10-22 10:00 etap
>> 4 drwxr-xr-x 8 mmcdanie mmcdanie 4096 2009-10-22 10:00 .
>>
>>
>>
>> When you start the respective couchdb processes, if you are already
>> in the desired db directory, that is where the db files will be
>> created and read from.
>>
>> To see the problem, I start the processes from any directory other
>> than the respective db directories.
>>
>> My 'couchdb -V' version is the 0.11.0b828784
>>
>> ~M
>
>
> http://www.bbc.co.uk/
> This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
> If you have received it in error, please delete it from your system.
> Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
> Please note that the BBC monitors e-mails sent or received.
> Further communication will signify your consent to this.
> 					

Re: [long] multiple couchdb invocations, single machine

Posted by Enda Farrell <en...@bbc.co.uk>.
Really sorry to have taken so long to add in a few pointers - been busy.

* We always run 4 nodes/invocations on each machine.
* We leave the "default.ini" alone.
* We create 4 separate $PORT.ini files - you MUST give each one their  
own dir for [couchdb] (you can if you're careful share the logs dir)
	[httpd]
	port = 5984
	bind_address = 0.0.0.0

	[couchdb]
	database_dir = /data/couchdb/5984 ; keep last dir same as port!
	view_index_dir = /data/couchdb/5984 ; keep last dir same as port!
	[log]
	file = /data/app-logs/couchdb/5984.log
	level = error

* Our rc.d/couchdb file is not at all like the default. Perhaps one  
day I'll get the chance to clean it up and publicise it, but at the  
core there a major change or two:
	We bring up and down all 4 at the same time.
	When you have many running instances all controlled  by a single rc.d/ 
couchdb that script needs to know about all 4
	Due to the Erlang VM not unhooking properly, we have had to setsid  
ourselves and bypass the "normal" PID files
		setsid $COUCHDB -c $CONF/default.ini -c $CONF/$PORT.ini -o $LOG/ 
start.$PORT.o.log -e $LOG/start.$PORT.e.log \
                                         0</dev/null 1>$LOG/start. 
$PORT.i.log 2>&1 & echo $! > $VR/couchdb.$PORT.pid
		$CONF = config dir = the normal one
		$PORT = local looping variable in the script
		$LOG = log dir - as above in the $PORT.ini
		$VR = "normal" var/run dir
	Note that you must give separate files for any output - including the  
pid files.

* We did find that there's code in CouchDB that stomped over the  
default "couchdb.pid" file which meant servers wouldn't stay up - but  
by redirecting the output of $! and not using -p you can avoid that.

/e


On 24 Oct 2009, at 20:03, Michael McDaniel wrote:

> On Sat, Oct 24, 2009 at 02:49:32PM -0400, Adam Kocoloski wrote:
>> On Oct 24, 2009, at 2:37 AM, Paul Davis wrote:
>>
>>> On Sat, Oct 24, 2009 at 2:26 AM, Michael McDaniel
>>> <co...@autosys.us> wrote:
>>>> On Sat, Oct 24, 2009 at 02:18:33AM -0400, Paul Davis wrote:
>>>>>> And, just now, I realized that it is wanting to create databases
>>>>>> in whatever directory I start from. (I do not understand why
>>>>>> it wasn't trying to create them in /usr/local/var/lib but rather
>>>>>> /usr/local/var/lib/couchdb before).
>>>>>>
>>>>>> I start PAT in /usr/local/var/lib/couchdb_pat
>>>>>> and start
>>>>>> MIKE in /usr/local/var/lib/couchdb_mike
>>>>>>
>>>>>> and I can run separate test suites and create databases with
>>>>>> each invocation that the other invocation does not see.
>>>>>>
>>>>>>
>>>>>> The trivial workaround to have it function as I want is to
>>>>>>
>>>>>> cd path/to/invocation/database/directory && couchdb -n -a ...
>>>>>>
>>>>>>
>>>>>> Of course, not a long-term strategy but will work for now.
>>>>>
>>>>> Michael,
>>>>>
>>>>> Hmm, you must've uncovered a bug here in the recent boot sequence
>>>>> updates. You've probably reduced it well enough that we should be
>>>>> able
>>>>> to get it fixed though. Thanks for the report.
>>>>>
>>>>> Paul Davis
>>>> ^ 
>>>> ^ 
>>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>>
>>>> glad it helped, Paul - and thanks for the laugh w/the bug report
>>>>                       (I still lurk on dev@)
>>>>
>>>>
>>>> I'll grab a new version in a day or few ...
>>>>
>>>> ~M
>>>>
>>>
>>> If you're not having fun, you're Doing It Wrong.
>>
>> Actually, I'm having trouble reproducing this bug.  I must be missing
>> something.  All I did was write the config file (this is pat.ini,
>> mike.ini is analogous)
>>
>>> macbook:~ $ cat /usr/local/couchdb/trunk/etc/couchdb/pat.ini
>>> [couchdb]
>>> database_dir = /tmp/pat
>>>
>>> [log]
>>> level = debug
>>>
>>> [httpd]
>>> port = 5986
>>
>> and start the server
>>
>>> macbook:~ $ /usr/local/couchdb/trunk/bin/couchdb -a /usr/local/
>>> couchdb/trunk/etc/couchdb/pat.ini
>>> Apache CouchDB 0.11.0b829113 (LogLevel=debug) is starting.
>>> Configuration Settings ["/usr/local/couchdb/trunk/etc/couchdb/
>>> default.ini",
>>>                        "/usr/local/couchdb/trunk/etc/couchdb/
>>> local.ini",
>>>                        "/usr/local/couchdb/trunk/etc/couchdb/
>>> pat.ini"]:
>> <snip>
>>>  [couchdb] database_dir="/tmp/pat"
>>
>>
>> and do the same for Mike, and I get the correct behavior -- Pat's  
>> DBs go
>> in /tmp/pat, Mike's in /tmp/mike.  I also tried running in the
>> background,  Nothing that I do seems to trigger this bug.
>>
>> I will note, though, that the code which looks up the database_dir  
>> falls
>> back to "." if it's not defined (see couch_server:init/1).  So that  
>> tells
>> me the config values in Michael's setup aren't accessible to
>> couch_server.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>  Though they show up via Futon config.html
> ~M
>
>>
>> Michael, can you check one more thing for me -- did you upgrade in  
>> place
>> to a newer version of CouchDB?  What are the contents of /usr/
>> local/lib/couchdb/erlang/lib?  We have a bug we need to fix in trunk
>> where Couch can accidentally use old versions of modules if they  
>> show up
>> in the same directory.  If that happens, well, all bets are off.   
>> Best,
>>
>> Adam
>>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> I do not remember if I upgraded in place.  The fact that my couchdb
> build directory contains a BUG and bootstrap file from 2009/09/20
> may indicate that I did layer the newest version over top of my
> existing couchdb dir contents.  And then
>  ./bootstrap
>  make
>  sudo make install
>
>
> $ ls -rlast /usr/local/lib/couchdb/erlang/lib
> total 32
> 4 drwxr-xr-x 3 mmcdanie mmcdanie 4096 2009-02-23 15:52 ..
> 4 drwxr-xr-x 3 mmcdanie mmcdanie 4096 2009-03-07 01:27 mochiweb-r97
> 4 drwxr-xr-x 3 root     root     4096 2009-09-20 16:00 ibrowse-1.5.2
> 4 drwxr-xr-x 3 root     root     4096 2009-09-20 16:00 erlang-oauth
> 4 drwxr-xr-x 5 root     root     4096 2009-09-20 16:00  
> couch-0.11.0a817117
> 4 drwxr-xr-x 5 root     root     4096 2009-10-22 10:00  
> couch-0.11.0b828784
> 4 drwxr-xr-x 3 root     root     4096 2009-10-22 10:00 etap
> 4 drwxr-xr-x 8 mmcdanie mmcdanie 4096 2009-10-22 10:00 .
>
>
>
> When you start the respective couchdb processes, if you are already
> in the desired db directory, that is where the db files will be
> created and read from.
>
> To see the problem, I start the processes from any directory other
> than the respective db directories.
>
> My 'couchdb -V' version is the 0.11.0b828784
>
> ~M


http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
					

Re: [long] multiple couchdb invocations, single machine

Posted by Michael McDaniel <co...@autosys.us>.
On Sat, Oct 24, 2009 at 02:49:32PM -0400, Adam Kocoloski wrote:
> On Oct 24, 2009, at 2:37 AM, Paul Davis wrote:
>
>> On Sat, Oct 24, 2009 at 2:26 AM, Michael McDaniel  
>> <co...@autosys.us> wrote:
>>> On Sat, Oct 24, 2009 at 02:18:33AM -0400, Paul Davis wrote:
>>>>>  And, just now, I realized that it is wanting to create databases
>>>>>  in whatever directory I start from. (I do not understand why
>>>>>  it wasn't trying to create them in /usr/local/var/lib but rather
>>>>>  /usr/local/var/lib/couchdb before).
>>>>>
>>>>>  I start PAT in /usr/local/var/lib/couchdb_pat
>>>>>  and start
>>>>>  MIKE in /usr/local/var/lib/couchdb_mike
>>>>>
>>>>>  and I can run separate test suites and create databases with
>>>>>  each invocation that the other invocation does not see.
>>>>>
>>>>>
>>>>>  The trivial workaround to have it function as I want is to
>>>>>
>>>>>  cd path/to/invocation/database/directory && couchdb -n -a ...
>>>>>
>>>>>
>>>>>  Of course, not a long-term strategy but will work for now.
>>>>
>>>> Michael,
>>>>
>>>> Hmm, you must've uncovered a bug here in the recent boot sequence
>>>> updates. You've probably reduced it well enough that we should be  
>>>> able
>>>> to get it fixed though. Thanks for the report.
>>>>
>>>> Paul Davis
>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>
>>>  glad it helped, Paul - and thanks for the laugh w/the bug report
>>>                        (I still lurk on dev@)
>>>
>>>
>>>  I'll grab a new version in a day or few ...
>>>
>>> ~M
>>>
>>
>> If you're not having fun, you're Doing It Wrong.
>
> Actually, I'm having trouble reproducing this bug.  I must be missing  
> something.  All I did was write the config file (this is pat.ini,  
> mike.ini is analogous)
>
>> macbook:~ $ cat /usr/local/couchdb/trunk/etc/couchdb/pat.ini
>> [couchdb]
>> database_dir = /tmp/pat
>>
>> [log]
>> level = debug
>>
>> [httpd]
>> port = 5986
>
> and start the server
>
>> macbook:~ $ /usr/local/couchdb/trunk/bin/couchdb -a /usr/local/ 
>> couchdb/trunk/etc/couchdb/pat.ini
>> Apache CouchDB 0.11.0b829113 (LogLevel=debug) is starting.
>> Configuration Settings ["/usr/local/couchdb/trunk/etc/couchdb/ 
>> default.ini",
>>                         "/usr/local/couchdb/trunk/etc/couchdb/ 
>> local.ini",
>>                         "/usr/local/couchdb/trunk/etc/couchdb/ 
>> pat.ini"]:
> <snip>
>>   [couchdb] database_dir="/tmp/pat"
>
>
> and do the same for Mike, and I get the correct behavior -- Pat's DBs go 
> in /tmp/pat, Mike's in /tmp/mike.  I also tried running in the  
> background,  Nothing that I do seems to trigger this bug.
>
> I will note, though, that the code which looks up the database_dir falls 
> back to "." if it's not defined (see couch_server:init/1).  So that tells 
> me the config values in Michael's setup aren't accessible to 
> couch_server.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  Though they show up via Futon config.html
~M

>
> Michael, can you check one more thing for me -- did you upgrade in place 
> to a newer version of CouchDB?  What are the contents of /usr/ 
> local/lib/couchdb/erlang/lib?  We have a bug we need to fix in trunk  
> where Couch can accidentally use old versions of modules if they show up 
> in the same directory.  If that happens, well, all bets are off.  Best,
>
> Adam
>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

 I do not remember if I upgraded in place.  The fact that my couchdb
 build directory contains a BUG and bootstrap file from 2009/09/20 
 may indicate that I did layer the newest version over top of my
 existing couchdb dir contents.  And then
  ./bootstrap
  make
  sudo make install


$ ls -rlast /usr/local/lib/couchdb/erlang/lib
total 32
4 drwxr-xr-x 3 mmcdanie mmcdanie 4096 2009-02-23 15:52 ..
4 drwxr-xr-x 3 mmcdanie mmcdanie 4096 2009-03-07 01:27 mochiweb-r97
4 drwxr-xr-x 3 root     root     4096 2009-09-20 16:00 ibrowse-1.5.2
4 drwxr-xr-x 3 root     root     4096 2009-09-20 16:00 erlang-oauth
4 drwxr-xr-x 5 root     root     4096 2009-09-20 16:00 couch-0.11.0a817117
4 drwxr-xr-x 5 root     root     4096 2009-10-22 10:00 couch-0.11.0b828784
4 drwxr-xr-x 3 root     root     4096 2009-10-22 10:00 etap
4 drwxr-xr-x 8 mmcdanie mmcdanie 4096 2009-10-22 10:00 .



 When you start the respective couchdb processes, if you are already
 in the desired db directory, that is where the db files will be
 created and read from.  

 To see the problem, I start the processes from any directory other
 than the respective db directories.

 My 'couchdb -V' version is the 0.11.0b828784

~M

Re: [long] multiple couchdb invocations, single machine

Posted by Adam Kocoloski <ko...@apache.org>.
On Oct 24, 2009, at 2:37 AM, Paul Davis wrote:

> On Sat, Oct 24, 2009 at 2:26 AM, Michael McDaniel  
> <co...@autosys.us> wrote:
>> On Sat, Oct 24, 2009 at 02:18:33AM -0400, Paul Davis wrote:
>>>>  And, just now, I realized that it is wanting to create databases
>>>>  in whatever directory I start from. (I do not understand why
>>>>  it wasn't trying to create them in /usr/local/var/lib but rather
>>>>  /usr/local/var/lib/couchdb before).
>>>>
>>>>  I start PAT in /usr/local/var/lib/couchdb_pat
>>>>  and start
>>>>  MIKE in /usr/local/var/lib/couchdb_mike
>>>>
>>>>  and I can run separate test suites and create databases with
>>>>  each invocation that the other invocation does not see.
>>>>
>>>>
>>>>  The trivial workaround to have it function as I want is to
>>>>
>>>>  cd path/to/invocation/database/directory && couchdb -n -a ...
>>>>
>>>>
>>>>  Of course, not a long-term strategy but will work for now.
>>>
>>> Michael,
>>>
>>> Hmm, you must've uncovered a bug here in the recent boot sequence
>>> updates. You've probably reduced it well enough that we should be  
>>> able
>>> to get it fixed though. Thanks for the report.
>>>
>>> Paul Davis
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>>  glad it helped, Paul - and thanks for the laugh w/the bug report
>>                        (I still lurk on dev@)
>>
>>
>>  I'll grab a new version in a day or few ...
>>
>> ~M
>>
>
> If you're not having fun, you're Doing It Wrong.

Actually, I'm having trouble reproducing this bug.  I must be missing  
something.  All I did was write the config file (this is pat.ini,  
mike.ini is analogous)

> macbook:~ $ cat /usr/local/couchdb/trunk/etc/couchdb/pat.ini
> [couchdb]
> database_dir = /tmp/pat
>
> [log]
> level = debug
>
> [httpd]
> port = 5986

and start the server

> macbook:~ $ /usr/local/couchdb/trunk/bin/couchdb -a /usr/local/ 
> couchdb/trunk/etc/couchdb/pat.ini
> Apache CouchDB 0.11.0b829113 (LogLevel=debug) is starting.
> Configuration Settings ["/usr/local/couchdb/trunk/etc/couchdb/ 
> default.ini",
>                         "/usr/local/couchdb/trunk/etc/couchdb/ 
> local.ini",
>                         "/usr/local/couchdb/trunk/etc/couchdb/ 
> pat.ini"]:
<snip>
>   [couchdb] database_dir="/tmp/pat"


and do the same for Mike, and I get the correct behavior -- Pat's DBs  
go in /tmp/pat, Mike's in /tmp/mike.  I also tried running in the  
background,  Nothing that I do seems to trigger this bug.

I will note, though, that the code which looks up the database_dir  
falls back to "." if it's not defined (see couch_server:init/1).  So  
that tells me the config values in Michael's setup aren't accessible  
to couch_server.

Michael, can you check one more thing for me -- did you upgrade in  
place to a newer version of CouchDB?  What are the contents of /usr/ 
local/lib/couchdb/erlang/lib?  We have a bug we need to fix in trunk  
where Couch can accidentally use old versions of modules if they show  
up in the same directory.  If that happens, well, all bets are off.   
Best,

Adam



Re: [long] multiple couchdb invocations, single machine

Posted by Paul Davis <pa...@gmail.com>.
On Sat, Oct 24, 2009 at 2:26 AM, Michael McDaniel <co...@autosys.us> wrote:
> On Sat, Oct 24, 2009 at 02:18:33AM -0400, Paul Davis wrote:
>> >  And, just now, I realized that it is wanting to create databases
>> >  in whatever directory I start from. (I do not understand why
>> >  it wasn't trying to create them in /usr/local/var/lib but rather
>> >  /usr/local/var/lib/couchdb before).
>> >
>> >  I start PAT in /usr/local/var/lib/couchdb_pat
>> >  and start
>> >  MIKE in /usr/local/var/lib/couchdb_mike
>> >
>> >  and I can run separate test suites and create databases with
>> >  each invocation that the other invocation does not see.
>> >
>> >
>> >  The trivial workaround to have it function as I want is to
>> >
>> >  cd path/to/invocation/database/directory && couchdb -n -a ...
>> >
>> >
>> >  Of course, not a long-term strategy but will work for now.
>>
>> Michael,
>>
>> Hmm, you must've uncovered a bug here in the recent boot sequence
>> updates. You've probably reduced it well enough that we should be able
>> to get it fixed though. Thanks for the report.
>>
>> Paul Davis
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>  glad it helped, Paul - and thanks for the laugh w/the bug report
>                        (I still lurk on dev@)
>
>
>  I'll grab a new version in a day or few ...
>
> ~M
>

If you're not having fun, you're Doing It Wrong.

Re: [long] multiple couchdb invocations, single machine

Posted by Michael McDaniel <co...@autosys.us>.
On Sat, Oct 24, 2009 at 02:18:33AM -0400, Paul Davis wrote:
> >  And, just now, I realized that it is wanting to create databases
> >  in whatever directory I start from. (I do not understand why
> >  it wasn't trying to create them in /usr/local/var/lib but rather
> >  /usr/local/var/lib/couchdb before).
> >
> >  I start PAT in /usr/local/var/lib/couchdb_pat
> >  and start
> >  MIKE in /usr/local/var/lib/couchdb_mike
> >
> >  and I can run separate test suites and create databases with
> >  each invocation that the other invocation does not see.
> >
> >
> >  The trivial workaround to have it function as I want is to
> >
> >  cd path/to/invocation/database/directory && couchdb -n -a ...
> >
> >
> >  Of course, not a long-term strategy but will work for now.
> 
> Michael,
> 
> Hmm, you must've uncovered a bug here in the recent boot sequence
> updates. You've probably reduced it well enough that we should be able
> to get it fixed though. Thanks for the report.
> 
> Paul Davis
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

 glad it helped, Paul - and thanks for the laugh w/the bug report
                        (I still lurk on dev@)


 I'll grab a new version in a day or few ...

~M

Re: [long] multiple couchdb invocations, single machine

Posted by Paul Davis <pa...@gmail.com>.
>  And, just now, I realized that it is wanting to create databases
>  in whatever directory I start from. (I do not understand why
>  it wasn't trying to create them in /usr/local/var/lib but rather
>  /usr/local/var/lib/couchdb before).
>
>  I start PAT in /usr/local/var/lib/couchdb_pat
>  and start
>  MIKE in /usr/local/var/lib/couchdb_mike
>
>  and I can run separate test suites and create databases with
>  each invocation that the other invocation does not see.
>
>
>  The trivial workaround to have it function as I want is to
>
>  cd path/to/invocation/database/directory && couchdb -n -a ...
>
>
>  Of course, not a long-term strategy but will work for now.

Michael,

Hmm, you must've uncovered a bug here in the recent boot sequence
updates. You've probably reduced it well enough that we should be able
to get it fixed though. Thanks for the report.

Paul Davis

Re: [long] multiple couchdb invocations, single machine

Posted by Michael McDaniel <co...@autosys.us>.
 Paul, I did the -n -a -a  using custom default*.ini and custom
 local*.ini  e.g.

 $ couchdb -n -i -a /usr/local/etc/couchdb/mike/default_mike.ini -a /usr/local/etc/couchdb/mike/local_mike.ini
Erlang R13B01 (erts-5.7.2) [rq:1] [async-threads:0] [hipe] [kernel-poll:true]

Eshell V5.7.2  (abort with ^G)
1> Apache CouchDB 0.11.0b828784 (LogLevel=debug) is starting.
Configuration Settings ["/usr/local/etc/couchdb/default.ini",
                        "/usr/local/etc/couchdb/local.ini",
                        "/usr/local/etc/couchdb/mike/default_mike.ini",
                        "/usr/local/etc/couchdb/mike/local_mike.ini"]

 ...


 Checked Futon config.html and the database_dir and view_index_dir
 show as expected (i.e. the path included in the custom ini files).

 However, looking at Futon Overview from both
 http://localhost:5984/_utils/index.html
 http://localhost:5985/_utils/index.html
 shows all my original databases as

   couchdb/foo_db
   couchdb/bar_db
   ...
   couchdb/test_suite_db/with_slashes
   ...
   etc.

 Is the hard coded {default, local}.ini files in couch.app causing
 any problem ?  I will guess yes after another little test.

 I moved default.ini and local.ini out of /usr/local/etc/couchdb
 and did 
 touch default.ini
 touch local.ini

 so couchdb would start (it errored out without {default,local}.ini files).
 Then, Futon Overview showed no databases as expected.  I created a
 database from each invocation, though, and it got created in
 /usr/local/var/lib/couchdb  rather than where I would expect, i.e.
 the respective directories

  /usr/local/var/lib/couchdb_pat
  /usr/local/var/lib/couchdb_mike


 And, both invocations were able to see both databases via Futon
 Overview.  Odd, though, they each showed up as

  pat_db
  mike_db

 rather than 

  couchdb/pat_db
  couchdb/mike_db


 So how's it know about the couchdb directory at all ?

 Hmmm, I had been starting from /usr/local/var/lib/ directory.

 I then removed all of my old databases and directories out
 of /usr/local/var/lib/couchdb and restarted.

 And, just now, I realized that it is wanting to create databases
 in whatever directory I start from. (I do not understand why
 it wasn't trying to create them in /usr/local/var/lib but rather
 /usr/local/var/lib/couchdb before).  

 I start PAT in /usr/local/var/lib/couchdb_pat  
 and start
 MIKE in /usr/local/var/lib/couchdb_mike

 and I can run separate test suites and create databases with
 each invocation that the other invocation does not see.


 The trivial workaround to have it function as I want is to

 cd path/to/invocation/database/directory && couchdb -n -a ...


 Of course, not a long-term strategy but will work for now.
 

~M




On Sat, Oct 24, 2009 at 12:24:30AM -0400, Paul Davis wrote:
> Michael,
> 
> Heh, never underestimate the value of checking the basics. I've spent
> hours debuging my failure to run make dev before so sanity checks are
> always a good idea.
> 
> However you are right in that your original introspection and follow
> up indicate the db_directory.
> 
> Another simple test to try would be to copy default.ini to
> default_pat.ini and default_mike.ini setting parameters as appropriate
> there. Then your couchdb command lines would involve something along
> the lines of:
> 
> $ couchdb -n -a /path/to/default_pat.ini -a /path/to/local_path.ini ...
> 
> Let me know if that fixes bits.
> 
> People have successfully run multiple instances on a single machine so
> either we have a regression or you've uncovered a bug or something
> more random has happened.
> 
> HTH,
> Paul Davis
> 
> On Sat, Oct 24, 2009 at 12:04 AM, Michael McDaniel <co...@autosys.us> wrote:
> >  Though setting log level = debug, and running strace (per earlier
> >  Chris mail) might be useful for discovery, I think the empirical
> >  evidence already proves that the local.ini and local_mike.ini
> >  config files are getting read (and if they weren't, changing log
> >  level in either would have no effect).
> >
> >  Per earlier information, the proper log files are getting created which
> >  are defined in local.ini and local_mike.ini hence those ini files are
> >  getting read.  That is the only place the respective log files
> >  couchdb_pat.log and couchdb_mike.log are defined.
> >
> >  Additionally, Futon config.html indicates proper reading of the
> >  ini files based on the respectively displayed database_dir and
> >  view_index_dir variables.
> >
> >
> >  However, because some may still not be convinced from the existing
> >  evidence, and I have no immediate other ideas, and I would like some
> >  help with this, I changed from level = info to level = debug in each
> >  of local.ini and local_mike.ini (which are being read).  Looking at
> >  couchdb_pat.stdout and couchdb_mike.stdout showed the same
> >  database_dir and view_index_dir that shows per information
> >  in Futon config.html as described below.
> >
> >  I then started _mike using strace as follows:
> >
> >  sudo strace couchdb -i -p /usr/local/var/run/couchdb_prod.pid -o /home/erl/couchdb/logs/couchdb_prod.stdout -e /home/erl/couchdb/logs/couchdb_prod.stderr -a /usr/local/etc/couchdb/prod/local_prod.ini > foo.log 2>&1
> >
> >
> >  database_dir in foo.log shows
> >
> > writev(1, [{""..., 0}, {"  [couchdb] database_dir  =\"/usr/"..., 61}], 2  [couchdb] database_dir  ="/usr/local/var/lib/couchdb_prod"
> >
> >
> >  view_index_dir in foo.log shows
> >
> > writev(1, [{""..., 0}, {"  [couchdb] view_index_dir=\"/usr/"..., 61}], 2  [couchdb] view_index_dir="/usr/local/var/lib/couchdb_prod"
> >
> >
> >  It appears that the ini files are getting read.
> >
> >
> >  Has anyone run two separate invocations on one machine, using
> >  different ports with database isolation to separate directories
> >  unavailable to the other invocation ?
> >
> >  Perhaps this a use case that is not tested ?
> >
> > ~M
> >
> >
> > On Fri, Oct 23, 2009 at 10:42:46PM -0400, Paul Davis wrote:
> >> You could also set the log level to debug and start each without -b to
> >> see what config files are being read.
> >>
> >> Paul Davis
> >>
> >> On Fri, Oct 23, 2009 at 10:25 PM, Chris Stockton
> >> <ch...@gmail.com> wrote:
> >> > I would try starting them with strace -f and see what ini files they are
> >> > reading and look for other clues.
> >> >
> >> > On Oct 23, 2009 6:19 PM, "Michael McDaniel" <co...@autosys.us> wrote:
> >> >
> >> >
> >> >  SHORT VERSION:
> >> >
> >> >  Multiple couchdb invocations on a single machine are not
> >> >  behaving as I would expect to isolate databases.
> >> >
> >> >  Does someone have a tested configuration they will share ?
> >> >
> >> >
> >> >
> >> >  LONG VERSION:
> >> >
> >> >  I have installed
> >> >
> >> >  couchdb - Apache CouchDB 0.11.0b828784
> >> >
> >> >  and am trying to do what I thought would be simple.
> >> >
> >> >  Run two independent invocations of couchdb on the same machine.
> >> >  With the expectation that by running separate invocations, I
> >> >  could keep respective databases isolated from each.
> >> >
> >> >
> >> >  Here's what I want
> >> >
> >> >  * one invocation on default port 5984   (let's call this one PAT)
> >> >  * other invocation on non-default port 5985 (let's call this one MIKE)
> >> >  * PAT should not see or have access to MIKE databases
> >> >  * MIKE should not see or have access to PAT databases
> >> >  * PAT can hang with no effect on MIKE
> >> >  * MIKE can hang and have no effect on PAT
> >> >  * long running events on either have no effect on the other
> >> >
> >> >  Here's what I tried (all pertinent directories and files are created with
> >> >  rw permissions to invoking user).  default.ini is as created by couchdb
> >> >  build/install.
> >> > ---
> >> >
> >> >  Added the following to /usr/local/etc/couchdb/local.ini
> >> >
> >> > [couchdb]
> >> >
> >> > database_dir   = /usr/local/var/lib/couchdb_pat
> >> > view_index_dir = /usr/local/var/lib/couchdb_pat
> >> >
> >> > [log]
> >> > file = /home/erl/couchdb/logs/couch_pat.log
> >> > level = info
> >> > ---
> >> >
> >> >  Added the following to  /usr/local/etc/couchdb/mike/local_mike.ini
> >> >
> >> > [couchdb]
> >> > database_dir   = /usr/local/var/lib/couchdb_mike
> >> > view_index_dir = /usr/local/var/lib/couchdb_mike
> >> >
> >> >
> >> > [log]
> >> > file = /home/erl/couchdb/logs/couch_mike.log
> >> > level = info
> >> >
> >> > [httpd]
> >> > port = 5985
> >> > ---
> >> >
> >> >  start PAT with
> >> > couchdb  -b  -p  /usr/local/var/run/couchdb_pat.pid        \
> >> >            -o  /home/erl/couchdb/logs/couchdb_pat.stdout \
> >> >            -e  /home/erl/couchdb/logs/couchdb_pat.stderr
> >> > ---
> >> >
> >> >  start MIKE with
> >> > couchdb  -b  -p  /usr/local/var/run/couchdb_mike.pid        \
> >> >            -a  /usr/local/etc/couchdb/mike/local_mike.ini \
> >> >            -o /home/erl/couchdb/logs/couchdb_mike.stdout  \
> >> >            -e /home/erl/couchdb/logs/couchdb_mike.stderr
> >> > ---
> >> >
> >> >
> >> >  NOW, in Futon, for PAT http://localhost:5984/_utils/config.html
> >> >
> >> >
> >> >  database_dir       /usr/local/var/lib/couchdb
> >> >  database_dir       /usr/local/var/lib/couchdb_pat
> >> >  view_index_dir     /usr/local/var/lib/couchdb_pat
> >> >
> >> >  AND, for MIKE http://localhost:5985/_utils/config.html
> >> >
> >> >  database_dir       /usr/local/var/lib/couchdb
> >> >  database_dir       /usr/local/var/lib/couchdb_pat
> >> >  view_index_dir     /usr/local/var/lib/couchdb_pat
> >> >
> >> >
> >> >  BUT ... both show all the databases already existing in the default
> >> >  /usr/local/var/lib/couchdb directory.
> >> >
> >> >
> >> >  AND
> >> >
> >> >  If I create a new database from either PAT or MIKE URI
> >> >  http://localhost:5984/_utils/index.html
> >> >  http://localhost:5985/_utils/index.html
> >> >
> >> >  the new database winds up in the /usr/local/var/lib/couchdb
> >> >  directory (and, as previously mentioned, either invocation
> >> >  of couchdb can see all of the databases there).
> >> >
> >> >
> >> >  If I comment out database_dir and view_index_dir in default.ini
> >> >  then both invocations see the databases (in Futon Overview) as,
> >> >  e.g.
> >> >
> >> >   couchdb/foo_db
> >> >   couchdb/bar_db
> >> >
> >> >  Although each Futon Configuration shows only the respective
> >> >  database_dir    /usr/local/var/lib/couchdb_pat
> >> >  view_index_dir  /usr/local/var/lib/couchdb_pat
> >> >
> >> >  database_dir    /usr/local/var/lib/couchdb_mike
> >> >  view_index_dir  /usr/local/var/lib/couchdb_mike
> >> >  .
> >> >
> >> >
> >> >  Logs are getting written per respective PAT and MIKE local ini files.
> >> >
> >> >
> >> >  QUESTION:
> >> >
> >> >  How do I run more than one invocation of couchdb on a single machine
> >> >  with database and process isolation ?
> >> >
> >> >
> >> > ~Michael
> >> >

Re: [long] multiple couchdb invocations, single machine

Posted by Paul Davis <pa...@gmail.com>.
Michael,

Heh, never underestimate the value of checking the basics. I've spent
hours debuging my failure to run make dev before so sanity checks are
always a good idea.

However you are right in that your original introspection and follow
up indicate the db_directory.

Another simple test to try would be to copy default.ini to
default_pat.ini and default_mike.ini setting parameters as appropriate
there. Then your couchdb command lines would involve something along
the lines of:

$ couchdb -n -a /path/to/default_pat.ini -a /path/to/local_path.ini ...

Let me know if that fixes bits.

People have successfully run multiple instances on a single machine so
either we have a regression or you've uncovered a bug or something
more random has happened.

HTH,
Paul Davis

On Sat, Oct 24, 2009 at 12:04 AM, Michael McDaniel <co...@autosys.us> wrote:
>  Though setting log level = debug, and running strace (per earlier
>  Chris mail) might be useful for discovery, I think the empirical
>  evidence already proves that the local.ini and local_mike.ini
>  config files are getting read (and if they weren't, changing log
>  level in either would have no effect).
>
>  Per earlier information, the proper log files are getting created which
>  are defined in local.ini and local_mike.ini hence those ini files are
>  getting read.  That is the only place the respective log files
>  couchdb_pat.log and couchdb_mike.log are defined.
>
>  Additionally, Futon config.html indicates proper reading of the
>  ini files based on the respectively displayed database_dir and
>  view_index_dir variables.
>
>
>  However, because some may still not be convinced from the existing
>  evidence, and I have no immediate other ideas, and I would like some
>  help with this, I changed from level = info to level = debug in each
>  of local.ini and local_mike.ini (which are being read).  Looking at
>  couchdb_pat.stdout and couchdb_mike.stdout showed the same
>  database_dir and view_index_dir that shows per information
>  in Futon config.html as described below.
>
>  I then started _mike using strace as follows:
>
>  sudo strace couchdb -i -p /usr/local/var/run/couchdb_prod.pid -o /home/erl/couchdb/logs/couchdb_prod.stdout -e /home/erl/couchdb/logs/couchdb_prod.stderr -a /usr/local/etc/couchdb/prod/local_prod.ini > foo.log 2>&1
>
>
>  database_dir in foo.log shows
>
> writev(1, [{""..., 0}, {"  [couchdb] database_dir  =\"/usr/"..., 61}], 2  [couchdb] database_dir  ="/usr/local/var/lib/couchdb_prod"
>
>
>  view_index_dir in foo.log shows
>
> writev(1, [{""..., 0}, {"  [couchdb] view_index_dir=\"/usr/"..., 61}], 2  [couchdb] view_index_dir="/usr/local/var/lib/couchdb_prod"
>
>
>  It appears that the ini files are getting read.
>
>
>  Has anyone run two separate invocations on one machine, using
>  different ports with database isolation to separate directories
>  unavailable to the other invocation ?
>
>  Perhaps this a use case that is not tested ?
>
> ~M
>
>
> On Fri, Oct 23, 2009 at 10:42:46PM -0400, Paul Davis wrote:
>> You could also set the log level to debug and start each without -b to
>> see what config files are being read.
>>
>> Paul Davis
>>
>> On Fri, Oct 23, 2009 at 10:25 PM, Chris Stockton
>> <ch...@gmail.com> wrote:
>> > I would try starting them with strace -f and see what ini files they are
>> > reading and look for other clues.
>> >
>> > On Oct 23, 2009 6:19 PM, "Michael McDaniel" <co...@autosys.us> wrote:
>> >
>> >
>> >  SHORT VERSION:
>> >
>> >  Multiple couchdb invocations on a single machine are not
>> >  behaving as I would expect to isolate databases.
>> >
>> >  Does someone have a tested configuration they will share ?
>> >
>> >
>> >
>> >  LONG VERSION:
>> >
>> >  I have installed
>> >
>> >  couchdb - Apache CouchDB 0.11.0b828784
>> >
>> >  and am trying to do what I thought would be simple.
>> >
>> >  Run two independent invocations of couchdb on the same machine.
>> >  With the expectation that by running separate invocations, I
>> >  could keep respective databases isolated from each.
>> >
>> >
>> >  Here's what I want
>> >
>> >  * one invocation on default port 5984   (let's call this one PAT)
>> >  * other invocation on non-default port 5985 (let's call this one MIKE)
>> >  * PAT should not see or have access to MIKE databases
>> >  * MIKE should not see or have access to PAT databases
>> >  * PAT can hang with no effect on MIKE
>> >  * MIKE can hang and have no effect on PAT
>> >  * long running events on either have no effect on the other
>> >
>> >  Here's what I tried (all pertinent directories and files are created with
>> >  rw permissions to invoking user).  default.ini is as created by couchdb
>> >  build/install.
>> > ---
>> >
>> >  Added the following to /usr/local/etc/couchdb/local.ini
>> >
>> > [couchdb]
>> >
>> > database_dir   = /usr/local/var/lib/couchdb_pat
>> > view_index_dir = /usr/local/var/lib/couchdb_pat
>> >
>> > [log]
>> > file = /home/erl/couchdb/logs/couch_pat.log
>> > level = info
>> > ---
>> >
>> >  Added the following to  /usr/local/etc/couchdb/mike/local_mike.ini
>> >
>> > [couchdb]
>> > database_dir   = /usr/local/var/lib/couchdb_mike
>> > view_index_dir = /usr/local/var/lib/couchdb_mike
>> >
>> >
>> > [log]
>> > file = /home/erl/couchdb/logs/couch_mike.log
>> > level = info
>> >
>> > [httpd]
>> > port = 5985
>> > ---
>> >
>> >  start PAT with
>> > couchdb  -b  -p  /usr/local/var/run/couchdb_pat.pid        \
>> >            -o  /home/erl/couchdb/logs/couchdb_pat.stdout \
>> >            -e  /home/erl/couchdb/logs/couchdb_pat.stderr
>> > ---
>> >
>> >  start MIKE with
>> > couchdb  -b  -p  /usr/local/var/run/couchdb_mike.pid        \
>> >            -a  /usr/local/etc/couchdb/mike/local_mike.ini \
>> >            -o /home/erl/couchdb/logs/couchdb_mike.stdout  \
>> >            -e /home/erl/couchdb/logs/couchdb_mike.stderr
>> > ---
>> >
>> >
>> >  NOW, in Futon, for PAT http://localhost:5984/_utils/config.html
>> >
>> >
>> >  database_dir       /usr/local/var/lib/couchdb
>> >  database_dir       /usr/local/var/lib/couchdb_pat
>> >  view_index_dir     /usr/local/var/lib/couchdb_pat
>> >
>> >  AND, for MIKE http://localhost:5985/_utils/config.html
>> >
>> >  database_dir       /usr/local/var/lib/couchdb
>> >  database_dir       /usr/local/var/lib/couchdb_pat
>> >  view_index_dir     /usr/local/var/lib/couchdb_pat
>> >
>> >
>> >  BUT ... both show all the databases already existing in the default
>> >  /usr/local/var/lib/couchdb directory.
>> >
>> >
>> >  AND
>> >
>> >  If I create a new database from either PAT or MIKE URI
>> >  http://localhost:5984/_utils/index.html
>> >  http://localhost:5985/_utils/index.html
>> >
>> >  the new database winds up in the /usr/local/var/lib/couchdb
>> >  directory (and, as previously mentioned, either invocation
>> >  of couchdb can see all of the databases there).
>> >
>> >
>> >  If I comment out database_dir and view_index_dir in default.ini
>> >  then both invocations see the databases (in Futon Overview) as,
>> >  e.g.
>> >
>> >   couchdb/foo_db
>> >   couchdb/bar_db
>> >
>> >  Although each Futon Configuration shows only the respective
>> >  database_dir    /usr/local/var/lib/couchdb_pat
>> >  view_index_dir  /usr/local/var/lib/couchdb_pat
>> >
>> >  database_dir    /usr/local/var/lib/couchdb_mike
>> >  view_index_dir  /usr/local/var/lib/couchdb_mike
>> >  .
>> >
>> >
>> >  Logs are getting written per respective PAT and MIKE local ini files.
>> >
>> >
>> >  QUESTION:
>> >
>> >  How do I run more than one invocation of couchdb on a single machine
>> >  with database and process isolation ?
>> >
>> >
>> > ~Michael
>> >
>

Re: [long] multiple couchdb invocations, single machine

Posted by Michael McDaniel <co...@autosys.us>.
 Though setting log level = debug, and running strace (per earlier
 Chris mail) might be useful for discovery, I think the empirical
 evidence already proves that the local.ini and local_mike.ini
 config files are getting read (and if they weren't, changing log
 level in either would have no effect).

 Per earlier information, the proper log files are getting created which
 are defined in local.ini and local_mike.ini hence those ini files are
 getting read.  That is the only place the respective log files
 couchdb_pat.log and couchdb_mike.log are defined.

 Additionally, Futon config.html indicates proper reading of the
 ini files based on the respectively displayed database_dir and
 view_index_dir variables.


 However, because some may still not be convinced from the existing
 evidence, and I have no immediate other ideas, and I would like some
 help with this, I changed from level = info to level = debug in each
 of local.ini and local_mike.ini (which are being read).  Looking at
 couchdb_pat.stdout and couchdb_mike.stdout showed the same
 database_dir and view_index_dir that shows per information
 in Futon config.html as described below.

 I then started _mike using strace as follows:

  sudo strace couchdb -i -p /usr/local/var/run/couchdb_prod.pid -o /home/erl/couchdb/logs/couchdb_prod.stdout -e /home/erl/couchdb/logs/couchdb_prod.stderr -a /usr/local/etc/couchdb/prod/local_prod.ini > foo.log 2>&1


 database_dir in foo.log shows

writev(1, [{""..., 0}, {"  [couchdb] database_dir  =\"/usr/"..., 61}], 2  [couchdb] database_dir  ="/usr/local/var/lib/couchdb_prod"


 view_index_dir in foo.log shows

writev(1, [{""..., 0}, {"  [couchdb] view_index_dir=\"/usr/"..., 61}], 2  [couchdb] view_index_dir="/usr/local/var/lib/couchdb_prod"


 It appears that the ini files are getting read.


 Has anyone run two separate invocations on one machine, using
 different ports with database isolation to separate directories
 unavailable to the other invocation ?  

 Perhaps this a use case that is not tested ?

~M


On Fri, Oct 23, 2009 at 10:42:46PM -0400, Paul Davis wrote:
> You could also set the log level to debug and start each without -b to
> see what config files are being read.
> 
> Paul Davis
> 
> On Fri, Oct 23, 2009 at 10:25 PM, Chris Stockton
> <ch...@gmail.com> wrote:
> > I would try starting them with strace -f and see what ini files they are
> > reading and look for other clues.
> >
> > On Oct 23, 2009 6:19 PM, "Michael McDaniel" <co...@autosys.us> wrote:
> >
> >
> >  SHORT VERSION:
> >
> >  Multiple couchdb invocations on a single machine are not
> >  behaving as I would expect to isolate databases.
> >
> >  Does someone have a tested configuration they will share ?
> >
> >
> >
> >  LONG VERSION:
> >
> >  I have installed
> >
> >  couchdb - Apache CouchDB 0.11.0b828784
> >
> >  and am trying to do what I thought would be simple.
> >
> >  Run two independent invocations of couchdb on the same machine.
> >  With the expectation that by running separate invocations, I
> >  could keep respective databases isolated from each.
> >
> >
> >  Here's what I want
> >
> >  * one invocation on default port 5984   (let's call this one PAT)
> >  * other invocation on non-default port 5985 (let's call this one MIKE)
> >  * PAT should not see or have access to MIKE databases
> >  * MIKE should not see or have access to PAT databases
> >  * PAT can hang with no effect on MIKE
> >  * MIKE can hang and have no effect on PAT
> >  * long running events on either have no effect on the other
> >
> >  Here's what I tried (all pertinent directories and files are created with
> >  rw permissions to invoking user).  default.ini is as created by couchdb
> >  build/install.
> > ---
> >
> >  Added the following to /usr/local/etc/couchdb/local.ini
> >
> > [couchdb]
> >
> > database_dir   = /usr/local/var/lib/couchdb_pat
> > view_index_dir = /usr/local/var/lib/couchdb_pat
> >
> > [log]
> > file = /home/erl/couchdb/logs/couch_pat.log
> > level = info
> > ---
> >
> >  Added the following to  /usr/local/etc/couchdb/mike/local_mike.ini
> >
> > [couchdb]
> > database_dir   = /usr/local/var/lib/couchdb_mike
> > view_index_dir = /usr/local/var/lib/couchdb_mike
> >
> >
> > [log]
> > file = /home/erl/couchdb/logs/couch_mike.log
> > level = info
> >
> > [httpd]
> > port = 5985
> > ---
> >
> >  start PAT with
> > couchdb  -b  -p  /usr/local/var/run/couchdb_pat.pid        \
> >            -o  /home/erl/couchdb/logs/couchdb_pat.stdout \
> >            -e  /home/erl/couchdb/logs/couchdb_pat.stderr
> > ---
> >
> >  start MIKE with
> > couchdb  -b  -p  /usr/local/var/run/couchdb_mike.pid        \
> >            -a  /usr/local/etc/couchdb/mike/local_mike.ini \
> >            -o /home/erl/couchdb/logs/couchdb_mike.stdout  \
> >            -e /home/erl/couchdb/logs/couchdb_mike.stderr
> > ---
> >
> >
> >  NOW, in Futon, for PAT http://localhost:5984/_utils/config.html
> >
> >
> >  database_dir       /usr/local/var/lib/couchdb
> >  database_dir       /usr/local/var/lib/couchdb_pat
> >  view_index_dir     /usr/local/var/lib/couchdb_pat
> >
> >  AND, for MIKE http://localhost:5985/_utils/config.html
> >
> >  database_dir       /usr/local/var/lib/couchdb
> >  database_dir       /usr/local/var/lib/couchdb_pat
> >  view_index_dir     /usr/local/var/lib/couchdb_pat
> >
> >
> >  BUT ... both show all the databases already existing in the default
> >  /usr/local/var/lib/couchdb directory.
> >
> >
> >  AND
> >
> >  If I create a new database from either PAT or MIKE URI
> >  http://localhost:5984/_utils/index.html
> >  http://localhost:5985/_utils/index.html
> >
> >  the new database winds up in the /usr/local/var/lib/couchdb
> >  directory (and, as previously mentioned, either invocation
> >  of couchdb can see all of the databases there).
> >
> >
> >  If I comment out database_dir and view_index_dir in default.ini
> >  then both invocations see the databases (in Futon Overview) as,
> >  e.g.
> >
> >   couchdb/foo_db
> >   couchdb/bar_db
> >
> >  Although each Futon Configuration shows only the respective
> >  database_dir    /usr/local/var/lib/couchdb_pat
> >  view_index_dir  /usr/local/var/lib/couchdb_pat
> >
> >  database_dir    /usr/local/var/lib/couchdb_mike
> >  view_index_dir  /usr/local/var/lib/couchdb_mike
> >  .
> >
> >
> >  Logs are getting written per respective PAT and MIKE local ini files.
> >
> >
> >  QUESTION:
> >
> >  How do I run more than one invocation of couchdb on a single machine
> >  with database and process isolation ?
> >
> >
> > ~Michael
> >

Re: [long] multiple couchdb invocations, single machine

Posted by Paul Davis <pa...@gmail.com>.
You could also set the log level to debug and start each without -b to
see what config files are being read.

Paul Davis

On Fri, Oct 23, 2009 at 10:25 PM, Chris Stockton
<ch...@gmail.com> wrote:
> I would try starting them with strace -f and see what ini files they are
> reading and look for other clues.
>
> On Oct 23, 2009 6:19 PM, "Michael McDaniel" <co...@autosys.us> wrote:
>
>
>  SHORT VERSION:
>
>  Multiple couchdb invocations on a single machine are not
>  behaving as I would expect to isolate databases.
>
>  Does someone have a tested configuration they will share ?
>
>
>
>  LONG VERSION:
>
>  I have installed
>
>  couchdb - Apache CouchDB 0.11.0b828784
>
>  and am trying to do what I thought would be simple.
>
>  Run two independent invocations of couchdb on the same machine.
>  With the expectation that by running separate invocations, I
>  could keep respective databases isolated from each.
>
>
>  Here's what I want
>
>  * one invocation on default port 5984   (let's call this one PAT)
>  * other invocation on non-default port 5985 (let's call this one MIKE)
>  * PAT should not see or have access to MIKE databases
>  * MIKE should not see or have access to PAT databases
>  * PAT can hang with no effect on MIKE
>  * MIKE can hang and have no effect on PAT
>  * long running events on either have no effect on the other
>
>  Here's what I tried (all pertinent directories and files are created with
>  rw permissions to invoking user).  default.ini is as created by couchdb
>  build/install.
> ---
>
>  Added the following to /usr/local/etc/couchdb/local.ini
>
> [couchdb]
>
> database_dir   = /usr/local/var/lib/couchdb_pat
> view_index_dir = /usr/local/var/lib/couchdb_pat
>
> [log]
> file = /home/erl/couchdb/logs/couch_pat.log
> level = info
> ---
>
>  Added the following to  /usr/local/etc/couchdb/mike/local_mike.ini
>
> [couchdb]
> database_dir   = /usr/local/var/lib/couchdb_mike
> view_index_dir = /usr/local/var/lib/couchdb_mike
>
>
> [log]
> file = /home/erl/couchdb/logs/couch_mike.log
> level = info
>
> [httpd]
> port = 5985
> ---
>
>  start PAT with
> couchdb  -b  -p  /usr/local/var/run/couchdb_pat.pid        \
>            -o  /home/erl/couchdb/logs/couchdb_pat.stdout \
>            -e  /home/erl/couchdb/logs/couchdb_pat.stderr
> ---
>
>  start MIKE with
> couchdb  -b  -p  /usr/local/var/run/couchdb_mike.pid        \
>            -a  /usr/local/etc/couchdb/mike/local_mike.ini \
>            -o /home/erl/couchdb/logs/couchdb_mike.stdout  \
>            -e /home/erl/couchdb/logs/couchdb_mike.stderr
> ---
>
>
>  NOW, in Futon, for PAT http://localhost:5984/_utils/config.html
>
>
>  database_dir       /usr/local/var/lib/couchdb
>  database_dir       /usr/local/var/lib/couchdb_pat
>  view_index_dir     /usr/local/var/lib/couchdb_pat
>
>  AND, for MIKE http://localhost:5985/_utils/config.html
>
>  database_dir       /usr/local/var/lib/couchdb
>  database_dir       /usr/local/var/lib/couchdb_pat
>  view_index_dir     /usr/local/var/lib/couchdb_pat
>
>
>  BUT ... both show all the databases already existing in the default
>  /usr/local/var/lib/couchdb directory.
>
>
>  AND
>
>  If I create a new database from either PAT or MIKE URI
>  http://localhost:5984/_utils/index.html
>  http://localhost:5985/_utils/index.html
>
>  the new database winds up in the /usr/local/var/lib/couchdb
>  directory (and, as previously mentioned, either invocation
>  of couchdb can see all of the databases there).
>
>
>  If I comment out database_dir and view_index_dir in default.ini
>  then both invocations see the databases (in Futon Overview) as,
>  e.g.
>
>   couchdb/foo_db
>   couchdb/bar_db
>
>  Although each Futon Configuration shows only the respective
>  database_dir    /usr/local/var/lib/couchdb_pat
>  view_index_dir  /usr/local/var/lib/couchdb_pat
>
>  database_dir    /usr/local/var/lib/couchdb_mike
>  view_index_dir  /usr/local/var/lib/couchdb_mike
>  .
>
>
>  Logs are getting written per respective PAT and MIKE local ini files.
>
>
>  QUESTION:
>
>  How do I run more than one invocation of couchdb on a single machine
>  with database and process isolation ?
>
>
> ~Michael
>

Re: [long] multiple couchdb invocations, single machine

Posted by Chris Stockton <ch...@gmail.com>.
I would try starting them with strace -f and see what ini files they are
reading and look for other clues.

On Oct 23, 2009 6:19 PM, "Michael McDaniel" <co...@autosys.us> wrote:


 SHORT VERSION:

  Multiple couchdb invocations on a single machine are not
  behaving as I would expect to isolate databases.

  Does someone have a tested configuration they will share ?



 LONG VERSION:

 I have installed

  couchdb - Apache CouchDB 0.11.0b828784

 and am trying to do what I thought would be simple.

 Run two independent invocations of couchdb on the same machine.
 With the expectation that by running separate invocations, I
 could keep respective databases isolated from each.


 Here's what I want

 * one invocation on default port 5984   (let's call this one PAT)
 * other invocation on non-default port 5985 (let's call this one MIKE)
 * PAT should not see or have access to MIKE databases
 * MIKE should not see or have access to PAT databases
 * PAT can hang with no effect on MIKE
 * MIKE can hang and have no effect on PAT
 * long running events on either have no effect on the other

 Here's what I tried (all pertinent directories and files are created with
 rw permissions to invoking user).  default.ini is as created by couchdb
 build/install.
---

 Added the following to /usr/local/etc/couchdb/local.ini

[couchdb]

database_dir   = /usr/local/var/lib/couchdb_pat
view_index_dir = /usr/local/var/lib/couchdb_pat

[log]
file = /home/erl/couchdb/logs/couch_pat.log
level = info
---

 Added the following to  /usr/local/etc/couchdb/mike/local_mike.ini

[couchdb]
database_dir   = /usr/local/var/lib/couchdb_mike
view_index_dir = /usr/local/var/lib/couchdb_mike


[log]
file = /home/erl/couchdb/logs/couch_mike.log
level = info

[httpd]
port = 5985
---

 start PAT with
couchdb  -b  -p  /usr/local/var/run/couchdb_pat.pid        \
            -o  /home/erl/couchdb/logs/couchdb_pat.stdout \
            -e  /home/erl/couchdb/logs/couchdb_pat.stderr
---

 start MIKE with
couchdb  -b  -p  /usr/local/var/run/couchdb_mike.pid        \
            -a  /usr/local/etc/couchdb/mike/local_mike.ini \
            -o /home/erl/couchdb/logs/couchdb_mike.stdout  \
            -e /home/erl/couchdb/logs/couchdb_mike.stderr
---


 NOW, in Futon, for PAT http://localhost:5984/_utils/config.html


  database_dir       /usr/local/var/lib/couchdb
  database_dir       /usr/local/var/lib/couchdb_pat
  view_index_dir     /usr/local/var/lib/couchdb_pat

 AND, for MIKE http://localhost:5985/_utils/config.html

  database_dir       /usr/local/var/lib/couchdb
  database_dir       /usr/local/var/lib/couchdb_pat
  view_index_dir     /usr/local/var/lib/couchdb_pat


 BUT ... both show all the databases already existing in the default
 /usr/local/var/lib/couchdb directory.


 AND

 If I create a new database from either PAT or MIKE URI
  http://localhost:5984/_utils/index.html
  http://localhost:5985/_utils/index.html

 the new database winds up in the /usr/local/var/lib/couchdb
 directory (and, as previously mentioned, either invocation
 of couchdb can see all of the databases there).


 If I comment out database_dir and view_index_dir in default.ini
 then both invocations see the databases (in Futon Overview) as,
 e.g.

   couchdb/foo_db
   couchdb/bar_db

 Although each Futon Configuration shows only the respective
 database_dir    /usr/local/var/lib/couchdb_pat
 view_index_dir  /usr/local/var/lib/couchdb_pat

 database_dir    /usr/local/var/lib/couchdb_mike
 view_index_dir  /usr/local/var/lib/couchdb_mike
 .


 Logs are getting written per respective PAT and MIKE local ini files.


 QUESTION:

 How do I run more than one invocation of couchdb on a single machine
 with database and process isolation ?


~Michael