Return-Path: X-Original-To: apmail-zookeeper-user-archive@www.apache.org Delivered-To: apmail-zookeeper-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4081D10D34 for ; Fri, 14 Mar 2014 06:48:01 +0000 (UTC) Received: (qmail 40024 invoked by uid 500); 14 Mar 2014 06:47:58 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 39569 invoked by uid 500); 14 Mar 2014 06:47:56 -0000 Mailing-List: contact user-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@zookeeper.apache.org Delivered-To: mailing list user@zookeeper.apache.org Received: (qmail 39552 invoked by uid 99); 14 Mar 2014 06:47:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Mar 2014 06:47:54 +0000 X-ASF-Spam-Status: No, hits=-0.5 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of salabhanjika9@gmail.com designates 209.85.216.66 as permitted sender) Received: from [209.85.216.66] (HELO mail-qa0-f66.google.com) (209.85.216.66) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Mar 2014 06:47:47 +0000 Received: by mail-qa0-f66.google.com with SMTP id m5so686387qaj.5 for ; Thu, 13 Mar 2014 23:47:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=i7pwe2eKeH7ZBHK6GK8r9RZJOlf+m7wNJ6hl587FYRo=; b=qzYnUdkLLdin7fJB5WCXsObq5vNtjXHxWxONtUkENssT++Dhof/jYR4T8TzLuV2Yu2 9Yh5uL6inGtwt8A7qqkQNeLXG9dkqwzsX984kLX/93atDIZy2P60OwB9sWlWRw/hApKj 3RSkKoJBlw+/yjoGEM6PrGv2ND2xTsRkFX2itWA9hwCXuQq8Kq8LRd41f8zDkwVdMk0R D3IicCZbkejuMmfyCxVJWR2of/GuZglgPQ02xlUItoQBRaIWyE2PaT7jkM2vGa9zypmh rDsJCGrBxzdxNm0Wc2GzI4TPDNINBLo45edGpvlEFu4PX7+XBDDRGYjwIOoxz8aAB7yc tNrA== MIME-Version: 1.0 X-Received: by 10.140.80.176 with SMTP id c45mr7128291qgd.79.1394779645833; Thu, 13 Mar 2014 23:47:25 -0700 (PDT) Received: by 10.140.85.135 with HTTP; Thu, 13 Mar 2014 23:47:25 -0700 (PDT) In-Reply-To: <2d53afc0549a4e1dabab605cc4299316@BY2PR03MB474.namprd03.prod.outlook.com> References: <2d53afc0549a4e1dabab605cc4299316@BY2PR03MB474.namprd03.prod.outlook.com> Date: Fri, 14 Mar 2014 12:17:25 +0530 Message-ID: Subject: Re: Query regarding Zookeeper Windows API start/stop, using Zk as a windows service(using prunsrv) From: Salabhanjika S To: user@zookeeper.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org 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 pr= unsrv) , > 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 Ente= rprise(64 bit both), had to replace the following line, > > java "-Dzookeeper.log.dir=3D%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=3D%ZO= O_LOG4J_PROP%" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOOCFG%" %* > > to > > java "-Dzookeeper.log.dir=3D%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=3D%ZO= O_LOG4J_PROP%" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOOCFG%" > 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 oth= er directory (bin/zookeeper-3.4.5zookeeper-3.4.5data/ version-2/snapshot) a= nd stores the snapshots there. You may use relative path. dataDir=3D../data You need to esacpe correctly if you need to use absolute paths. dataDir=3DC\:\\tools\\zookeeper-3.3.6\\data > > 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 whe= n I do a ctrl+C Yes > > > 2) I have to create a zookeeper service, and I am using prunsrv to d= o that. I figured out the following 2 ways to do so. > > > > a) prunsrv //IS//Zookeeper --DisplayName=3D" ZOOKEEPER Service" --D= escription=3D" ZOOKEEPER Service" --Startup=3Dauto --StartMode=3Dexe --Star= tPath=3D%ZOOKEEPER_HOME% --StartImage=3D%ZOOKEEPER_HOME%\bin\zkServer.cmd -= -StopTimeout=3D5 --LogPath=3D%LOGS_DIR% --LogPrefix=3Dzookeeper --LogLevel= =3DInfo --PidFile=3Dzookeeper.pid --StdOutput=3Dauto --StdError=3Dauto > > > > > b) cd %ZOOKEEPER_HOME%\bin\ > call "%~dp0zkEnv.cmd" > set ZOOMAIN=3Dorg.apache.zookeeper.server.quorum.= QuorumPeerMain > prunsrv //IS//Zookeeper --DisplayName=3D" ZOOKEEP= ER Service" --Description=3D" ZOOKEEPER Service" --Jvm=3D"%JVM_DLL%" --JvmO= ptions=3D!JAVA_OPTS! --Environment=3Dzookeeper.log.dir=3D%ZOO_LOG_DIR%;zoo= keeper.root.logger=3D%ZOO_LOG4J_PROP%; --Startup=3Dauto --LibraryPath=3D%LI= B_DIR% --StartMode=3Djvm --Classpath=3D%CLASSPATH% %ZOOMAIN% %ZOOCFG% --Sta= rtClass=3Dorg.apache.zookeeper.server.quorum.QuorumPeerMain --StartMethod= =3Dstart --StopMode=3Djvm --StopClass=3Dorg.apache.zookeeper.server.quorum.= QuorumPeerMain --StopMethod=3Dstop --StopTimeout=3D10 --LogPath=3D%LOGS_DIR= % --LogPrefix=3Dzookeeper --LogLevel=3DInfo --PidFile=3Dzookeeper.pid --Std= Output=3Dauto --StdError=3Dauto > > basically in the second approach I am myself doing all tasks done by the = zkServer.cmd > > =3D>> 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 cal= led. > So right now if I create a service and start it, ZK runs fine, but stoppi= ng 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 des= cription for it > > I went through the class org.apache.zookeeper.server.quorum.QuorumPeerMai= n, here the main() is the start method( if my understanding is correct), an= d there should be some method to shutdown the process. > > > https://issues.apache.org/jira/browse/ZOOKEEPER-1122, exposes a start/sto= p, 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 ter= minated. > 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 termi= nated. > Reason: Access is denied. > ERROR: The process with PID 0 (child process of PID 0) could not be termi= nated. > Reason: This is critical system process. Taskkill cannot end this process= . > STOPED > 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,03= 6 K. > > > Any help will be highlt appreciated, > > Thanks, > Nandini