Eureka嵌入式部署笔记
一、集群部署
1.1 创建微服务

1.2 pom文件
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
1.3 配置文件
server.port=7001
spring.application.name=eureka_server
# eureka服务端的实例名称
eureka.instance.hostname=www.eureka7001.com
# 表示不向注册中心注册自己
eureka.client.register-with-eureka=true
# false表示自己就是注册中心,负责维护服务实例,并不需要检索服务
eureka.client.fetch-registry=true
# 设置与Eureka Server交互的地址,查询服务和注册服务都需要依赖这个地址
eureka.client.service-url.defaultZone=http://www.eureka7001.com:7001/eureka/,http://www.eureka7002.com:7002/eureka/,http://www.eureka7003.com:7003/eureka/