Quantcast

stop script not working

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

stop script not working

Michael Bauland
Hi,

I'm running the ZooKeeper on three different servers. The following info
is printed by ZooKeeper when starting it with the zkServer start script:

Server environment:java.io.tmpdir=/tmp
Server environment:java.compiler=<NA>
Server environment:os.name=Linux
Server environment:os.arch=amd64
Server environment:os.version=2.6.24-25-server

Whenever I then try to stop the server on any of those servers with the
same script using 'stop' as parameter, the script is executed and it says:

JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Stopping zookeeper ...
/zookeeper_server.pid file server1/data

And that's it. A further status command tells me the server is still
running. I always have to kill the process to really stop the server.
This is not actually a problem, but it makes me wonder if there's maybe
some other hidden problem which causes this behaviour and might cause
other (not yet noticed) bigger problems!?

Thank you for any help or suggestions.

Michael

--

Michael Bauland
[hidden email]
bauland.tel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stop script not working

Patrick Hunt
This is zk 3.2.2? Are you sure that's all it said on start? When I start
I see:

$ bin/zkServer.sh start
JMX enabled by default
Using config: /home/phunt/dev/workspace/gitzk/bin/../conf/zoo.cfg
Starting zookeeper ...
STARTED

you might have some error case, for example if I start zk w/o having a
datadir created (via mkdir) I see the following:

bin/zkServer.sh start
JMX enabled by default
Using config: /home/phunt/dev/workspace/gitzk/bin/../conf/zoo.cfg
Starting zookeeper ...
bin/zkServer.sh: 120: cannot create /tmp/zktmp/zookeeper_server.pid:
Directory nonexistent
STARTED

in which case stop also does not stop the server (as the pid file is
never created during start, used during stop)

Are you setting up/startting/stopping as the same user (correct
permissions?)

After start you should check if your datadir contains a
zookeeper_server.pid file and that the pid in the file is the same as
the java process running zk.

the location/name of the pid file is defined as the following by
zkServer.sh:
ZOOPIDFILE=$(grep dataDir $ZOOCFG | sed -e 's/.*=//')/zookeeper_server.pid
(your config file has a dataDir entry which is the directory of your
data directory correct? what does your config file look like?)

Also I see this in your output which is unusual:

"/zookeeper_server.pid file server1/data"

we are trying to :
     kill -9 $(cat $ZOOPIDFILE)

perhaps ZOOPIDFILE is not getting set correctly (try adding some 'echo'
lines to the zkServer.sh script, it may help you debug)

Patrick

Michael Bauland wrote:

> Hi,
>
> I'm running the ZooKeeper on three different servers. The following info
> is printed by ZooKeeper when starting it with the zkServer start script:
>
> Server environment:java.io.tmpdir=/tmp
> Server environment:java.compiler=<NA>
> Server environment:os.name=Linux
> Server environment:os.arch=amd64
> Server environment:os.version=2.6.24-25-server
>
> Whenever I then try to stop the server on any of those servers with the
> same script using 'stop' as parameter, the script is executed and it says:
>
> JMX enabled by default
> Using config: /opt/zookeeper/bin/../conf/zoo.cfg
> Stopping zookeeper ...
> /zookeeper_server.pid file server1/data
>
> And that's it. A further status command tells me the server is still
> running. I always have to kill the process to really stop the server.
> This is not actually a problem, but it makes me wonder if there's maybe
> some other hidden problem which causes this behaviour and might cause
> other (not yet noticed) bigger problems!?
>
> Thank you for any help or suggestions.
>
> Michael
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stop script not working

Michael Bauland
Hi Patrick,

thank you very much for you quick reply.

With your help I found the problem. The variable $ZOOPIDFILE in the
zkServer.sh script containted the following (weird) string:

/zookeeper_server.pidver1/data

And this of course doesn't work. The problem was that in the zoo.cfg
file I had DOS carriage returns. :-(
For some reason this didn't bother the snapshots and logs, as they were
written to my data diretory. But the PID file wasn't there.
Once I fixed this and used UNIX carriage returns, everything works. I
can stop zookeeper now. :-)

Sorry for this stupid error and thanks again for your help.

Cheers,

Michael


--

Michael Bauland
[hidden email]
bauland.tel
Loading...