Describe the bug Please provide details of the problem, including the version of Spring Cloud that you are using. Spring boot : 2.2.2.RESLEASE Srping cloud : Hoxton.SR1
Anyone can help me? I am running 2 Eureka Servers, all servers are up, but the Eureka Server's Dashboard displaying the replicas in the unavailable-replicas section. I don't know, why replicas displaying in the unavailable-replicas section?
my eureka server1 pom
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
my eureka server2 pom
```pom
my eureka server1 main class
```Java
@SpringBootApplication
@EnableEurekaServer
public class EurekaServer {
public static void main(String[] args) {
SpringApplication.run(EurekaServer.class, args);
}
}
my eureka server2 main class
@SpringBootApplication
@EnableEurekaServer
public class EurekaServer2 {
public static void main(String[] args) {
SpringApplication.run(EurekaServer2.class, args);
}
}
my eureka server1 application.yml
server:
port: 7001
eureka:
instance:
hostname: eureka7001.com
client:
fetch-registry: false
register-with-eureka: false
service-url:
defaulZone: http://eureka7002.com:7002/eureka/
my eureka server2 application.yml
server:
port: 7002
eureka:
instance:
hostname: eureka7002.com
client:
fetch-registry: false
register-with-eureka: false
service-url:
defaulZone: http://eureka7001.com:7001/eureka/
My hosts file (windows10) 127.0.0.1 eureka7001.com 127.0.0.1 eureka7002.com
Thanks
Comment From: spencergibb
Please learn how to properly format code and logs.
why do you have register-with-eureka: false and fetch-registry: false?
Comment From: Pengpengwanga
Please learn how to properly format code and logs.
why do you have register-with-eureka: false and fetch-registry: false?
Thanks for your reply. I am try update the value of fetch-registry to true, but the STS‘ s console will have the error :
c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eureka/}
com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect
I already config the hostname and port for the eureka server, Why it's the default endpoint?
Comment From: Pengpengwanga
BTW, should i set the value of register-with-eureka is true? it means the eureka server register itself?
Comment From: Pengpengwanga
When i run the eureka server, the console of STS will show these logs:
2020-04-28 11:35:40.650 INFO 2372 --- [ main] c.n.eureka.DefaultEurekaServerContext : Initializing ...
2020-04-28 11:35:40.652 INFO 2372 --- [ main] c.n.eureka.cluster.PeerEurekaNodes : Adding new peer nodes [http://localhost:8761/eureka/]
2020-04-28 11:35:41.119 INFO 2372 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2020-04-28 11:35:41.119 INFO 2372 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2020-04-28 11:35:41.119 INFO 2372 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2020-04-28 11:35:41.119 INFO 2372 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2020-04-28 11:35:41.234 INFO 2372 --- [ main] c.n.eureka.cluster.PeerEurekaNodes : Replica node URL: http://localhost:8761/eureka/
I am already modify the defaultZone such as my eureka server1 application.yml , i don't konw why the replica node is the default endpoint.
Comment From: Pengpengwanga
Please learn how to properly format code and logs.
why do you have register-with-eureka: false and fetch-registry: false?
It's my spelling mistake. it should be defaultZone in the applycation.yml file, not be defaulZone. Thank you very much.