服务注册中心

# 服务注册中心

Nacos

https://nacos.io/zh-cn/docs/quick-start.html
1

下载程序, 单击启动

./startup.sh -m standalone
1

查看启动日志:

cat /home/trillgates/docker/nacos/nacos/logs/start.out
1

访问地址:

ip:8848/nacos
1

账号和密码:nacos

添加依赖

<!--nacos-->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
    <version>0.9.0.RELEASE</version>
</dependency>

<!--openfeign-->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-openfeign</artifactId>
    <version>2.2.6.RELEASE</version>
</dependency>
1
2
3
4
5
6
7
8
9
10
11
12
13

开启服务发现与注册

@EnableDiscoveryClient
@EnableFeignClients
1
2

添加配置项

Spring:
     cloud:
        nacos:
          discovery:
            server-addr: 192.168.220.128:8848
1
2
3
4
5
上次更新: 2022/03/28, 23:04:38