1、概述

    Spring Cloud Netflix provides Netflix OSS integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms.

    With a few simple annotations you can quickly enable and configure the common patterns inside your application and build large distributed systems with battle-tested Netflix components.

    The patterns provided include Service Discovery (Eureka), Circuit Breaker (Hystrix), Intelligent Routing (Zuul) and Client Side Load Balancing (Ribbon).

2、Service Discovery---Eureka

    Service Discovery is one of the key tenets of a microservice-based architecture.

    Eureka is the Netflix Service Discovery Server and Client.

    2.1、Eureka server

        How to Include Eureka Server?

          To include Eureka Server in your project, use the starter with a group ID of org.springframework.cloud and an artifact ID of spring-cloud-starter-netflix-eureka-server.

        How to Run a Eureka Server?  

        EurekaServer  如何实现?:  注册中心程序嵌入@EnableEurekaServer;     

@SpringBootApplication
@EnableEurekaServer
public class Application { public static void main(String[] args) {
new SpringApplicationBuilder(Application.class).web(true).run(args);
} }

        配置文件

          eureka.client.register-with-eureka=false  由于本服务为注册中心,不向注册中心注册自己;

          eureka.client.fetch-registry=false    由于注册中心 仅维护实例,不需要检索服务;

    2.2、Eureka client

        How to Include Eureka Client?

          To include the Eureka Client in your project, use the starter with a group ID of org.springframework.cloud and an artifact ID of spring-cloud-starter-netflix-eureka-client.

        EurekaClient 功能?:  处理  服务注册、服务发现;

        EurekaClient 如何实现?: 注解、参数配置的方式,嵌入 在客户端应用程序中;

        EurekaClient 如何注册、发现?:客户端程序运行时,EurekaClient   向  EurekaServer 注册自身提供的服务 并 周期性 向EurekaServer 发送 心跳 更新 它的服务租约;

        配置文件

          eureka.client.serviceUrl.defaultZone=    注册中心地址

3、Router and Filter---Zuul

    Routing is an integral part of a microservice architecture.

    Zuul is a JVM-based router and server-side load balancer from Netflix.

    Zuul provides :Authentication、Insights、Stress Testing、Canary Testing、Dynamic Routing、Service Migration、Load Shedding、Security、Static Response handling、Active/Active traffic management.

        How to Include Zuul?

          To include Zuul in your project, use the starter with a group ID of org.springframework.cloud and a artifact ID of spring-cloud-starter-netflix-zuul.

        @EnableZuulProxy vs. @EnableZuulServer?

          @EnableZuulProxy contains all the filters installed by @EnableZuulServer.

           If you want a “blank” Zuul, you should use @EnableZuulServer. 

4、Client Side Load Balance---Ribbon

    Ribbon is a client-side load balancer that gives you a lot of control over the behavior of HTTP and TCP clients.

    Feign already uses Ribbon, so, if you use @FeignClient, this section also applies.

        How to Include Ribbon?

          To include Ribbon in your project, use the starter with a group ID of org.springframework.cloud and an artifact ID of spring-cloud-starter-netflix-ribbon.

      

