eureka-server自己也是一个微服务,所以eureka-server在启动的时候也会将自己注册到eureka上。eureka集群的时候,会将多个eureka相互注册,这个时候,defaultZone的值会有多个,用逗号隔开。
- "1.0" encoding="UTF-8"?>
"http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-
cloud-demo -
com.xkj.org -
1.0-SNAPSHOT -
-
4.0.0 -
eureka-server -
-
-
8 -
8 -
-
-
-
-
org.springframework.cloud -
spring-cloud-starter-netflix-eureka-server -
-
-
- server:
- port: 10086
- spring:
- application:
- name: eureka-server #eureka服务名称
- eureka:
- client:
- service-url:
- defaultZone: http://localhost:10086/eureka #eureka地址信息,
- @SpringBootApplication
- @EnableEurekaServer
- public class EurekaApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(EurekaApplication.class, args);
- }
- }
