提交 aab7aa7a 编写于 作者: Q qinyingjie

fix:eureka高可用

上级 8279e992
......@@ -41,6 +41,10 @@
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId>
</dependency>
</dependencies>
......
package com.kwan.springcloud.config;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
......@@ -7,6 +8,7 @@ import org.springframework.web.client.RestTemplate;
@Configuration
public class RestConfig {
@LoadBalanced
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
......
#端口号
server:
port: 8767
spring:
application:
name: eurka-server
eureka:
instance:
hostname: localhost
client:
register-with-eureka: false #由于该应用为注册中心,所以设置 为 false, 代表不向注册中心注册自己。
fetch-registry: false #由于注册中心的职责就是维护服务实例, 它并不需要去检索服务, 所以也设置为 false。
serviceUrl:
defaultZone: http://eureka8768:8768/eureka/,http://eureka8769:8769/eureka/
\ No newline at end of file
#端口号
server:
port: 8768
spring:
application:
name: eurka-server
eureka:
instance:
hostname: localhost
client:
register-with-eureka: false #由于该应用为注册中心,所以设置 为 false, 代表不向注册中心注册自己。
fetch-registry: false #由于注册中心的职责就是维护服务实例, 它并不需要去检索服务, 所以也设置为 false。
serviceUrl:
defaultZone: http://eureka8767:8767/eureka/,http://eureka8769:8769/eureka/
\ No newline at end of file
#端口号
server:
port: 8769
spring:
application:
name: eurka-server
eureka:
instance:
hostname: localhost
client:
register-with-eureka: false #由于该应用为注册中心,所以设置 为 false, 代表不向注册中心注册自己。
fetch-registry: false #由于注册中心的职责就是维护服务实例, 它并不需要去检索服务, 所以也设置为 false。
serviceUrl:
defaultZone: http://eureka8767:8767/eureka/,http://eureka8768:8768/eureka/
\ No newline at end of file
......@@ -17,7 +17,7 @@ spring:
eureka:
client:
service-url:
defaultZone: http://localhost:8766/eureka
defaultZone: http://eureka8767:8767/eureka/,http://eureka8768:8768/eureka/,http://eureka8769:8769/eureka/
management:
endpoints:
......
......@@ -10,4 +10,4 @@ spring:
eureka:
client:
service-url:
defaultZone: http://localhost:8766/eureka
\ No newline at end of file
defaultZone: http://eureka8767:8767/eureka/,http://eureka8768:8768/eureka/,http://eureka8769:8769/eureka/
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册