1. 修改windows系统的配置文件
2. 编写yml配置文件
server:
port: 8103
eureka:
instance:
hostname: eureka8103.com #eureka服务端的实例名称
client:
register-with-eureka: false #false表示不向注册中心注册自己。
fetch-registry: false #false表示自己端就是注册中心,我的职责就是维护服务实例,并不需要去检索服务
service-url:
defaultZone: http://eureka8101.com:8101/eureka/,http://eureka8102.com:8102/eureka/
3. 修改启动类
package com.system;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@EnableEurekaServer
@SpringBootApplication
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
}
}
4. 测试
http://localhost:8101/
http://localhost:8102/
http://localhost:8103/