You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Robert Campbell <rr...@gmail.com> on 2009/11/10 20:41:47 UTC

/etc/init.d/couchdb stop never really stops the db

I've run 0.8.0 and now 0.10.0 on Ubuntu 9.04/9.10 server and in both
cases calling stop never actually stopped the DB. The only way I've
gotten around it in the past is manually killing the couchdb
processes. Why doesn't stop work for me?

I've installed it via "apt-get install couchdb" and the only thing
I've modified is local.ini, BindAddress=0.0.0.0 to get remote access
working. Nothing else was ever changed.

Re: /etc/init.d/couchdb stop never really stops the db

Posted by Devon Weller <dw...@devonweller.com>.
I had a similar problem on Centos 5.4.

For me, it was a permissions issue on the log directory.  The  
directory of /usr/local/var/log/couchdb was owned by root and did not  
have write permissions for the couchdb user.  As a result couchdb  
never fully started and could only be killed with manually.


The solution for me was to:

chgrp couchdb /usr/local/var/log/couchdb && chmod g+w /usr/local/var/ 
log/couchdb


This might need to be fixed in the Makefile.  It might need to know  
the name of the user that couchdb will run under and change  
permissions of the log directory on "make install".  Perhaps it needs  
an option like with-user=couchdb.


- Devon



On Nov 10, 2009, at 1:41 PM, Robert Campbell wrote:

> I've run 0.8.0 and now 0.10.0 on Ubuntu 9.04/9.10 server and in both
> cases calling stop never actually stopped the DB. The only way I've
> gotten around it in the past is manually killing the couchdb
> processes. Why doesn't stop work for me?
>
> I've installed it via "apt-get install couchdb" and the only thing
> I've modified is local.ini, BindAddress=0.0.0.0 to get remote access
> working. Nothing else was ever changed.


Re: /etc/init.d/couchdb stop never really stops the db

Posted by Robert Campbell <rr...@gmail.com>.
> Also it could be useful to add "-p /path/to/pid_file" in each case.

root@default:~# couchdb -b -p /var/run/couchdb
Apache CouchDB needs a regular PID file: /var/run/couchdb

Just to clarify, I'm running Ubuntu 9.10 on Slicehost. I ran "apt-get
install couchdb" when I first got the slice, and the install seemed to
go well. When I ran "curl -X GET localhost:5984" after the install, it
correctly printed:
{"couchdb":"Welcome","version":"0.10.0"}

I have no idea why the init.d script can't stop the server on CouchDB
0.8.0 and 0.10.0


On Wed, Nov 11, 2009 at 7:45 AM, Mikhail A. Pokidko
<mi...@gmail.com> wrote:
> On Wed, Nov 11, 2009 at 2:31 AM, Noah Slater <ns...@tumbolia.org> wrote:
>> Great, what happens when you do:
>>
>>        couchdb -b
>>
>> Is CouchDB running?
>>
>> What happens when you do this next:
>>
>>        couchdb -d
>>
>> Has CouchDB stopped?
>
>
> Also it could be useful to add "-p /path/to/pid_file" in each case.
>
>
>
>
> --
> xmpp: pma AT altlinux DOT org
>

Re: /etc/init.d/couchdb stop never really stops the db

Posted by "Mikhail A. Pokidko" <mi...@gmail.com>.
On Wed, Nov 11, 2009 at 2:31 AM, Noah Slater <ns...@tumbolia.org> wrote:
> Great, what happens when you do:
>
>        couchdb -b
>
> Is CouchDB running?
>
> What happens when you do this next:
>
>        couchdb -d
>
> Has CouchDB stopped?


Also it could be useful to add "-p /path/to/pid_file" in each case.




-- 
xmpp: pma AT altlinux DOT org

Re: /etc/init.d/couchdb stop never really stops the db

Posted by Noah Slater <ns...@tumbolia.org>.
On 11 Nov 2009, at 15:37, Robert Campbell wrote:

> /usr/bin/couchdb: 1: cannot create /var/run/couchdb/couchdb.pid:
> Permission denied

This looks key.

Check the ownership of that file.

Check the user you are running CouchDB as.

You probably need to run all CouchDB commands with this prepended:

	sudo -u couchdb

Hope this helps.

Re: /etc/init.d/couchdb stop never really stops the db

Posted by Paul Davis <pa...@gmail.com>.
Can you make sure and kill the existing beam processes and rerunning this?

