zoukankan      html  css  js  c++  java
  • Eureka-服务注册与发现组件

    一、Eureka是Netflix开发的服务组件

      本身是一个基于REST的服务,Spring Cloud将它集成在其子项目spring-cloud-netflix中,以实现Spring cloud的服务发现功能

      

    Eureka 他的源码在github上面:
    https://github.com/Netflix/eureka/
    他的文档:
    https://github.com/Netflix/eureka/wiki
    他的架构介绍:High level architecture:
    https://github.com/Netflix/eureka/wiki/Eureka-at-a-glance

    二、Eureka主要概念

      1、Eureka使用了AWS里的区域(Region)和可用区(Availability Zone,AZ)

      

           2、Eureka架构图

      

      Register:服务注册

      Renew:服务的续期

      Cancel:服务下线(客户端主动发起)

      Eviction:服务剔除(90秒)

      Application Serivce:服务生产者

      Application Client:服务消费者

           us-east-1c:美东区域

    三、Eureka在微服务中的应用

      1、Application.properties:

    server.port=8761
    #取消向eureka server(注册中心)注册
    eureka.client.register-with-eureka=false
    #取消向eureka server(注册中心)获取注册信息
    eureka.client.fetch-registry=false
    #eureka 提供服务发现的地址
    eureka.client.service-url.defaultZone=http://localhost:8761/eureka

      2、启动类增加注解@EnableEurekaServer

    #加入spring cloud父POM及spring-cloud-starter-eureka-server
    <dependency>
    	<groupId>org.springframework.cloud</groupId>
    	<artifactId>spring-cloud-starter-eureka-server</artifactId>
    </dependency>

      3、为Eureka增加安全访问

        a、EurekaServer中:pom.xml

    <dependency>
    	<groupId>org.springframework.boot</groupId>
    	<artifactId>spring-boot-starter-security</artifactId>
    </dependency>

        b、EurekaServer中:application.properties

    #eureka 提供服务发现的地址
    eureka.client.service-url.defaultZone=http://zhy:777@localhost:8761/eureka
    #eureka.client.service-url.defaultZone=http://localhost:8761/eureka
    # 安全模块
    security.basic.enabled=true
    security.user.name=zhy
    security.user.password=777
    

      

  • 相关阅读:
    web策略类游戏开发(五)数据库表设计
    web策略类游戏开发(一) WebGame架构篇
    SQL Server2005之初体验!
    SQL SERVER2005关于如何找到表的说明。
    脚本实现CheckBox父选中,子全选中,子选中父也选中!
    今天看到人家系统中有此效果,不知道是怎么实现的。
    忆风伶夜雨
    GridView双击某行弹出一新窗口!
    DIV位置永恒居中。
    关于:装了Visual.SourceSafe.2005之后,打开VS2005文件,找不到源代码管理这项的问题
  • 原文地址:https://www.cnblogs.com/gamehiboy/p/9072158.html
Copyright © 2011-2022 走看看