目录
-
- 1. Nacos Server 安装
- 2. Nacos client安装
-
-
-
- 2.1 引入坐标
- 2.2 添加配置(application.yml)
- 2.3 添加注解
- 2.4 检验安装
-
-
1. Nacos Server 安装
下载地址: `https://wwa.lanzous.com/iCRjPfkwd3i`
官网下载地址: `https://github.com/alibaba/nacos/releases`
下载安装完成之后运行
startup.cmd
/startup.sh
2. Nacos client安装
2.1 引入坐标
<properties><java.version>1.8</java.version><spring-cloud.version>Greenwich.SR5</spring-cloud.version><spring-cloud.alibaba.version>2.1.0.RELEASE</spring-cloud.alibaba.version>
</properties>
<!--spring cloud alibaba-->
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency><dependencyManagement><dependencies><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-alibaba-dependencies</artifactId><version>${spring-cloud.alibaba.version}</version><type>pom</type><scope>import</scope></dependency></dependencies>
</dependencyManagement>
2.2 添加配置(application.yml)
server:# tomcat 端口 port: 7000spring:application:# 应用名 name: gulimail-couponcloud:nacos:discovery:# Nacos server 地址 默认端口为 8848server-addr: 127.0.0.1:8848
2.3 添加注解
@EnableDiscoveryClient
@SpringBootApplication
public class GulimailCouponApplication {
public static void main(String[] args) {
SpringApplication.run(GulimailCouponApplication.class, args);}
}
启动器类加入注解
@EnableDiscoveryClient
2.4 检验安装
浏览器访问 Nacos Server
输入localhost:8848/nacos
用户名: nacos
密码: nacos
看到如下结果说明
成功安装