On Wed, Nov 11, 2009 at 10:37 AM, Robert Campbell <rr...@gmail.com> wrote:
> Hi Noah, here is the result of running "couchdb -d" after the change:
>
> rrc@default:/usr/bin$ ps -A | grep couchdb
>  4389 ?        00:00:00 couchdb
>  4419 ?        00:00:00 couchdb
>  6399 ?        00:00:07 couchdb
> rrc@default:/usr/bin$ couchdb -d
> + BACKGROUND=false
> + DEFAULT_CONFIG_DIR=/etc/couchdb/default.d
> + DEFAULT_CONFIG_FILE=/etc/couchdb/default.ini
> + HEART_BEAT_TIMEOUT=11
> + HEART_COMMAND=/usr/bin/couchdb -k
> + INTERACTIVE=false
> + KILL=false
> + LOCAL_CONFIG_DIR=/etc/couchdb/local.d
> + LOCAL_CONFIG_FILE=/etc/couchdb/local.ini
> + PID_FILE=/var/run/couchdb/couchdb.pid
> + RECURSED=false
> + RESET_CONFIG=true
> + RESPAWN_TIMEOUT=0
> + SCRIPT_ERROR=1
> + SCRIPT_OK=0
> + SHUTDOWN=false
> + STDERR_FILE=couchdb.stderr
> + STDOUT_FILE=couchdb.stdout
> + print_arguments=
> + start_arguments=
> + background_start_arguments=
> + xulrunner-1.9.1 --gre-version
> + LD_LIBRARY_PATH=:/usr/lib/xulrunner-1.9.1.4/
> + export LD_LIBRARY_PATH
> + basename /usr/bin/couchdb
> + basename=couchdb
> + parse_script_option_list -d
> + _load_config
> + _add_config_file /etc/couchdb/default.ini
> + test -n
> + test -z
> + print_arguments=/etc/couchdb/default.ini
> + start_arguments= \"/etc/couchdb/default.ini\"
> + background_start_arguments= -a \"/etc/couchdb/default.ini\"
> + _add_config_dir /etc/couchdb/default.d
> + find /etc/couchdb/default.d -mindepth 1 -maxdepth 1 -type f
> + _add_config_file /etc/couchdb/local.ini
> + test -n  \"/etc/couchdb/default.ini\"
> + start_arguments= \"/etc/couchdb/default.ini\",
> + test -z /etc/couchdb/default.ini
> + cat
> + print_arguments=/etc/couchdb/default.ini
> /etc/couchdb/local.ini
> + start_arguments= \"/etc/couchdb/default.ini\",  \"/etc/couchdb/local.ini\"
> + background_start_arguments= -a \"/etc/couchdb/default.ini\" -a
> \"/etc/couchdb/local.ini\"
> + _add_config_dir /etc/couchdb/local.d
> + find /etc/couchdb/local.d -mindepth 1 -maxdepth 1 -type f
> + set +e
> + getopt hVa:A:ncibp:r:Ro:e:skd -d
> + options= -d --
> + test ! 0 -eq 0
> + set -e
> + eval set -- -d --
> + set -- -d --
> + [ 2 -gt 0 ]
> + shift
> + SHUTDOWN=true
> + [ 1 -gt 0 ]
> + shift
> + break
> + test false = true -o true = true
> + stop_couchdb false
> + _get_pid
> + test -f /var/run/couchdb/couchdb.pid
> + cat /var/run/couchdb/couchdb.pid
> + PID=367
> + echo 367
> + PID=367
> + test -n 367
> + test false = false
> /usr/bin/couchdb: 1: cannot create /var/run/couchdb/couchdb.pid:
> Permission denied
> + echo
> rrc@default:/usr/bin$ ps -A | grep couchdb
>  4389 ?        00:00:00 couchdb
>  4419 ?        00:00:00 couchdb
>  6399 ?        00:00:07 couchdb
> rrc@default:/usr/bin$ curl -X GET localhost:5984
> {"couchdb":"Welcome","version":"0.10.0"}
> rrc@default:/usr/bin$
>
>
>
> On Wed, Nov 11, 2009 at 4:31 PM, Noah Slater <ns...@tumbolia.org> wrote:
>>
>> On 11 Nov 2009, at 11:54, Robert Campbell wrote:
>>
>>> Sorry, I screwed that up. I saw the d as b for some reason. Here's the
>>> results from -d:
>>>
>>> root@default:~# ps -A | grep couchdb
>>> 4389 ?        00:00:00 couchdb
>>> 4419 ?        00:00:00 couchdb
>>> 6399 ?        00:00:05 couchdb
>>> root@default:~# couchdb -d
>>> root@default:~# ps -A | grep couchdb
>>> 4389 ?        00:00:00 couchdb
>>> 4419 ?        00:00:00 couchdb
>>> 6399 ?        00:00:05 couchdb
>>> root@default:~# curl -X GET localhost:5984
>>> {"couchdb":"Welcome","version":"0.10.0"}
>>> root@default:~#
>>>
>>> So basically it doesn't seem to do anything. The processes are still
>>> running and the couchdb server is still responding to requests.
>>
>> Please change the top of your /usr/bin/couchdb script to look like:
>>
>>        #!/bin/sh -ex
>>
>> And then try this again, pasting all the output.
>>
>>
>

Re: /etc/init.d/couchdb stop never really stops the db

Posted by Robert Campbell <rr...@gmail.com>.
Hi Noah, here is the result of running "couchdb -d" after the change:

rrc@default:/usr/bin$ ps -A | grep couchdb
 4389 ?        00:00:00 couchdb
 4419 ?        00:00:00 couchdb
 6399 ?        00:00:07 couchdb
