Nacos等设置为windows自启动服务

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1:下载WinSW https://www.aliyundrive.com/s/eXPRJq7tR9C
2:在nacos的bin目录下,将下载的winsw.exe拷贝到此目录下,并重命名为NacosWinService.exe(其他服务同理)
3:在nacos的bin目录下新建配置文件NacosWinService.xml,写入服务的相关配置:
nacos: <?xml version="1.0" encoding="UTF-8"?>
<service>
<id>NacosWinService</id>
<name>NacosWinService</name>
<description>NacosWinService</description>
<executable>%BASE%\startup.cmd</executable>
<arguments>-m standalone</arguments>
<logpath>%BASE%\serviceLogs</logpath>
</service>

seata <?xml version="1.0" encoding="UTF-8"?>
<service>
<id>SeataWinService</id>
<name>SeataWinService</name>
<description>NacosWinService</description>
<executable>%BASE%\seata-server.bat</executable>
<logpath>%BASE%\serviceLogs</logpath>
</service>


startup.cmd 启动脚本名称 serviceLogs 日志目录
4:以管理员权限cmd到nacos的bin目录,执行以下命令:
安装服务:NacosWinService.exe install
启动服务:net start NacosWinService
5:停止服务
net stop NacosWinService 或者直接去win服务管理停止
6:卸载
NacosWinService.exe uninstall

上次更新 2022-11-18