springcloud注册中心eureka

本文介绍了Spring Cloud Eureka作为微服务注册中心的作用,展示了如何搭建一个单个Eureka服务实例。接着,通过配置创建了注册中心集群,确保高可用性。即使其中一个节点故障,其他节点仍能保持服务间的通信。
摘要由CSDN通过智能技术生成

springcloud注册中心eureka

​ 注册中心是连接各个微服务的桥梁,当注册中心服务端启动后,各个注册的微服务可看作是其客户端,各个微服务之间的可通过注册中心交互。

单个注册中心

image-20201014093705557

image-20201014093741580

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>spring-cloud</artifactId>
        <groupId>com.huang</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>springcloud-eureka-7001</artifactId>
   <dependencies>
       <dependency>
           <groupId>org.springframework.cloud</groupId>
           <artifactId>spring-cloud-starter-eureka-server</artifactId>
           <version>1.4.6.RELEASE</version>
       </dependency>
       <dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-devtools</artifactId>
       </dependency>
   </dependencies>
</project>

结果

image-20201014094237733

注册中心集群

建立三个注册中心服务,然后配置相互关联

image-20201014094635535

image-20201014094708988

image-20201014094738267

image-20201014094823240

image-20201014095802355

可以看到,三个注册中心已经关联,如果其中一个挂掉,另外两个可以继续使用。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值