spring-cloud

Spring cloud - how to get benefits of retry,load balancing and circuit breaker for distributed spring application

核能气质少年 提交于 2019-12-19 06:57:31
问题 I want the following features in spring-cloud-Eureka backed microservices application. 1) Load balancing - if I have 3 nodes for one service, load balancing should happen between them 2)Retry logic - if one of the nodes did not respond, retry should happen for certain number ( eg 3. should be configurable) before falling back to another node. 3)circuit breaker - if for some reasons, all the 3 nodes of service is having some issue accessing db and throwing exceptions or not responding, the

springcloud(二):注册中心Eureka

青春壹個敷衍的年華 提交于 2019-12-19 05:36:58
Eureka是Netflix开源的一款提供服务注册和发现的产品,它提供了完整的Service Registry和Service Discovery实现。也是springcloud体系中最重要最核心的组件之一。 背景介绍 服务中心 服务中心又称注册中心,管理各种服务功能包括服务的注册、发现、熔断、负载、降级等,比如dubbo admin后台的各种功能。 有了服务中心调用关系会有什么变化,画几个简图来帮忙理解 项目A调用项目B 正常调用项目A请求项目B 有了服务中心之后,任何一个服务都不能直接去掉用,都需要通过服务中心来调用 项目A调用项目B,项目B在调用项目C 这时候调用的步骤就会为两步:第一步,项目A首先从服务中心请求项目B服务器,然后项目B在从服务中心请求项目C服务。 上面的项目只是两三个相互之间的简单调用,但是如果项目超过20个30个呢,在15年底的时候我司分布式的项目就达到了二十几个,画一张图来描述几十个项目之间的相互调用关系全是线条,任何其中的一个项目改动,就会牵连好几个项目跟着重启,巨麻烦而且容易出错。通过服务中心来获取服务你不需要关注你调用的项目IP地址,由几台服务器组成,每次直接去服务中心获取可以使用的服务去调用既可。 由于各种服务都注册到了服务中心,就有了去做很多高级功能条件。比如几台服务提供相同服务来做均衡负载;监控服务器调用成功率来做熔断,移除服务列表中的故障点

Spring Cloud Config Server Shared Properties Across Applications

陌路散爱 提交于 2019-12-18 19:15:15
问题 I currently have a number of deployable applications that work in a distributed fashion to solve a business problem. We are currently using a number of property configuration files to provide changing configuration per environment based off a system environment variable. All these deployable application share common configuration for database and messaging. This is currently achieved by picking up property files from the class path and having both deployed apps share a common jar for each

spring-cloud-alibaba之nacos--服务注册与发现与服务消费(三)

。_饼干妹妹 提交于 2019-12-18 17:59:12
spring-cloud-alibaba之nacos–服务注册与发现与服务消费(三) 1.启动nacos server 2.服务提供者-provider (tsoft-order) 2.0 整体架构工程目录 2.1 引入依赖 pom.xml < ? 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 > tsoft - parent < / artifactId > < groupId > com . tsoft < / groupId > < version > 1.0 - SNAPSHOT < / version > < relativePath > . . /pom . xml < / relativePath > < / parent > < modelVersion

Why is AccessTokenRequest's PreservedState perpetually null with a resultant CSRF related InvalidRequestException?

白昼怎懂夜的黑 提交于 2019-12-18 17:12:59
问题 As context, I've been trying to get a fairly simple @SprintBootApplication with an additional @EnableOAuth2Sso annotation integrated with WSO2 Identity Server for quite some time now. In my mind getting this working should be a matter of configuration (as advertised on Spring Cloud Security) - but I've had no luck thus far. In an effort to understand what is going on I've used my debugger to step through spring-security-oauth2 code to figure out what is going on. In doing so I've noticed that

Zuul with web socket

橙三吉。 提交于 2019-12-18 17:00:20
问题 We currently have a direct Websocket connection that goes to a backend webservice from our UI Application. Now when we are trying to do the same through Zuul(ApiGateway) we are not able to connect to backend service We have gone through below issue that does not solve our problem https://github.com/spring-cloud/spring-cloud-netflix/issues/163 but it gives me an alternative in below link https://jmnarloch.wordpress.com/2015/11/11/spring-cloud-sock-js-stomp-zuul-no-websockets/ I am considering

Zuul with web socket

懵懂的女人 提交于 2019-12-18 17:00:03
问题 We currently have a direct Websocket connection that goes to a backend webservice from our UI Application. Now when we are trying to do the same through Zuul(ApiGateway) we are not able to connect to backend service We have gone through below issue that does not solve our problem https://github.com/spring-cloud/spring-cloud-netflix/issues/163 but it gives me an alternative in below link https://jmnarloch.wordpress.com/2015/11/11/spring-cloud-sock-js-stomp-zuul-no-websockets/ I am considering

Zuul/Ribbon/Hystrix not retrying on different instance

别来无恙 提交于 2019-12-18 15:50:19
问题 Background I'm using Spring cloud Brixton.RC2, with Zuul and Eureka. I have one gateway service with @EnableZuulProxy and a book-service with a status method. Via configuration I can emulate work on the status method by sleeping a defined amount of time. The Zuul route is simple zuul.routes.foos.path=/foos/** zuul.routes.foos.serviceId=reservation-service I run two instances of the book-service . When I set the sleeping time below the Hystrix timeout threshold (1000ms) I can see requests

inter micro-service request responds with Forbidden status in spring cloud application

半城伤御伤魂 提交于 2019-12-18 09:45:05
问题 I am investigating microservice architecture. I chose the spring cloud framework. My application shema looks like this: Also I have discovery server eureka but I decided to skip on the picture to simplify it. Full source code of example you can find on githib: https://github.com/gredwhite/spring-cloud Problem explanation: hello world service: @GetMapping("/helloWorld") @HystrixCommand(fallbackMethod = "reliable") public String hello() { return this.restTemplate.getForObject("http://hello

Combination of Spring Cloud and Orchestration Tools Like Docker Swarm and Kubernetes

天大地大妈咪最大 提交于 2019-12-18 05:23:09
问题 I have a cloud-native application, which is implemented using Spring Cloud Netflix . So, in my application, I'm using Eureka service discovery to manage all instances of different services of the application. When each service instance wants to talk to another one, it uses Eureka to fetch the required information about the target service (IP and port for example). The service orchestration can also be achieved using tools like Docker Swarm and Kubernetes , and it looks there are some overlaps