1.控制台,服务端
下载nacos运行包,找到 nacos\bin\startup.cmd
双击 startup.cmd 运行, 默认用户名密码都是 nacos
2. 客户的配置,微服务中配置
pom
<dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> </dependency>
主启动类加上注解
@EnableDiscoveryClient
例如:
//from fhadmin.cn @EnableDiscoveryClient @SpringBootApplication public class PaymentMain9001 { public static void main(String[] args) { SpringApplication.run(PaymentMain9001.class, args); } }
yml 配置文件
server: port: 9001 spring: application: name: nacos-payment-provider cloud: nacos: discovery: server-addr: 120.92.164.250:8848 #配置的Nacos地址(本机的写localhost:8848,服务器的写IP地址) management: endpoints: web: exposure: include: '*'