rrc@default:/usr/bin$ couchdb -d
+ BACKGROUND=false
+ DEFAULT_CONFIG_DIR=/etc/couchdb/default.d
+ DEFAULT_CONFIG_FILE=/etc/couchdb/default.ini
+ HEART_BEAT_TIMEOUT=11
+ HEART_COMMAND=/usr/bin/couchdb -k
+ INTERACTIVE=false
+ KILL=false
+ LOCAL_CONFIG_DIR=/etc/couchdb/local.d
+ LOCAL_CONFIG_FILE=/etc/couchdb/local.ini
+ PID_FILE=/var/run/couchdb/couchdb.pid
+ RECURSED=false
+ RESET_CONFIG=true
+ RESPAWN_TIMEOUT=0
+ SCRIPT_ERROR=1
+ SCRIPT_OK=0
+ SHUTDOWN=false
+ STDERR_FILE=couchdb.stderr
+ STDOUT_FILE=couchdb.stdout
+ print_arguments=
+ start_arguments=
+ background_start_arguments=
+ xulrunner-1.9.1 --gre-version
+ LD_LIBRARY_PATH=:/usr/lib/xulrunner-1.9.1.4/
+ export LD_LIBRARY_PATH
+ basename /usr/bin/couchdb
+ basename=couchdb
+ parse_script_option_list -d
+ _load_config
+ _add_config_file /etc/couchdb/default.ini
+ test -n
+ test -z
+ print_arguments=/etc/couchdb/default.ini
+ start_arguments= \"/etc/couchdb/default.ini\"
+ background_start_arguments= -a \"/etc/couchdb/default.ini\"
+ _add_config_dir /etc/couchdb/default.d
+ find /etc/couchdb/default.d -mindepth 1 -maxdepth 1 -type f
+ _add_config_file /etc/couchdb/local.ini
+ test -n  \"/etc/couchdb/default.ini\"
+ start_arguments= \"/etc/couchdb/default.ini\",
+ test -z /etc/couchdb/default.ini
+ cat
+ print_arguments=/etc/couchdb/default.ini
/etc/couchdb/local.ini
+ start_arguments= \"/etc/couchdb/default.ini\",  \"/etc/couchdb/local.ini\"
+ background_start_arguments= -a \"/etc/couchdb/default.ini\" -a
\"/etc/couchdb/local.ini\"
+ _add_config_dir /etc/couchdb/local.d
+ find /etc/couchdb/local.d -mindepth 1 -maxdepth 1 -type f
+ set +e
+ getopt hVa:A:ncibp:r:Ro:e:skd -d
+ options= -d --
+ test ! 0 -eq 0
+ set -e
+ eval set -- -d --
+ set -- -d --
+ [ 2 -gt 0 ]
+ shift
+ SHUTDOWN=true
+ [ 1 -gt 0 ]
+ shift
+ break
+ test false = true -o true = true
+ stop_couchdb false
+ _get_pid
+ test -f /var/run/couchdb/couchdb.pid
+ cat /var/run/couchdb/couchdb.pid
+ PID=367
+ echo 367
+ PID=367
+ test -n 367
+ test false = false
/usr/bin/couchdb: 1: cannot create /var/run/couchdb/couchdb.pid:
Permission denied
+ echo
rrc@default:/usr/bin$ ps -A | grep couchdb
 4389 ?        00:00:00 couchdb
 4419 ?        00:00:00 couchdb
 6399 ?        00:00:07 couchdb
rrc@default:/usr/bin$ curl -X GET localhost:5984
{"couchdb":"Welcome","version":"0.10.0"}
rrc@default:/usr/bin$



On Wed, Nov 11, 2009 at 4:31 PM, Noah Slater <ns...@tumbolia.org> wrote:
>
> On 11 Nov 2009, at 11:54, Robert Campbell wrote:
>
>> Sorry, I screwed that up. I saw the d as b for some reason. Here's the
>> results from -d:
>>
>> root@default:~# ps -A | grep couchdb
>> 4389 ?        00:00:00 couchdb
>> 4419 ?        00:00:00 couchdb
>> 6399 ?        00:00:05 couchdb
>> root@default:~# couchdb -d
>> root@default:~# ps -A | grep couchdb
>> 4389 ?        00:00:00 couchdb
>> 4419 ?        00:00:00 couchdb
>> 6399 ?        00:00:05 couchdb
>> root@default:~# curl -X GET localhost:5984
>> {"couchdb":"Welcome","version":"0.10.0"}
>> root@default:~#
>>
>> So basically it doesn't seem to do anything. The processes are still
>> running and the couchdb server is still responding to requests.
>
> Please change the top of your /usr/bin/couchdb script to look like:
>
>        #!/bin/sh -ex
>
> And then try this again, pasting all the output.
>
>

Re: /etc/init.d/couchdb stop never really stops the db

Posted by Noah Slater <ns...@tumbolia.org>.
On 11 Nov 2009, at 11:54, Robert Campbell wrote:

