Nacos使用WinSW设置为Windows 系统服务,开机自启

WinSW(Windows Service Wrapper 是一个开源的 Windows 服务包装器,它可以帮助你将应用程序打包成系统服务,并实现开机自启动的功能。

nacos 安装目录 C:\plugin\nacos

下载 WinSW-x64.exe 

https://github.com/winsw/winsw/releases/tag/v2.11.0

1.使用WinSW-x64.exe 拷贝到 拷贝到nacos下 bin目录

 

2.将WinSW-x64.exe重命名为nacos-service.exe

为了方便后面输入命令,将下载下来的exe文件重命名为winsw.exe,复制到nacos的bin目录下

3.在nacos下 bin目录分别 建 winsw.xml   、 start.bat文件,编码格式为UTF-8,内容如下:

start.bat
set current_dir=%~dp0
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_311
cd %current_dir%
startup.cmd -m standalone
winsw.xml
<configuration>
<!-- ID of the service. It should be unique accross the Windows system-->
<id>nacos-2.0</id>
<!-- Display name of the service -->
<name>nacos-2.1.1</name>
<!-- Service description -->
<description>nacos-2.1.1</description>
<!-- Path to the executable, which should be started -->
<executable>start.bat</executable>
<arguments></arguments>
</configuration>

 

安装和启动 Nacos 服务

CMD 切换到 C:\plugin\nacos\bin 目录下,执行以下命令完成服务的安装和启动

# 安装服务
nacos-service.exe install
# 启动服务
nacos-service.exe start

 

在 Windows 系统服务列表可以看到 Nacos 服务(已验证可以开机自启动)

 

 

其他命令

# 删除服务
nacos-service.exe uninstall
# 查看状态
nacos-service.exe status
# 重启服务
nacos-service.exe restart

 

posted @   古月辣糖满一满  阅读(974)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示