Eureka是Netflix开发的一套开源服务治理框架,他依托于类似Tomcat,Jetty之类的Web容器才能启动。他类似于Zookeeper和Dubbo的集合,一般将Eureka的注册中心称为服务端,而使用Eureka将服务注册到服务端或者从服务端获取服务的应用称为Eureka的客户端。这个和Dubbo非常明显的分为Provider和Consumer不太一样。
本文将依托于Spring Boot的敏捷性快速的搭建一个Eureka的注册中心。
使用Spring Initializr创建一个Spring Boot项目:eureka-server。pom文件中需要引入的依赖如下:
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.SR5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>