> Sorry, I screwed that up. I saw the d as b for some reason. Here's the
> results from -d:
>
> root@default:~# ps -A | grep couchdb
> 4389 ?        00:00:00 couchdb
> 4419 ?        00:00:00 couchdb
> 6399 ?        00:00:05 couchdb
> root@default:~# couchdb -d
> root@default:~# ps -A | grep couchdb
> 4389 ?        00:00:00 couchdb
> 4419 ?        00:00:00 couchdb
> 6399 ?        00:00:05 couchdb
> root@default:~# curl -X GET localhost:5984
> {"couchdb":"Welcome","version":"0.10.0"}
> root@default:~#
>
> So basically it doesn't seem to do anything. The processes are still
> running and the couchdb server is still responding to requests.

Please change the top of your /usr/bin/couchdb script to look like:

	#!/bin/sh -ex

And then try this again, pasting all the output.


Re: /etc/init.d/couchdb stop never really stops the db

Posted by Noah Slater <ns...@tumbolia.org>.
On 11 Nov 2009, at 15:39, Robert Campbell wrote:

> Apache CouchDB needs write permission on the STDOUT file:  
> couchdb.stdout


If you don't specify a PID file on the command line, it tries to write  
it to the current directory.

If the couchdb user doesn't have the permissions to do that, it will  
fail.

Either specify the PID file via the command line, or change directory  
to one where the couchdb user has permission to write, which should  
be /var/lib/couchdb if memory serves.


Re: /etc/init.d/couchdb stop never really stops the db

Posted by Robert Campbell <rr...@gmail.com>.
Noah, here is the result of the PID run as the couchdb user:

rrc@default:/usr/bin$ sudo -u couchdb couchdb -b -p /var/run/couchdb
+ BACKGROUND=false
+ DEFAULT_CONFIG_DIR=/etc/couchdb/default.d
+ DEFAULT_CONFIG_FILE=/etc/couchdb/default.ini
+ HEART_BEAT_TIMEOUT=11
+ HEART_COMMAND=/usr/bin/couchdb -k
+ INTERACTIVE=false
+ KILL=false
+ LOCAL_CONFIG_DIR=/etc/couchdb/local.d
+ LOCAL_CONFIG_FILE=/etc/couchdb/local.ini
+ PID_FILE=/var/run/couchdb/couchdb.pid
+ RECURSED=false
+ RESET_CONFIG=true
+ RESPAWN_TIMEOUT=0
+ SCRIPT_ERROR=1
+ SCRIPT_OK=0
+ SHUTDOWN=false
+ STDERR_FILE=couchdb.stderr
+ STDOUT_FILE=couchdb.stdout
+ print_arguments=
+ start_arguments=
+ background_start_arguments=
+ xulrunner-1.9.1 --gre-version
+ LD_LIBRARY_PATH=:/usr/lib/xulrunner-1.9.1.4/
+ export LD_LIBRARY_PATH
+ basename /usr/bin/couchdb
+ basename=couchdb
+ parse_script_option_list -b -p /var/run/couchdb
+ _load_config
+ _add_config_file /etc/couchdb/default.ini
+ test -n
+ test -z
+ print_arguments=/etc/couchdb/default.ini
+ start_arguments= \"/etc/couchdb/default.ini\"
+ background_start_arguments= -a \"/etc/couchdb/default.ini\"
+ _add_config_dir /etc/couchdb/default.d
+ find /etc/couchdb/default.d -mindepth 1 -maxdepth 1 -type f
+ _add_config_file /etc/couchdb/local.ini
+ test -n  \"/etc/couchdb/default.ini\"
+ start_arguments= \"/etc/couchdb/default.ini\",
+ test -z /etc/couchdb/default.ini
+ cat
+ print_arguments=/etc/couchdb/default.ini
/etc/couchdb/local.ini
+ start_arguments= \"/etc/couchdb/default.ini\",  \"/etc/couchdb/local.ini\"
+ background_start_arguments= -a \"/etc/couchdb/default.ini\" -a
\"/etc/couchdb/local.ini\"
+ _add_config_dir /etc/couchdb/local.d
+ find /etc/couchdb/local.d -mindepth 1 -maxdepth 1 -type f
+ set +e
+ getopt hVa:A:ncibp:r:Ro:e:skd -b -p /var/run/couchdb
+ options= -b -p /var/run/couchdb --
+ test ! 0 -eq 0
+ set -e
+ eval set -- -b -p /var/run/couchdb --
+ set -- -b -p /var/run/couchdb --
+ [ 4 -gt 0 ]
+ shift
+ BACKGROUND=true
+ [ 3 -gt 0 ]
+ shift
+ PID_FILE=/var/run/couchdb
+ shift
+ [ 1 -gt 0 ]
+ shift
+ break
+ test false = true -o false = true
+ start_couchdb
+ test ! false = true
+ check_status
+ check_environment
+ test true != true
+ touch /var/run/couchdb
+ touch couchdb.stdout
+ true
+ touch couchdb.stderr
+ true
+ message_prefix=Apache CouchDB needs write permission on the
+ test ! -w /var/run/couchdb
+ test ! -w couchdb.stdout
+ echo Apache CouchDB needs write permission on the STDOUT file: couchdb.stdout
Apache CouchDB needs write permission on the STDOUT file: couchdb.stdout
+ false
rrc@default:/usr/bin$




