Files
SOP/doc/docs/files/10112_使用eureka.md
tanghc 3ca80dd6a6 4.0.3
2020-09-24 15:01:57 +08:00

54 lines
1023 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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