consul导入导出的使用

consul导入导出的使用

介绍

官方地址:https://www.consul.io/commands/kv

命令:consul kv

该kv命令用于通过命令行与 Consul 的 KV 存储进行交互。它公开了用于从存储中插入、更新、读取和删除的顶级命令。此命令在 Consul 0.7.1 及更高版本中可用。

KV 存储也可以通过 HTTP API访问。

1
2
3
4
5
6
7
8
9
10
11
$ consul kv -h
用法:consul kv <subcommand> [options] [args]

Subcommands:

delete 从 KV 存储中删除数据
export 以 JSON 格式导出部分 KV 树
get 从 KV 存储中检索或列出数据
import 导入部分JSON 格式的 KV 树
put 设置或更新 KV 存储中的数据

阅读更多

Gateway配置HTTPS证书

介绍

The gateway can listen for requests on HTTPS by following the usual Spring server configuration. (网关可以通过遵循通常的Spring服务器配置监听HTTPS上的请求) –SpringCloud官网

下面举例说明如何进行配置:

阅读更多

Bus组件的使用

什么是Bus

官方:https://spring.io/projects/spring-cloud-bus

Spring Cloud Bus links nodes of a distributed system with a lightweight message broker. This can then be used to broadcast state changes (e.g. configuration changes) or other management instructions. AMQP and Kafka broker implementations are included with the project. Alternatively, any Spring Cloud Stream binder found on the classpath will work out of the box as a transport. –摘自官网

阅读更多

Config组件使用

什么是Config

介绍

官方:https://spring.io/projects/spring-cloud-config

简要描述:config(配置)又称为 统一配置中心顾名思义,就是将配置统一管理,配置统一管理的好处是在日后大规模集群部署服务应用时相同的服务配置一致,日后再修改配置只需要统一修改全部同步,不需要一个一个服务手动维护。

阅读更多

服务网关组件的使用

什么是服务网关

说明

网关统一服务入口,可方便实现对平台众多服务接口进行管控,对访问服务的身份认证、防报文重放与防数据篡改、功能调用的业务鉴权、响应数据的脱敏、流量与并发控制,甚至基于API调用的计量或者计费等等。

网关 = 路由转发 + 过滤器

路由转发:接收一切外界请求,转发到后端的微服务上去;

过滤器:在服务网关中可以完成一系列的横切功能,例如权限校验、限流以及监控等,这些都可以通过过滤器完成。

阅读更多

Hystrix组件使用

In a distributed environment, inevitably some of the many service dependencies will fail. Hystrix is a library that helps you control the interactions between these distributed services by adding latency tolerance and fault tolerance logic. Hystrix does this by isolating points of access between the services, stopping cascading failures across them, and providing fallback options, all of which improve your system’s overall resiliency. –[摘自官方]

阅读更多

OpenFeign组件的使用

简介

官方:https://cloud.spring.io/spring-cloud-openfeign/reference/html/

Feign是一个声明式的伪Http客户端,它使得写Http客户端变得更简单。使用Feign,只需要创建一个接口并注解。它具有可插拔的注解特性(可以使用springmvc的注解),可使用Feign 注解和JAX-RS注解。Feign支持可插拔的编码器和解码器。Feign默认集成了Ribbon,默认实现了负载均衡的效果并且springcloud为feign添加了springmvc注解的支持。

阅读更多

服务间通信方式及Ribbon使用

在整个微服务架构中,我们比较关心的就是服务间的服务改如何调用,有哪些调用方式?

在springcloud中服务间调用方式主要是使用 http restful方式进行服务间调用

阅读更多