SpringCloud-Nexfilx的更多相关文章

  1. 【微框架】之一:从零开始,轻松搞定SpringCloud微框架系列--开山篇(spring boot 小demo)

    Spring顶级框架有众多,那么接下的篇幅,我将重点讲解SpringCloud微框架的实现 Spring 顶级项目,包含众多,我们重点学习一下,SpringCloud项目以及SpringBoot项目 ...

  2. springcloud(第三篇)springcloud eureka 服务注册与发现 *****

    http://blog.csdn.net/liaokailin/article/details/51314001 ******************************************* ...

  3. SpringCloud Sleuth 使用

    1. 介绍   Spring-Cloud-Sleuth是Spring Cloud的组成部分之一,为SpringCloud应用实现了一种分布式追踪解决方案,其兼容了Zipkin, HTrace和log- ...

  4. SpringCloud+Consul 服务注册与服务发现

    SpringCloud+Consul 服务注册与服务发现 1. 服务注册: 在Spring.factories有一段: # Discovery Client Configuration org.spr ...

  5. SpringCloud学习后获取的地址

    关于SpringCloud + Docker 学习地址: (1) https://yq.aliyun.com/articles/57265 (2) https://yq.aliyun.com/team ...

  6. SpringCloud网关ZUUL集成consul

    最近一直在搞基于springcloud的微服务开发,为了不限定微服务开发语言,服务发现决定采用consul不多说上代码 pom文件 <project xmlns="http://mav ...

  7. springcloud(一):大话Spring Cloud

    研究了一段时间spring boot了准备向spirng cloud进发,公司架构和项目也全面拥抱了Spring Cloud.在使用了一段时间后发现Spring Cloud从技术架构上降低了对大型系统 ...

  8. springcloud(二):注册中心Eureka

    Eureka是Netflix开源的一款提供服务注册和发现的产品,它提供了完整的Service Registry和Service Discovery实现.也是springcloud体系中最重要最核心的组 ...

  9. springcloud(四):熔断器Hystrix

    说起springcloud熔断让我想起了去年股市中的熔断,多次痛的领悟,随意实施的熔断对整个系统的影响是灾难性的,好了接下来我们还是说正事. 熔断器 雪崩效应 在微服务架构中通常会有多个服务层调用,基 ...

  10. springcloud(六):配置中心(一)

    随着线上项目变的日益庞大,每个项目都散落着各种配置文件,如果采用分布式的开发模式,需要的配置文件随着服务增加而不断增多.某一个基础服务信息变更,都会引起一系列的更新和重启,运维苦不堪言也容易出错.配置 ...

随机推荐

  1. centos7中yum安装lamp环境

    一.准备工作 1.1 环境 操作系统:centos7(CentOS-7-x86_64-Minimal-1708) 硬件:(这个根据项目运行和配置建议设置,一般我先配个1核1G) 1.2 关闭selin ...

  2. laravel5.6操作数据curd写法(查询构建器)

    laravel5.6 数据库操作-查询构建器 <?php //laravel5.6 语法 demo示例 namespace App\Http\Controllers;//命名该控制App空间下名 ...

  3. Microsoft Office Word

    快捷键 选区 选择块:[Shift]+click,光标放到块的一端,然后按住Shift,然后光标放到块的另一端. 更新域: F9 右键没有更新域选项时可以使用,如更新全部域先Ctrl + A然后F9 ...

  4. 设计模式 - 装饰器模式(Decorator)

    简介 场景 通过继承和关联都可以给对象增加行为,区别如下: 继承是静态的(无法在程序运行时动态扩展),且作用于所有子类.硬编码,高耦合. 通过装饰器可以在运行时添加行为和属性到指定对象.关联关系就是在 ...

  5. 《STL源码剖析》——第五、六:关联容器与算法

    第五章.关联容器  5.0.关联容器 标准的STL关联式容器分为set(集合)和map(映射表)两大类,以及这两大类的衍生体multiset(多键集合)和multimap(多键映射表).这些容器的底层 ...

  6. Test Case Design Method - OATS

    [转载] OATS:即Orthogonal Array Testing Strategy,正交表测试策略. 1      OATS的概念: 次数(Runs):简单的说,就是次数是多少,就有多少个用例. ...

  7. 10.jmeter jsr223 javascript 深度比对json object

    function sortJSON(data, key, way) { //log.info(" " + key + " ------------------- &quo ...

  8. java Semaphore信号灯

    Semaphore实现的功能就类似2个公用电话,假如有10个人要打电话:那么只能2个人占有电话,8个需要等待.当2个人中 的任何一个人让开后,其中等待的另外8个人中又有一个人可以使用了等待的8个人中可 ...

  9. P5030 长脖子鹿放置

    题目背景 众周所知,在西洋棋中,我们有城堡.骑士.皇后.主教和长脖子鹿. 题目描述 如图所示,西洋棋的"长脖子鹿",类似于中国象棋的马,但按照"目"字攻击,且没 ...

  10. Tarjan&2-SAT 总结

    \(Tarjan\)&\(2-SAT\) 标签: 知识点总结 安利XZYXZY ps:里面的部分东西来自\(Anson\)和\(yler\)和\(XZY\) 阅读体验:https://zybu ...