On Wed, Nov 11, 2009 at 4:32 PM, Noah Slater <ns...@tumbolia.org> wrote:
>
> On 11 Nov 2009, at 13:53, Robert Campbell wrote:
>
>> @Mikhail - but when I tried to specify the PID file I found in
>> /var/run, it didn't work:
>>
>> root@default:~# couchdb -b -p /var/run/couchdb
>> Apache CouchDB needs a regular PID file: /var/run/couchdb
>
> You likely don't have permissions to do this.
>
> Could you try running it as the couchdb user, like this:
>
>        sudo -u couchdb couchdb -b -p /var/run/couchdb
>
> What happens then?
>
>> I just want the init.d scripts to work as they're supposed to. Is
>> there some special trick you have to perform after "apt-get install
>> couchdb"? I can't imagine I'm the only one whose init.d/couchdb won't
>> stop the DB in two completely different Ubuntu & CouchDB versions and
>> installations.
>
> No, this is a bug, that much is certain.
>
>

Re: /etc/init.d/couchdb stop never really stops the db

Posted by Noah Slater <ns...@tumbolia.org>.
On 11 Nov 2009, at 13:53, Robert Campbell wrote:

> @Mikhail - but when I tried to specify the PID file I found in
> /var/run, it didn't work:
>
> root@default:~# couchdb -b -p /var/run/couchdb
> Apache CouchDB needs a regular PID file: /var/run/couchdb

You likely don't have permissions to do this.

Could you try running it as the couchdb user, like this:

	sudo -u couchdb couchdb -b -p /var/run/couchdb

What happens then?

> I just want the init.d scripts to work as they're supposed to. Is
> there some special trick you have to perform after "apt-get install
> couchdb"? I can't imagine I'm the only one whose init.d/couchdb won't
> stop the DB in two completely different Ubuntu & CouchDB versions and
> installations.

No, this is a bug, that much is certain.


Re: /etc/init.d/couchdb stop never really stops the db

Posted by Adam Petty <ad...@gmail.com>.
I can verify same issues on both 32 and 64 bit 9.10 installs.

Also... try /etc/init.d/couchdb restart... watch what happens to the log
file.

My log file filled  up to over a gig, overnight.  All with errors because
couchdb never stopped - but it kept trying to restart and getting a "port in
use" error (over and over).

Now I'm just running from source in debug mode - until this all gets
resolved.

On Wed, Nov 11, 2009 at 8:53 AM, Robert Campbell <rr...@gmail.com> wrote:

> @Mikhail - but when I tried to specify the PID file I found in
> /var/run, it didn't work:
>
> root@default:~# couchdb -b -p /var/run/couchdb
> Apache CouchDB needs a regular PID file: /var/run/couchdb
>
> I just want the init.d scripts to work as they're supposed to. Is
> there some special trick you have to perform after "apt-get install
> couchdb"? I can't imagine I'm the only one whose init.d/couchdb won't
> stop the DB in two completely different Ubuntu & CouchDB versions and
> installations.
>
>
>
>
> On Wed, Nov 11, 2009 at 12:57 PM, Mikhail A. Pokidko
> <mi...@gmail.com> wrote:
> > On Wed, Nov 11, 2009 at 2:54 PM, Robert Campbell <rr...@gmail.com>
> wrote:
> >> Sorry, I screwed that up. I saw the d as b for some reason. Here's the
> >> results from -d:
> >>
> >> root@default:~# ps -A | grep couchdb
> >>  4389 ?        00:00:00 couchdb
> >>  4419 ?        00:00:00 couchdb
> >>  6399 ?        00:00:05 couchdb
> >> root@default:~# couchdb -d
> >> root@default:~# ps -A | grep couchdb
> >>  4389 ?        00:00:00 couchdb
> >>  4419 ?        00:00:00 couchdb
> >>  6399 ?        00:00:05 couchdb
> >> root@default:~# curl -X GET localhost:5984
> >> {"couchdb":"Welcome","version":"0.10.0"}
> >> root@default:~#
> >>
> >> So basically it doesn't seem to do anything. The processes are still
> >> running and the couchdb server is still responding to requests.
> >
> > That`s why i prefer to indicate pid explicitly) You can be sure that
> > you operate with instance you exactly need.
> >
> >
> >
> >
> > --
> > xmpp: pma AT altlinux DOT org
> >
>

Re: /etc/init.d/couchdb stop never really stops the db

Posted by "Mikhail A. Pokidko" <mi...@gmail.com>.
On Wed, Nov 11, 2009 at 7:24 PM, Noah Slater <ns...@tumbolia.org> wrote:
>
> On 11 Nov 2009, at 16:11, Mikhail A. Pokidko wrote:
>
>> Well, i guess it is kinda ALT-specific.
>>
>>
>> http://git.altlinux.org/people/pma/packages/couchdb.git?p=couchdb.git;f=couch.init;hb=0.10.x-alt
>
> So nothing we should pull upstream?

I`ll be glad if someone would take a look at this script (see link)
and git (git diff 0.10.x 0.10.x-alt) at all.
Noah, if you are interested i can test the one at debian and gentoo.





