idea创建eureka server应用 application类添加注解新建三个application.yml,在原配置文件上spring: profiles: active: ${active}另外三个配置如下,对应修改一下defaultZone,hostname,nameeureka: client: # 应用为注册中心,不注册自己 register-with-eureka: false # 注册中心职责是维护服务实例,不需要检索服务 fetch-registry: false service-url: defaultZone: http://localhost:8762/eureka,http://localhost:8763/eureka instance: hostname: localhost1spring: application: name: eureka-service1在idea上对这个eureka server应用复制成三个,并分别设置每个eureka server的启动参数这样就可以一份代码,启动三个eureka server应用了idea创建eureka client应用需要注意的是一定要添加web的依赖,不然会报错 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>application类添加注解在配置文件添加配置, defaultZone是eureka server地址eureka: client: service-url: defaultZone: http://localhost:8761/eureka,http://localhost:8762/eureka,http://localhost:8763/eureka instance: hostname: eurekaClientspring: application: name: eureka-client启动即可在eureka server看到对应的client信息