Spring Cloud-Eureka High-Availability Cluster
环境信息:
OS:Win10
JDK:Java8
SpringCloud:Greenwich.SR2
1 Eureka Server
1.1 核心依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
1.2 开启注解
@SpringBootApplication
@EnableEurekaServer
public class CloudEurekaApplication {
public static void main(String[] args) {
SpringApplication.run(CloudEurekaApplication.class, args);
}
}
1.3 主要配置
新建三个配置文件,对应三个Eureka节点:
application-node1.yml
application-node2.yml
application-node3.yml
三个配置文件配置内容一样,不同的是:
- 端口:
server.port
分别修改为三个不同的端口:18761
18762
18763
- 名字:
spring.application.name
分别修改为三个不同的name:node1
node2