Redis

启动 Redis

start cmd /k "cd/d c:\Redis-x64-3.2.100\&&echo start Redis &&redis-server.exe redis.windows.conf"

将 Redis 其注册为windows的服务:

redis-server --service-install redis.windows-service.conf --loglevel verbose

下载zookeeper服务插件(zip包)

http://archive.apache.org/dist/commons/daemon/binaries/windows/

本站下载 https://files.cnblogs.com/files/endv/prunsrv.7z

2.把prunsrv.exe、prunmgr.exe复制到zookeeper的bin路径下

修改zookeeper下面的文件/zookeeper/conf/zoo_sample.cfg下面的文件,改名为zoo.cfg,因为zookeeper默认使用的文件名是zoo.cfg

修改zoo.cfg文件的日志路径且路径必须存在

#dataDir=/tmp/zookeeper
dataDir=C:\apache-zookeeper-3.5.5

创建系统环境变量

zookeeper 的路径

ZOOKEEPER_HOME = C:\apache-zookeeper-3.5.5

ZOOKEEPER_SERVICE = 你 server 的名称

创建并在cmd中以管理员启动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= ^
--LogPath=%ZOOKEEPER_HOME% --LogPrefix=zookeeper-wrapper ^
--PidFile=zookeeper.pid --LogLevel=Info --StdOutput=auto --StdError=auto

install.bat

stop
 @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

zkServerStop.cmd

delete
sc delete zookeeper-3.5.5
05-28 12:07