windows开机自启zookeeper
时间: 2023-10-15 19:25:15 浏览: 291
要在Windows上实现Zookeeper的开机自启动,可以按照以下步骤进行配置:
1. 首先,确保已经下载并安装好Zookeeper的安装包。将安装包解压到指定的目录,例如C:\zookeeper。
2. 在Zookeeper的安装目录下找到bin文件夹,并双击运行zkServer.cmd文件,确保Zookeeper能够正常启动。
3. 创建一个新的文件,命名为zkServerStop.cmd,用于停止Zookeeper服务。在这个文件中,输入以下命令:
```
@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
```
4. 使用管理员权限打开命令提示符,将当前目录切换到Zookeeper的安装目录下的bin文件夹。
5. 执行以下命令来将Zookeeper配置成Windows服务:
```
.\zkServer.cmd install
```
6. 接下来,需要配置Zookeeper服务的启动类型为自动。执行以下命令:
```
sc config Zookeeper start=auto
```
7. 最后,启动Zookeeper服务并设置其为开机自启动。执行以下命令:
```
.\zkServer.cmd start
```
现在,Zookeeper已经成功配置成了Windows的开机自启动服务。每次开机后,Zookeeper服务会自动启动。
请注意,在停止Zookeeper服务时,可能会弹出一个窗口提示,但实际上服务已经停止了。
<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [make-windows-service.zip](https://download.csdn.net/download/chemphone/12492524)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Zookeeper安装入门并配置为Windows服务开机自动启动](https://blog.csdn.net/weixin_44248278/article/details/117730713)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文