Tomcat
Find service.bat in the bin directory
Open the CMD window and execute this command
service.bat install tomcat8
Zookeeper
First download a plug-in package, attach the address
Index of /dist/commons/daemon/binaries/windows
Pull directly to the bottom to find the latest zip
After downloading, unzip and copy prunmgr.exe and prunsrv.exe to the bin directory of the ZooKeepe installation path
It's these two things
Create a new file named install.bat
prunsrv.exe "//IS//%ZOOKEEPER_SERVICE%" ^
--DisplayName="Zookeeper (%ZOOKEEPER_SERVICE%)" ^
--Description="Zookeeper (%ZOOKEEPER_SERVICE%)" ^
--Startup=auto --StartMode=exe ^
--StartPath=%ZOOKEEPER_HOME% ^
--StartImage=%ZOOKEEPER_HOME%\bin\zkServer.cmd ^
--StopPath=%ZOOKEEPER_HOME%\ ^
--StopImage=%ZOOKEEPER_HOME%\bin\zkServerStop.cmd ^
--StopMode=exe --StopTimeout=5 ^
--LogPath=%ZOOKEEPER_HOME% --LogPrefix=zookeeper-wrapper ^
--PidFile=zookeeper.pid --LogLevel=Info --StdOutput=auto --StdError=auto
Create a new file named zkServerStop.cmd
@echo off
setlocal
TASKLIST /svc | findstr /c:"%ZOOKEEPER_SERVICE%" > %ZOOKEEPER_HOME%\zookeeper_svc.pid
FOR /F "tokens=2 delims= " %%G IN (%ZOOKEEPER_HOME%\zookeeper_svc.pid) DO (
@set zkPID=%%G
)
taskkill /PID %zkPID% /T /F
del %ZOOKEEPER_HOME%/zookeeper_svc.pid
endlocal
New environment variable
ZOOKEEPER_HOME 你的安装路径
ZOOKEEPER_SERVICE zkserver
Start the install.bat file as an administrator and you're done.