-- 
xmpp: pma AT altlinux DOT org

Re: /etc/init.d/couchdb stop never really stops the db

Posted by Noah Slater <ns...@tumbolia.org>.
On 11 Nov 2009, at 16:11, Mikhail A. Pokidko wrote:

> Well, i guess it is kinda ALT-specific.
>
> http://git.altlinux.org/people/pma/packages/couchdb.git?p=couchdb.git;f=couch.init;hb=0.10.x-alt

So nothing we should pull upstream?

Re: /etc/init.d/couchdb stop never really stops the db

Posted by "Mikhail A. Pokidko" <mi...@gmail.com>.
On Wed, Nov 11, 2009 at 6:33 PM, Noah Slater <ns...@tumbolia.org> wrote:
>
> On 11 Nov 2009, at 14:15, Mikhail A. Pokidko wrote:
>
>> To build package for ALTLinux i had to rewrite init-script completely.
>
> Why? Is there a patch you could send up-stream? Thanks.

Well, i guess it is kinda ALT-specific.

http://git.altlinux.org/people/pma/packages/couchdb.git?p=couchdb.git;f=couch.init;hb=0.10.x-alt



-- 
xmpp: pma AT altlinux DOT org

Re: /etc/init.d/couchdb stop never really stops the db

Posted by Noah Slater <ns...@tumbolia.org>.
On 11 Nov 2009, at 14:15, Mikhail A. Pokidko wrote:

> To build package for ALTLinux i had to rewrite init-script completely.

Why? Is there a patch you could send up-stream? Thanks.

Re: /etc/init.d/couchdb stop never really stops the db

Posted by "Mikhail A. Pokidko" <mi...@gmail.com>.
On Wed, Nov 11, 2009 at 4:53 PM, Robert Campbell <rr...@gmail.com> wrote:
> @Mikhail - but when I tried to specify the PID file I found in
> /var/run, it didn't work:
>
> root@default:~# couchdb -b -p /var/run/couchdb
> Apache CouchDB needs a regular PID file: /var/run/couchdb

Look inside that file - is that pid correct? (compare with actual pid
-- ps aux|grep couchdb)

Are you sure you use correct PID file?

[solar@nameless ~/tmp]$ sudo ls -l /var/run/|grep couchdb
-rw-r--r-- 1 _couchdb root          5 Nov 11 15:25 couchdb.pid
[solar@nameless ~/tmp]$ sudo cat /var/run/couchdb.pid
23529[solar@nameless ~/tmp]$
[solar@nameless ~/tmp]$ ps aux|grep couchdb|grep beam
_couchdb 23529  0.3  0.5  73264 16904 ?        Sl   15:25   0:22
/usr/lib/erlang/erts-5.6.5/bin/beam.smp -Bd -K true -- -root
/usr/lib/erlang -progname erl -- -home /var/lib/couchd

> I just want the init.d scripts to work as they're supposed to.

Just looks inside init-script and verify everything.
To build package for ALTLinux i had to rewrite init-script completely.


-- 
xmpp: pma AT altlinux DOT org

Re: /etc/init.d/couchdb stop never really stops the db

Posted by Robert Campbell <rr...@gmail.com>.
@Mikhail - but when I tried to specify the PID file I found in
/var/run, it didn't work:

root@default:~# couchdb -b -p /var/run/couchdb
Apache CouchDB needs a regular PID file: /var/run/couchdb

I just want the init.d scripts to work as they're supposed to. Is
there some special trick you have to perform after "apt-get install
couchdb"? I can't imagine I'm the only one whose init.d/couchdb won't
stop the DB in two completely different Ubuntu & CouchDB versions and
installations.




