eureka-server单节点的搭建
1.导包:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
2.配置文件 .yaml:
server:
port: 6060
eureka:
client:
service-url:
defaultZone: http://peer1:6060/eureka/
instance:
hostname: peer1 #在主机system32/drivers/etc/hosts下配置:127.0.0.0 peer1
spring:
application:
name: cloud-eureka-server
3.在启动类上添加注解:
@EnableEurekaServer
访问地址:peer1:6060
若出现上图说明:eureka单节点搭建成功