1.安装nacos客户端(windows)
下载地址:https://github.com/alibaba/nacos/releases
因为gitee仓库没有发行版,所以给的是git原地址,可能要*
2.下载压缩包解压
3.命令或双击启动
Linux/Unix/Mac:sh startup.sh -m standalone
Windows:cmd startup.cmd -m standalone
windows有些情况不用加cmd
Windows:startup.cmd -m standalone
启动成功:
4.访问Nacos客户端
http://127.0.0.1:8848/nacos/
5.创建SpringBoot服务,注册到Nacos
依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Finchley.SR1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>0.2.2.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
配置
spring.application.name=alibaba-nacos-discovery-server
server.port=8701
# nacos 服务地址(不用加协议不用加路径)
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
可以同一个应用开多个端口启动两个测试
查看Nacos客户端