# spring-cloud-demo-2 **Repository Path**: cwbshare/spring-cloud-demo-2 ## Basic Information - **Project Name**: spring-cloud-demo-2 - **Description**: 配置使用Eureka,Zookeeper,Consul三种注册中心的示例 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-10-08 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # spring-cloud-demo-2 #### 介绍 配置使用Eureka,Zookeeper,Consul三种注册中心的示例 #### 软件架构 1. Eureka直接引用包就可以开启服务 2. Zookeeper需要安装Zookeeper服务端(比如我使用的是zookeeper-3.3.6),可以使用客户端查看器:ZooInspector 3. Consul需要启动Consul软件,比如我的consul_1.2.2_windows_amd64 #### 使用说明 1. Eureka就是启动服务就可以看到调用效果 会员服务:http://localhost:8000/getMember 订单服务:http://localhost:8001/orderToMember 页面的方式查看注册中心的服务情况 [http://localhost:8100](http://localhost:8100/) 2. Zookeeper使用客户端(ZooInspector)来查看注册的服务的信息: 会员服务:http://localhost:8000/getMember 订单服务:http://localhost:8001/orderToMember 3. Consul使用的是网页的方式来查看注册服务的信息: 在windows命令行中使用: ./consul agent -dev -ui -node=cy 就能开启Consul服务,访问地址:http://localhost:8500 会员服务:http://localhost:8000/getMember 4. 注册中心变化后,发布服务的工程需要改下注解:Eureka使用是@EnableEurekaServer,而Zookeeper和Consul是直接使用安装的软件启动的服务。 5. 注册中心变化后,调用服务需要改变的有:Eureka使用是@EnableEurekaClient,而Zookeeper和Consul是直接EnableDiscoveryClient,配置文件也要改成对应服务的配置名称及端口号,还有MAVEN依赖也需要变。