1.资源下载:(zookeeper,commons-daemon-1.0.15-bin-windows)
链接:https://pan.baidu.com/s/1OUcdqpR6y0oUyLQMj1j9xQ
提取码:cl56
复制这段内容后打开百度网盘手机App,操作更方便哦
2.解压zookeeper,去zookeeper/conf目录,讲zoo_sample.cfg复制一份,命名为zoo.cfg(里面内容使用默认即可)
3.解压commons-daemon-1.0.15-bin-windows,
1)64位系统进入amd64目录,复制 prunsrv.exe 到
2)复制 commons-daemon-1.0.15-bin-windows 目录下 prunmgr.exe 到 zookeeper/bin目录下
5.为Zookeeper配置环境变量
添加
ZOOKEEPER_SERVICE
,
ZOOKEEPER_HOME
两个环境变量
ZOOKEEPER_SERVICE:服务名称(不要有中文),我这里取的是,命名为zookeeper_service
ZOOKEEPER_HOME: 取zookeeper的目录 :
环境变量配置去百度搜索吧,一大把
6.在zookeeper/bin目录下创建:zkServerStop.cmd 文件(可以创建一个txt,然后将后缀改为.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
7.在zookeeper/bin目录下创建: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
8.双击install.bat即可安装服务,再去服务里面启动即可
在任务栏点击右键–>任务管理器–>服务
默认是关闭的,点击启动即可启动zookeeper服务
如果觉得本文对您有所帮助,欢迎您扫码下图所示的支付宝和微信支付二维码对本文进行随意打赏。您的支持将鼓励我继续创作