You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SOP/doc/docs/files/10112_使用eureka.md

54 lines
1.0 KiB

5 years ago
# 使用eureka
## 修改网关
- 打开`/sop-gateway/pom.xml`
5 years ago
注释nacos相关依赖
添加eureka依赖:
5 years ago
```xml
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
```
- 打开sop-gateway下`application-dev.properties`
注释nacos配置
```properties
# nacos cloud配置
4 years ago
#spring.cloud.nacos.discovery.server-addr=${register.url}
#nacos.config.server-addr=${register.url}
5 years ago
```
添加eureka配置
```properties
# eureka注册中心
eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/
```
## 微服务端修改
步骤同上
## admin修改
打开`application-dev.properties`,新增配置
```properties
5 years ago
# 网关地址,多个用逗号隔开
# 在不使用nacos时有用,使用nacos时注释掉
gateway.host=127.0.0.1:8081
5 years ago
# eureka注册中心
eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/
# 如果使用eureka,填eureka,使用nacos,填eureka
registry.name=eureka
```