On Wed, Nov 11, 2009 at 12:57 PM, Mikhail A. Pokidko
<mi...@gmail.com> wrote:
> On Wed, Nov 11, 2009 at 2:54 PM, Robert Campbell <rr...@gmail.com> wrote:
>> Sorry, I screwed that up. I saw the d as b for some reason. Here's the
>> results from -d:
>>
>> root@default:~# ps -A | grep couchdb
>>  4389 ?        00:00:00 couchdb
>>  4419 ?        00:00:00 couchdb
>>  6399 ?        00:00:05 couchdb
>> root@default:~# couchdb -d
>> root@default:~# ps -A | grep couchdb
>>  4389 ?        00:00:00 couchdb
>>  4419 ?        00:00:00 couchdb
>>  6399 ?        00:00:05 couchdb
>> root@default:~# curl -X GET localhost:5984
>> {"couchdb":"Welcome","version":"0.10.0"}
>> root@default:~#
>>
>> So basically it doesn't seem to do anything. The processes are still
>> running and the couchdb server is still responding to requests.
>
> That`s why i prefer to indicate pid explicitly) You can be sure that
> you operate with instance you exactly need.
>
>
>
>
> --
> xmpp: pma AT altlinux DOT org
>

Re: /etc/init.d/couchdb stop never really stops the db

Posted by "Mikhail A. Pokidko" <mi...@gmail.com>.
On Wed, Nov 11, 2009 at 2:54 PM, Robert Campbell <rr...@gmail.com> wrote:
> Sorry, I screwed that up. I saw the d as b for some reason. Here's the
> results from -d:
>
> root@default:~# ps -A | grep couchdb
>  4389 ?        00:00:00 couchdb
>  4419 ?        00:00:00 couchdb
>  6399 ?        00:00:05 couchdb
> root@default:~# couchdb -d
> root@default:~# ps -A | grep couchdb
>  4389 ?        00:00:00 couchdb
>  4419 ?        00:00:00 couchdb
>  6399 ?        00:00:05 couchdb
> root@default:~# curl -X GET localhost:5984
> {"couchdb":"Welcome","version":"0.10.0"}
> root@default:~#
>
> So basically it doesn't seem to do anything. The processes are still
> running and the couchdb server is still responding to requests.

That`s why i prefer to indicate pid explicitly) You can be sure that
you operate with instance you exactly need.




-- 
xmpp: pma AT altlinux DOT org

Re: /etc/init.d/couchdb stop never really stops the db

Posted by Robert Campbell <rr...@gmail.com>.
Sorry, I screwed that up. I saw the d as b for some reason. Here's the
results from -d:

root@default:~# ps -A | grep couchdb
 4389 ?        00:00:00 couchdb
 4419 ?        00:00:00 couchdb
 6399 ?        00:00:05 couchdb
root@default:~# couchdb -d
root@default:~# ps -A | grep couchdb
 4389 ?        00:00:00 couchdb
 4419 ?        00:00:00 couchdb
 6399 ?        00:00:05 couchdb
root@default:~# curl -X GET localhost:5984
{"couchdb":"Welcome","version":"0.10.0"}
root@default:~#

So basically it doesn't seem to do anything. The processes are still
running and the couchdb server is still responding to requests.


On Wed, Nov 11, 2009 at 12:07 PM, Mikhail A. Pokidko
<mi...@gmail.com> wrote:
> On Wed, Nov 11, 2009 at 1:54 PM, Robert Campbell <rr...@gmail.com> wrote:
>> Here is me running "couchdb -b" three times w/ps -A | grep couchdb:
>>
>> root@default:~# couchdb -b
>> Apache CouchDB has started, time to relax.
>> root@default:~# couchdb -b
>> Apache CouchDB has started, time to relax.
>
> _-d_ is the clue.
>
> After successful start-up you should try to stop couchdb manually
> with -d option.
>
>
> --
> xmpp: pma AT altlinux DOT org
>

Re: /etc/init.d/couchdb stop never really stops the db

Posted by "Mikhail A. Pokidko" <mi...@gmail.com>.
On Wed, Nov 11, 2009 at 1:54 PM, Robert Campbell <rr...@gmail.com> wrote:
> Here is me running "couchdb -b" three times w/ps -A | grep couchdb:
>
> root@default:~# couchdb -b
> Apache CouchDB has started, time to relax.
> root@default:~# couchdb -b
> Apache CouchDB has started, time to relax.

_-d_ is the clue.

After successful start-up you should try to stop couchdb manually
with -d option.


-- 
xmpp: pma AT altlinux DOT org

Re: /etc/init.d/couchdb stop never really stops the db

Posted by Robert Campbell <rr...@gmail.com>.
Here is me running "couchdb -b" three times w/ps -A | grep couchdb:

root@default:~# couchdb -b
Apache CouchDB has started, time to relax.
root@default:~# couchdb -b
Apache CouchDB has started, time to relax.
root@default:~# ps -A | grep couchdb
 4389 ?        00:00:00 couchdb
 4419 ?        00:00:00 couchdb
 6399 ?        00:00:05 couchdb
root@default:~# couchdb -b
Apache CouchDB has started, time to relax.
root@default:~# ps -A | grep couchdb
 4389 ?        00:00:00 couchdb
 4419 ?        00:00:00 couchdb
 6399 ?        00:00:05 couchdb




On Wed, Nov 11, 2009 at 12:31 AM, Noah Slater <ns...@tumbolia.org> wrote:
> Great, what happens when you do:
>
>        couchdb -b
>
> Is CouchDB running?
>
> What happens when you do this next:
>
>        couchdb -d
>
> Has CouchDB stopped?
>
> If it hasn't stopped for this last thing, can you do the same hashbang
> change for:
>
>        /usr/bin/couchdb
>
> Or whatever it is called on your system.
>

Re: /etc/init.d/couchdb stop never really stops the db

