1.新建一個SpringBoot項目
新建時選中Eureka Server依賴
2.Eureka 配置
2.1在啓動類上添加註解@EnableEurekaServer
@SpringBootApplication
@EnableEurekaServer //註冊中心的服務端
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
2.2配置application.properties文件
#端口號
server.port=8761
#實例地址
eureka.instance.hostname=localhost
eureka.client.service-url.defaultZone=http://${eureka.instance.hostname}:${server.port}
#禁止自己當作服務註冊
eureka.client.register-with-eureka=false
#屏蔽註冊信息
eureka.client.fetch-registry=false
#關閉自我保護(不推薦)
eureka.server.enable-self-preservation=false
#關閉“沒有用於註冊服務器的副本節點”的警告信息
logging.level.com.netflix.eureka=off
logging.level.com.netflix.discovery=off
配置成功訪問頁面如下
此博文僅爲自己學習記錄