SpringCloud-Nexfilx
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的更多相关文章
- 【微框架】之一:从零开始,轻松搞定SpringCloud微框架系列--开山篇(spring boot 小demo)
Spring顶级框架有众多,那么接下的篇幅,我将重点讲解SpringCloud微框架的实现 Spring 顶级项目,包含众多,我们重点学习一下,SpringCloud项目以及SpringBoot项目 ...
- springcloud(第三篇)springcloud eureka 服务注册与发现 *****
http://blog.csdn.net/liaokailin/article/details/51314001 ******************************************* ...
- SpringCloud Sleuth 使用
1. 介绍 Spring-Cloud-Sleuth是Spring Cloud的组成部分之一,为SpringCloud应用实现了一种分布式追踪解决方案,其兼容了Zipkin, HTrace和log- ...
- SpringCloud+Consul 服务注册与服务发现
SpringCloud+Consul 服务注册与服务发现 1. 服务注册: 在Spring.factories有一段: # Discovery Client Configuration org.spr ...
- SpringCloud学习后获取的地址
关于SpringCloud + Docker 学习地址: (1) https://yq.aliyun.com/articles/57265 (2) https://yq.aliyun.com/team ...
- SpringCloud网关ZUUL集成consul
最近一直在搞基于springcloud的微服务开发,为了不限定微服务开发语言,服务发现决定采用consul不多说上代码 pom文件 <project xmlns="http://mav ...
- springcloud(一):大话Spring Cloud
研究了一段时间spring boot了准备向spirng cloud进发,公司架构和项目也全面拥抱了Spring Cloud.在使用了一段时间后发现Spring Cloud从技术架构上降低了对大型系统 ...
- springcloud(二):注册中心Eureka
Eureka是Netflix开源的一款提供服务注册和发现的产品,它提供了完整的Service Registry和Service Discovery实现.也是springcloud体系中最重要最核心的组 ...
- springcloud(四):熔断器Hystrix
说起springcloud熔断让我想起了去年股市中的熔断,多次痛的领悟,随意实施的熔断对整个系统的影响是灾难性的,好了接下来我们还是说正事. 熔断器 雪崩效应 在微服务架构中通常会有多个服务层调用,基 ...
- springcloud(六):配置中心(一)
随着线上项目变的日益庞大,每个项目都散落着各种配置文件,如果采用分布式的开发模式,需要的配置文件随着服务增加而不断增多.某一个基础服务信息变更,都会引起一系列的更新和重启,运维苦不堪言也容易出错.配置 ...
随机推荐
- 20180826(04)-Java序列化
Java序列化 Java 提供了一种对象序列化的机制,该机制中,一个对象可以被表示为一个字节序列,该字节序列包括该对象的数据.有关对象的类型的信息和存储在对象中数据的类型 将序列化对象写入文件之后,可 ...
- [CSP-S模拟测试]:chess(搜索+最短路)
题目描述 $pig$在下象棋的时候特别喜欢用马,他总是计算着自己的马还需要几步才能吃掉对方的帅,以及方案数的个数,当然$pig$很笨,所以他只能求助于你.我们假设在$n\times m$的棋盘上,$p ...
- webApp 页面布局
1. 流式布局 概念:流式布局是页面元素宽度按照屏幕分辨率进行适配调整,但是整体布局不变. 设计方法:布局都是通过百分比来定义宽度,但是高度大都是用px固定的. 弊端: 虽然可以让各种屏幕适配,但是显 ...
- VBox 启动虚拟机失败 - NtCreateFile(\Device\VBoxDrvStub)
在Vbox(5.0.8 版本)启动Ubuntu的虚拟机时,遇到错误信息: NtCreateFile(\Device\VBoxDrvStub) failed: 0xc000000034 STATUS_O ...
- Java 封装 继承 多态
Java 继承 继承的概念 继承是java面向对象编程技术的一块基石,因为它允许创建分等级层次的类. 继承就是子类继承父类的特征和行为,使得子类对象(实例)具有父类的实例域和方法,或子类从父类继承方法 ...
- womenzijide_jiafenxiang
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Conten ...
- UVA 111 历史考试
题目描述:最长公共子序列的变形 题目序列中第i项是学生给第i号历史事件排出的序号,另外还给出了第i号历史事件的正确序号 求按照学生给出的序号排好历史事件后,所得的事件排序与历史事件实际发生的序列的最长 ...
- [转]Jenkins HTML报告样式无法显示问题解决
原文地址: https://vwin.github.io/2018/10/11/Jenkins-HTML%E6%8A%A5%E5%91%8A%E6%A0%B7%E5%BC%8F%E6%97%A0%E6 ...
- WCF权限认证多种方式
WCF身份验证一般常见的方式有:自定义用户名及密码验证.X509证书验证.ASP.NET成员资格(membership)验证.SOAP Header验证.Windows集成验证.WCF身份验证服务(A ...
- TensorFlow学习笔记3-从MNIST开始
TensorFlow学习笔记3-从MNIST开始学习softmax 本笔记内容为"从MNIST学习softmax regression算法的实现". 注意:由于我学习机器学习及之前 ...