zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Salabhanjika S <salabhanji...@gmail.com>
Subject Re: Query regarding Zookeeper Windows API start/stop, using Zk as a windows service(using prunsrv)
Date Fri, 14 Mar 2014 06:47:25 GMT
Response inline.

> I am using zookeeper in my product.
Which version of ZooKeeper you are using?

> While working with zookeeper on Windows, I am creating a service(using prunsrv) ,
> I have few queries and issues. Listed them all,
One mail per query/issue would be better. I feel keeping the mail
compactwill help you to get quick responses.

> Issues:
> 1)      zkServer.cmd didn't start on Win server 2008 machine & Win 7 Enterprise(64
bit both), had to replace the following line,
> java "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" -cp
> to
> java "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" -cp
>               And it worked, could it be fixed in some other way?

start/stop from command line is not yet supported for windows.
ZOOKEEPER-1122 is still open.

> 2)      In the zoo.cnf I specified the dataDir, still it creates some other directory
(bin/zookeeper-3.4.5zookeeper-3.4.5data/ version-2/snapshot) and stores the snapshots there.

You may use relative path.

You need to esacpe correctly if you need to use absolute paths.

> Queries:
> 1)      There is no start/stop with zkServer.cmd as it is in zkServer.sh, so basically
it is started with zkServer.cmd but to stop I do a Ctrl+C/Z
> So if I start the process, it is a foreground process and gets killed when I do a ctrl+C


> 2)      I have to create a zookeeper service, and I am using prunsrv to do that. I figured
out the following 2 ways to do so.
> a)       prunsrv //IS//Zookeeper --DisplayName=" ZOOKEEPER Service" --Description=" ZOOKEEPER
Service" --Startup=auto --StartMode=exe --StartPath=%ZOOKEEPER_HOME% --StartImage=%ZOOKEEPER_HOME%\bin\zkServer.cmd
--StopTimeout=5 --LogPath=%LOGS_DIR% --LogPrefix=zookeeper --LogLevel=Info --PidFile=zookeeper.pid
--StdOutput=auto --StdError=auto
> b)      cd %ZOOKEEPER_HOME%\bin\
>                         call "%~dp0zkEnv.cmd"
>                         set ZOOMAIN=org.apache.zookeeper.server.quorum.QuorumPeerMain
>                         prunsrv //IS//Zookeeper --DisplayName=" ZOOKEEPER Service" --Description="
ZOOKEEPER Service" --Jvm="%JVM_DLL%" --JvmOptions=!JAVA_OPTS!  --Environment=zookeeper.log.dir=%ZOO_LOG_DIR%;zookeeper.root.logger=%ZOO_LOG4J_PROP%;
--Startup=auto --LibraryPath=%LIB_DIR% --StartMode=jvm --Classpath=%CLASSPATH% %ZOOMAIN% %ZOOCFG%
--StartClass=org.apache.zookeeper.server.quorum.QuorumPeerMain --StartMethod=start --StopMode=jvm
--StopClass=org.apache.zookeeper.server.quorum.QuorumPeerMain --StopMethod=stop --StopTimeout=10
--LogPath=%LOGS_DIR% --LogPrefix=zookeeper --LogLevel=Info --PidFile=zookeeper.pid --StdOutput=auto
> basically in the second approach I am myself doing all tasks done by the zkServer.cmd
> =>> My Query is in the second step(2b), that to stop  the service there should
be a stop method exposed, so that when I stop the service it is called.
> So right now if I create a service and start it, ZK runs fine, but stopping it takes
indefinitely, so I have to go and kill the process.
> Is there some stop() for the same, I see a shutdown() but there is no description for
> I went through the class org.apache.zookeeper.server.quorum.QuorumPeerMain, here the
main() is the start method( if my understanding is correct), and there should be some method
to shutdown the process.
> https://issues.apache.org/jira/browse/ZOOKEEPER-1122, exposes a start/stop, but the stop
has some issues
> it throws the following error:
> E:\zookeeper-3.4.5\zookeeper-3.4.5\bin>zkServer.cmd stop
> "JMX enabled by default"
> "Using config: E:\zookeeper-3.4.5\zookeeper-3.4.5\bin\..\conf\zoo.cfg"
> "Stopping zookeeper ... "
> ERROR: The process with PID 452 (child process of PID 4) could not be terminated.
> Reason: This is critical system process. Taskkill cannot end this process.
> ERROR: The process with PID 4 (child process of PID 0) could not be terminated.
> Reason: Access is denied.
> ERROR: The process with PID 0 (child process of PID 0) could not be terminated.
> Reason: This is critical system process. Taskkill cannot end this process.
Windows services runs under protected more. ZooKeeper shutdown is
based on kill signal. This doesn't work when you install ZooKeeper as
a windows service. This results in error you see.
Try installing ZooKeeper as a console application which you should be
able to stop by pressing Ctrl+C

> I am running this stop command on a Administrator console.
> E:\zookeeper-3.4.5\zookeeper-3.4.5\bin>tasklist | findstr "java"
> java.exe                     10324 Console                    1     36,036 K.
> Any help will be highlt appreciated,
> Thanks,
> Nandini

View raw message