spring-cloud

微服务与Spring Cloud基本概念、Spring Cloud版本命名方式与版本选择

混江龙づ霸主 提交于 2019-12-02 20:09:51
微服务是什么? Spring Cloud是什么? Spring Cloud版本命名方式? Spring Cloud版本选择? 一、微服务是什么 微服务是一种架构风格,是一种将单体应用开发为一组小型服务的方法,每个服务运行在自己的进程中,服务间通信采用轻量级通信机制(通常用HTTP资源API)。这些服务围绕业务能力构建并且可通过全自动部署机制独立部署。这些服务共用一个最小型的集中式的管理,服务可用不同的语言开发,使用不同的数据存储技术。 二、Spring Cloud是什么 Spring Cloud并不是一个具体的框架,可以理解为一个工具箱,它提供了各类工具,可以快速构建分布式系统。 Spring Cloud的各个项目基于Spring Boot,将Netflix的多个框架进行封装,并且通过自动配置的方式将这些框架绑定到Spring的环境中。 三、Spring Cloud版本命名方式 大多数Spring项目以“ 主版本号.次版本号.增量版本号.里程碑版本号 ”的形式命名版本。 主版本号表示项目的重大重构; 次版本号表示新特性的添加和变化; 增量版本号一般表示Bug修复; 里程碑版本号表示某版本号的里程碑; 例如Spring Framework稳定版本4.3.5.RELEASE、里程碑版本5.0.0.M4等。 但是Spring Cloud未采用上面这种方式,以“ 英文单词SRX(X为数字)

Feign client not able to make calls- Kubernetes

有些话、适合烂在心里 提交于 2019-12-02 20:06:26
问题 I have deployed microservice on docker-desktop for windows and feign is not able to make a call to another service. person ms calling organization ms through feign. I can see in the logs of person pod 2019-11-10 12:58:34.000 INFO [personservice,13631e6ef2efe358,15c75b9a4006485a,true] 6 --- [ionThreadPool-1] c.p.service.OrganizationServiceData : Get the value from the organization ms hystrix-organizationThreadPool-1 2019-11-10 12:58:34.293 INFO [personservice,13631e6ef2efe358,e0bbcecf5f7c349f

Is there a compatibility matrix of Spring-boot and Spring-cloud?

一个人想着一个人 提交于 2019-12-02 17:34:59
I am wondering if a compatibility matrix exists between Springboot and Springcloud? I created a simple project on STS and am running into compatibility issues. <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.1.RELEASE</version> <relativePath /> <!-- lookup parent from repository --> </parent> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Camden.SR5</version> <type>pom</type> <scope>import</scope> </dependency> <

How is Spring Cloud Gateway different from Zuul?

走远了吗. 提交于 2019-12-02 17:23:58
I have been using Zuul as the edge service and API Gateway. Recently I have noticed that Spring Cloud Platform release Spring Cloud Gateway . What is the difference between the two gateways? Why is the Zuul not extended to support the functionalities in S-C-Gateway? What was the driving factor for a new library altogether? When should it be used? I am the author of spring cloud gateway. Zuul is built on servlet 2.5 (works with 3.x), using blocking APIs. It doesn't support any long lived connections, like websockets. Gateway is built on Spring Framework 5, Project Reactor and Spring Boot 2

Eureka Server: How to achieve high availability

点点圈 提交于 2019-12-02 16:17:51
I'm new to spring cloud. I've read this doc and it says the client application must specify a service url: eureka: client: serviceUrl: defaultZone: http://localhost:8761/eureka/ But what if localhost:8761 goes down? Eureka Discovery Server should be used in the Peer-Aware config mode in production setups. Check: http://cloud.spring.io/spring-cloud-static/spring-cloud.html#_peer_awareness For instance your first eureka server instance will have config like this: server: port: 1111 eureka: instance: hostname: peer1 client: serviceUrl: defaultZone: http://peer2:1112/eureka/ ..and second server

Docker - SpringConfig - Connection refused to ConfigServer

时光怂恿深爱的人放手 提交于 2019-12-02 15:51:07
问题 I'm trying to deploy a ConfigServrService and a Client with a remote repository using DockerCompose. The docker-compose.yml is like: version: '2' services: rabbitmq: image: rabbitmq ports: - "5672:5672" config-server: image: config-server environment: - "SPRING_PROFILES_ACTIVE=desa" ports: - "8888:8888" links: - rabbitmq depends_on: - rabbitmq user-service-config: image: user-service-config environment: - "SPRING_PROFILES_ACTIVE=desa" ports: - "8090:8090" links: - config-server - rabbitmq

Zuul - Api Gateway Authentication

女生的网名这么多〃 提交于 2019-12-02 15:09:50
I want to introduce Zuul through Spring Cloud as an API Gateway in front of a few services. I have some design doubts around Authentication. The Authentication would be handled by Spring Security, which comes before Zuul in the servlet filter chain. My concern: the Gateway would sit in front of many services some services may expose endpoints which do not require authentication some services may expose endpoints which need a Session Id and some with a token", an arbitrary opaque value (for example downloading a file if you know a "hard to guess" url) In the API Gateway/Spring Security you can

Spring Cloud构建微服务架构(四)分布式配置中心

我的梦境 提交于 2019-12-02 14:52:38
1 构建服务配置中心(spring-cloud-config) 第一步:创建一个Spring Boot项目(spring-cloud-config) 父maven工程省略,具体详情请查看之前Spring Cloud 服务的注册与发现(Eureka Server)在父工程下创建一个Spring Boot的Module,并命名为spring-cloud-config,然后再配置依赖,如下: < ? 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" > < modelVersion > 4.0 .0 < / modelVersion > < parent > < groupId > com . brimen < / groupId > < artifactId > spring - cloud - brimen - config

SpringCloud 随笔

拈花ヽ惹草 提交于 2019-12-02 13:29:49
目录 服务间通讯 统一配置中心 RabbitMQ Spring Cloud Stream 服务网关 Spring Cloud Zuul ++ ==(纯手打,代码可能有错!)== ++ 服务间通讯 RestTemplate 方式一 : 直接使用restTemplate,url写死 RestTemplate restTemplate = new RestTemplate(); String responseStr = restTemplate.getForObject(“http://localhost:8080/msg”,String.class); 方式二 : 利用loadBalancerClient通过应用名获取URL,然后再使用restTemplate 先给controller注入loadBalancerClient @Autowired private LoadBalancerClient loadBalancerClient; 获取URL,再使用restTemplate RestTemplate restTemplate = new RestTemplate(); ServiceInstance serviceInstance = loadBalancerClient.choose(“PRODUCT”); String url = String.format(“http:/

Call Spring actuator /restart endpoint from Spring boot using a java function

社会主义新天地 提交于 2019-12-02 13:20:16
问题 I'm looking to restart the spring boot app, so using Spring Actuator /restart endpoint is working using curl, but i'm looking to call the same function using java code from inside the app, i've tried this code, but it's not working: Thread thread = new Thread(new Runnable() { @Override public void run() { RestartEndpoint p = new RestartEndpoint(); p.invoke(); } }); thread.setDaemon(false); thread.start(); 回答1: You need to inject the RestartEndPoint: @Autowired private RestartEndpoint