参考:https://blog.youkuaiyun.com/SherlockerSun/article/details/124922756
一、下载WinSW
- win64:WinSW-x64.exe
- win32:WinSW-x86.exe
由于github上下载比较慢,提供百度网盘下载如下: - Win64
链接:https://pan.baidu.com/s/1KKFRb7BrMJGQcrgJEpvn4A
提取码:9wn2 - Win32
链接:https://pan.baidu.com/s/1__04oa0j22H2lXHGcMIZHw
提取码:aqgf
二、重命名winsw.exe
在nacos的bin目录下,将下载的winsw.exe拷贝到此目录下,并重命名为NacosWinService.exe。
三、新建NacosWinService.xml
在nacos的bin目录下新建配置文件NacosWinService.xml,写入服务的相关配置:
<?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>
四、安装与启动
以管理员权限cmd到nacos的bin目录,执行以下命令:
1)、安装服务:NacosWinService.exe install
2)、启动服务:net start NacosWinService
五、访问nacos
访问http://localhost:8848/nacos,账号密码默认都是nacos。
六、停止与卸载
1)、停止服务:net stop NacosWinService
2)、卸载服务:NacosWinService.exe uninstall