Posted by Noah Slater <ns...@tumbolia.org>.
Great, what happens when you do:

	couchdb -b

Is CouchDB running?

What happens when you do this next:

	couchdb -d

Has CouchDB stopped?

If it hasn't stopped for this last thing, can you do the same hashbang  
change for:

	/usr/bin/couchdb

Or whatever it is called on your system.

Re: /etc/init.d/couchdb stop never really stops the db

Posted by Robert Campbell <rr...@gmail.com>.
root@default:/etc/init.d# ./couchdb stop
+ SCRIPT_OK=0
+ SCRIPT_ERROR=1
+ DESCRIPTION=database server
+ NAME=couchdb
+ basename ./couchdb
+ SCRIPT_NAME=couchdb
+ COUCHDB=/usr/bin/couchdb
+ CONFIGURATION_FILE=/etc/default/couchdb
+ RUN_DIR=/var/run/couchdb
+ LSB_LIBRARY=/lib/lsb/init-functions
+ test ! -x /usr/bin/couchdb
+ test -r /etc/default/couchdb
+ . /etc/default/couchdb
+ COUCHDB_USER=couchdb
+ COUCHDB_STDOUT_FILE=/dev/null
+ COUCHDB_STDERR_FILE=/dev/null
+ COUCHDB_RESPAWN_TIMEOUT=5
+ COUCHDB_OPTIONS=
+ test -r /lib/lsb/init-functions
+ . /lib/lsb/init-functions
+ FANCYTTY=
+ [ -e /etc/lsb-base-logging.sh ]
+ . /etc/lsb-base-logging.sh
+ parse_script_option_list stop
+ log_daemon_msg Stopping database server couchdb
+ [ -z Stopping database server ]
+ log_use_usplash
+ [ n = y ]
+ type usplash_write
+ log_to_console log_daemon_msg Stopping database server couchdb
+ [ n != y ]
+ [ no != yes ]
+ readlink /proc/self/fd/0
+ stdin=/dev/pts/2
+ [ /dev/pts/2 != /dev/pts/2 ]
+ return 0
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ -t 1 ]
+ [ xxterm != x ]
+ [ xxterm != xdumb ]
+ [ -x /usr/bin/tput ]
+ [ -x /usr/bin/expr ]
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ [ -z ]
+ FANCYTTY=1
+ true
+ /usr/bin/tput xenl
+ /usr/bin/tput cols
+ COLS=207
+ [ 207 ]
+ [ 207 -gt 6 ]
+ /usr/bin/expr 207 - 7
+ COL=200
+ printf  * Stopping database server couchdb
 * Stopping database server couchdb       + /usr/bin/expr 207 - 1
+ /usr/bin/tput hpa 206


                                                                +
printf
 + stop_couchdb
+ command=/usr/bin/couchdb -d
+ test -n
+ test -n couchdb
+ su couchdb -c /usr/bin/couchdb -d
+ return 0
+ log_end_msg 0
+ [ -z 0 ]
+ log_use_usplash
+ [ n = y ]
+ type usplash_write
+ log_to_console log_end_msg 0
+ [ n != y ]
+ [ no != yes ]
+ readlink /proc/self/fd/0
+ stdin=/dev/pts/2
+ [ /dev/pts/2 != /dev/pts/2 ]
+ return 0
+ [ 200 ]
+ [ -x /usr/bin/tput ]
+ printf \r
+ /usr/bin/tput hpa 200


                                                          + [ 0 -eq 0
]
+ echo [ OK ]
[ OK ]
+ return 0
root@default:/etc/init.d#


On Tue, Nov 10, 2009 at 8:48 PM, Noah Slater <ns...@tumbolia.org> wrote:
>
> On 10 Nov 2009, at 19:41, Robert Campbell wrote:
>
>> I've run 0.8.0 and now 0.10.0 on Ubuntu 9.04/9.10 server and in both
>> cases calling stop never actually stopped the DB. The only way I've
>> gotten around it in the past is manually killing the couchdb
>> processes. Why doesn't stop work for me?
>>
>> I've installed it via "apt-get install couchdb" and the only thing
>> I've modified is local.ini, BindAddress=0.0.0.0 to get remote access
>> working. Nothing else was ever changed.
>
> Change the top line to "#!/bin/sh -ex" and rerun as root, then paste the
> output here.
>

Re: /etc/init.d/couchdb stop never really stops the db

Posted by Noah Slater <ns...@tumbolia.org>.
On 10 Nov 2009, at 19:41, Robert Campbell wrote:

> I've run 0.8.0 and now 0.10.0 on Ubuntu 9.04/9.10 server and in both
> cases calling stop never actually stopped the DB. The only way I've
> gotten around it in the past is manually killing the couchdb
> processes. Why doesn't stop work for me?
>
> I've installed it via "apt-get install couchdb" and the only thing
> I've modified is local.ini, BindAddress=0.0.0.0 to get remote access
> working. Nothing else was ever changed.

Change the top line to "#!/bin/sh -ex" and rerun as root, then paste  
the output here.