没有合适的资源?快使用搜索试试~ 我知道了~
首页Spring Cloud Netflix【spring cloud中文版】--spring cloud中文文档.pdf
资源详情
资源评论
资源推荐
2017/2/22 SpringCloudNetflix【springcloud中文版】springcloud中文文档
https://springcloud.cc/springcloudnetflixzhcn.html 1/50
Spring Cloud Netflix
Table of Contents
关于(about)
贡献者(Contributor)
服务发现:Eureka客户端(Service Discovery: Eureka Clients)
注册到Eureka(Registering with Eureka)
对Eureka服务的身份验证(Authenticating with the Eureka Server)
健康指标和状态页面(Status Page and Health Indicator)
注册一个安全应用(Registering a Secure Application)
Eureka 健康检查(Eureka’s Health Checks)
Eureka给客户端和实例的元数据(Eureka Metadata for Instances and Clients)
使用EurekaClient(Using the EurekaClient)
代替原生的Netflix EurekaClient(Alternatives to the native Netflix EurekaClient)
为什么注册一个服务这么慢? (Why is it so Slow to Register a Service?)
服务发现: Eureka Server(Service Discovery: Eureka Server)
高可用性(High Availability, Zones and Regions)
标准模式(Standalone Mode)
节点感知(Peer Awareness)
IP偏好(Prefer IP Address)
断路器(Circuit Breaker: Hystrix Clients)
传播安全上下文或使用 Spring Scopes(Propagating the Security Context or using Spring Scopes)
健康指标(Health Indicator)
Hystrix 指标流(Hystrix Metrics Stream)
断路器: Hystrix 仪表盘(Circuit Breaker: Hystrix Dashboard)
Turbine
Turbine Stream
客户端负载均衡器(Client Side Load Balancer: Ribbon)
自定义Ribbon客户端(Customizing the Ribbon Client)
在Eureka中使用Ribbon(Using Ribbon with Eureka)
示例: 没有Eureka时如何使用Ribbon(Example: How to Use Ribbon Without Eureka)
示例:禁用Eureka使用Ribbon(Example: Disable Eureka use in Ribbon)
直接使用Ribbon的API(Using the Ribbon API Directly)
声明REST Client:Feign(Declarative REST Client: Feign)
覆盖Feign默认(Overriding Feign Defaults)
Feign Hystrix Support
Feign Hystrix Fallbacks
Feign Inheritance Support
Feign 请求/响应 压缩(Feign request/response compression)
Feign logging
外部配置: Archaius(External Configuration: Archaius)
路由和过滤器:Zuul(Router and Filter: Zuul)
嵌入Zuul反向代理(Embedded Zuul Reverse Proxy)
Cookies和敏感HTTP头(Cookies and Sensitive Headers)
路由Endpoint(The Routes Endpoint)
窒息模式和本地跳转(Strangulation Patterns and Local Forwards)
2017/2/22 Spri ngCloudNetflix【springcloud中文版】springcloud中文文档
https://springcloud.cc/springcloudnetflixzhcn.html 2/50
窒息模式和本地跳转(Strangulation Patterns and Local Forwards)
通过Zuul上传文件(Uploading Files through Zuul)
简单的嵌入Zuul(Plain Embedded Zuul)
关闭Zuul过滤器(Disable Zuul Filters)
通过Sidecar进行多语言支持(Polyglot support with Sidecar)
RxJava 与 Spring MVC(RxJava with Spring MVC)
指标: Spectator, Servo, and Atlas(Metrics: Spectator, Servo, and Atlas)
Dimensional vs. Hierarchical Metrics
默认的 Metrics 集合(Default Metrics Collection)
Metrics 集合: Spectator(Metrics Collection: Spectator)
Metrics 搜集: Servo(Metrics Collection: Servo)
Metrics Backend: Atlas
关于(about)
由于翻译质量不高,所以合成为中英对照双语版本,如有不当之处,可联系修正,感谢你的支持。
贡献者(Contributor)
Andy.Ren(rcl026@163.com)
杯子(5284794@qq.com)
JewelKnife(215851331@qq.com)
影子(1124427487@qq.com)
甘明(xyuu@xyuu.net)
This project 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).
该项目通过自动配置和绑定到Spring环境和其他Spring编程模型惯例,为Spring Boot应用程序提供Netflix OSS集成。 通
过几个简单的注释,您可以快速启用和配置应用程序中的常见功能模块,并使用久经考验的Netflix组件构建大型分布式系
统。 提供的功能模块包括服务发现(Eureka),断路器(Hystrix),智能路由(Zuul)和客户端负载均衡(Ribbon)。
服务发现:Eureka客户端(Service Discovery: Eureka Clients)
Service Discovery is one of the key tenets of a microservice based architecture. Trying to hand configure
each client or some form of convention can be very difficult to do and can be very brittle. Eureka is the
Netflix Service Discovery Server and Client. The server can be configured and deployed to be highly
available, with each server replicating state about the registered services to the others.
服务发现是microservice基础架构的关键原则之一。试图着手配置每个客户端或某种格式的约定可以说是非常困难的和非
常脆弱的。Eureka是Netflix服务发现的一种服务和客户端。这种服务是可以被高可用性配置的和部署,并且在注册的服务
当中,每个服务的状态可以互相复制给彼此。
注册到Eureka(Registering with Eureka)
2017/2/22 Spri ngCloudNetflix【springcloud中文版】springcloud中文文档
https://springcloud.cc/springcloudnetflixzhcn.html 3/50
When a client registers with Eureka, it provides meta-data about itself such as host and port, health
indicator URL, home page etc. Eureka receives heartbeat messages from each instance belonging to a service.
If the heartbeat fails over a configurable timetable, the instance is normally removed from the registry.
当一个客户端注册到Eureka,它提供关于自己的元数据(诸如主机和端口,健康指标URL,首页等)Eureka通过一个服务从
各个实例接收心跳信息。如果心跳接收失败超过配置的时间,实例将会正常从注册里面移除。
Example eureka client:
eureka 客户端例子:
(i.e. utterly normal Spring Boot app). In this example we use @EnableEurekaClient explicitly, but with only
Eureka available you could also use @EnableDiscoveryClient . Configuration is required to locate the Eureka
server. Example:
在这个例子里我们使用 @EnableEurekaClient 来声明, 但只有使 Eureka 生效还得 使用 @EnableDiscoveryClient 。 配
置要求 定位Eureka服务端。 例如:
application.yml
where "defaultZone" is a magic string fallback value that provides the service URL for any client that
doesn’t express a preference (i.e. it’s a useful default).
"defaultZone"是一个神奇的字符串回退值,它提供了服务的URL给任何客户端,而这不意味优先级。 (i.e. 是一个常用的
默认值).
The default application name (service ID), virtual host and non-secure port, taken from the Environment ,
are ${spring.application.name} , ${spring.application.name} and ${server.port} respectively.
默认应用名(服务ID),物理主机地址和非安全端口, 分别从环境的 ${spring.application.name} ,
${spring.application.name} 和 ${server.port} 获取。
@Configuration
@ComponentScan
@EnableAutoConfiguration
@EnableEurekaClient
@RestController
public class Application {
@RequestMapping("/")
public String home() {
return "Hello world";
}
public static void main(String[] args) {
new SpringApplicationBuilder(Application.class).web(true).run(args);
}
}
JAVA
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
2017/2/22 Spri ngCloudNetflix【springcloud中文版】springcloud中文文档
https://springcloud.cc/springcloudnetflixzhcn.html 4/50
@EnableEurekaClient makes the app into both a Eureka "instance" (i.e. it registers itself) and a "client"
(i.e. it can query the registry to locate other services). The instance behaviour is driven by
eureka.instance.* configuration keys, but the defaults will be fine if you ensure that your application has
a spring.application.name (this is the default for the Eureka service ID, or VIP).
@EnableEurekaClient 使Eureka做为一个实例(注册直接)和客户端(它能通过查找注册来定位其它服务)注册到应用里
面。实例的行为由 eureka.instance.* 的配置项来决定,但是你最好确保你的 spring.application.name 有个默认值。(这是
Eureka的默认ID或VIP)。
See EurekaInstanceConfigBean
(http://github.com/spring-cloud/spring-cloud-netflix/tree/master/spring-cloud-netflix-eureka-
client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBean.java)
and EurekaClientConfigBean
(http://github.com/spring-cloud/spring-cloud-netflix/tree/master/spring-cloud-netflix-eureka-
client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBean.java)
for more details of the configurable options.
更多配置项的细节请看 EurekaInstanceConfigBean
(http://github.com/spring-cloud/spring-cloud-netflix/tree/master/spring-cloud-netflix-eureka-
client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBean.java)
and EurekaClientConfigBean
(http://github.com/spring-cloud/spring-cloud-netflix/tree/master/spring-cloud-netflix-eureka-
client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBean.java)
。
对Eureka服务的身份验证(Authenticating with the Eureka Server)
HTTP basic authentication will be automatically added to your eureka client if one of the
eureka.client.serviceUrl.defaultZone URLs has credentials embedded in it (curl style, like
http://user:password@localhost:8761/eureka ). For more complex needs you can create a @Bean of type
DiscoveryClientOptionalArgs and inject ClientFilter instances into it, all of which will be applied to the
calls from the client to the server.
如果其中一个 eureka.client.serviceUrl.defaultZone 的url已经把凭证嵌入到它里面,那么HTTP基本的身份验证将会被自
动添加到你的eureka客户端(curl风格,如 http://user:password@localhost:8761/eureka)。 对于更复杂的需求,您可以
创建一个带“@Bean”注解的“DiscoveryClientOptionalArgs”类型并且为它注入“ClientFilter”实例。
Because of a limitation in Eureka it isn’t possible to support per-server basic auth
credentials, so only the first set that are found will be used.
由于Eureka的一个限制是不可能支持每个服务器基本授权认证,所以只被发现的第一组会被使用。
健康指标和状态页面(Status Page and Health Indicator)
The status page and health indicators for a Eureka instance default to "/info" and "/health" respectively,
which are the default locations of useful endpoints in a Spring Boot Actuator application. You need to
change these, even for an Actuator application if you use a non-default context path or servlet path (e.g.
server.servletPath=/foo ) or management endpoint path (e.g. management.contextPath=/admin ). Example:
2017/2/22 Spri ngCloudNetflix【springcloud中文版】springcloud中文文档
https://springcloud.cc/springcloudnetflixzhcn.html 5/50
健康指标和状态页面分别对应一个Eureka实例的"/health"和"/info",是在一个Spring Boot Actuator应用默认的配置位
置中很有用的一个点。即便是一个Actuator应用,如果你使用非默认的上下文路径或者servlet路径(如
server.servletPath=/foo )或管理端点的路径(如 management.contextPath=/admin ),你都需要做出相应的改变。例如:
application.yml
These links show up in the metadata that is consumed by clients, and used in some scenarios to decide
whether to send requests to your application, so it’s helpful if they are accurate.
这些链接呈现出在元数据所消耗的客户端,并且使用在某些情况下决定是否发送请求给你应用程序,如果这些信息准确的话
它们是有用的。
注册一个安全应用(Registering a Secure Application)
If your app wants to be contacted over HTTPS you can set two flags in the EurekaInstanceConfig ,
viz
eureka.instance.[nonSecurePortEnabled,securePortEnabled]=[false,true] respectively. This will make Eureka
publish instance information showing an explicit preference for secure communication. The Spring Cloud
DiscoveryClient will always return an https://… ; URI for a service configured this way, and the Eureka
(native) instance information will have a secure health check URL.
如果你的应用想通过HTTPS被联系上你需要设置两个标记,分别是 EurekaInstanceConfig ,
viz
eureka.instance.
[nonSecurePortEnabled,securePortEnabled]=[false,true] 。这将使Eureka推送实例的信息展示一个显式的安全通信。
Spring Cloud的 DiscoveryClient 将总是通过这种方式返回一个服务的配置的URI( https://… ; ), 并且Eureka实例
(native)的信息将有一个安全的健康检查的URL。
Because of the way Eureka works internally, it will still publish a non-secure URL for status and home page
unless you also override those explicitly. You can use placeholders to configure the eureka instance urls,
e.g.
因为Eureka的内部工作方式,它将继续推送一个非安全的URL的状态和主页,除非你还覆盖那些声明。你可以使用占位符娶
配置eureka实例的url。 例子:
application.yml
(Note that ${eureka.hostname} is a native placeholder only available in later versions of Eureka. You could
achieve the same thing with Spring placeholders as well, e.g. using ${eureka.instance.hostName} .)
(请注意 ${eureka.hostname} 是一个原生占位符只可用在以后的版本的Eureka.你也可以使用Spring的占位符做同样的事
情, 例如使用 ${eureka.instance.hostName} .)
eureka:
instance:
statusPageUrlPath: ${management.context-path}/info
healthCheckUrlPath: ${management.context-path}/health
eureka:
instance:
statusPageUrl: https://${eureka.hostname}/info
healthCheckUrl: https://${eureka.hostname}/health
homePageUrl: https://${eureka.hostname}/
剩余49页未读,继续阅读
thefirstwind
- 粉丝: 213
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- zigbee-cluster-library-specification
- JSBSim Reference Manual
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0