Fork me on GitHub

使用Consul实现服务发现:instance-id自定义

TIPS 本文基于Spring Cloud Hoxton,理论支持Spring Cloud所有版本。 本文探讨如何自定义微服务注册到Consul的InstanceId。 Consul把InstanceId作为唯一标识,而Spring Cloud Consul默认的InstanceId是 ${spring.application.name}-${server.port} 。 这样导致的问题是:某个微服务即使有多个实例,只要端口相...

用git2consul从Git同步配置到Consul

TIPS 当且仅当 spring.cloud.consul.config.format=files 时,才可用git2consul管理配置,其他格式无法使用。 单机版Consul的配置是不持久化的,一旦重启就会丢失,而开发过程中,重启Consul可能比较频繁。要想解决这个问题,可将配置存储到Git仓库,并使用git2consul将配置同步到Consul中,以下是步骤。 安装Node.js下载Node.js前往 https://nodejs.org/en/downlo...

安装Consul集群

TIPS 本文基于Consul 1.5.3,理论适用于Consul 1.6及更低版本。 安装单机版Consul详见:《安装单机版Consul》 知识预热Consul常用命令 命令 解释 示例 agent 运行一个consul agent consul agent -dev join 将agent加入到consul集群 consul join IP members 列出consul cluster集群中的members consul member...

安装单机版Consul

TIPS 本文基于Consul 1.5.3,理论适用于Consul 1.6及更低版本。 下载Consul 下载最新稳定版:https://www.consul.io/downloads.html 下载指定版本:https://releases.hashicorp.com/consul/ 百度盘加速器(Consul 1.5.3) 12链接: https://pan.baidu.com/s/1Kyw5_duxW2TvEqb17YV9WQ 提取码: kfjt 复制这段...

Spring Cloud Alibaba升级到2.1.0

TIPS 本文基于Spring Cloud Greenwich SR3编写,理论支持Spring Cloud Greenwich所有版本。 对于非Greenwich版本,请前往 https://github.com/alibaba/spring-cloud-alibaba/wiki/版本说明 查看Spring Cloud与Spring Cloud Alibaba的版本兼容性关系,自行升级到对应的兼容版本。例如:你用的是Spring Cloud Finchley,那么应...

Spring Cloud Sleuth使用ELK收集&分析日志

TIPS 本文基于Spring Cloud Greenwich SR2,理论兼容Spring Cloud所有版本。 应用整合 加依赖: 123456789<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-sleuth</artifactId> <...

解决Spring Cloud Alibaba/Spring Cloud整合Zipkin之后的报错问题

TIPS 本文服务发现组件以Nacos为例。 本文基于 Spring Cloud Greenwich SR1 问题复现依赖1234<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-zipkin</artifactId></dependency> 配置123...

Zipkin Server下载与搭建

TIPS 本文基于Zipkin Server 2.12.9编写,理论支持Zipkin 2.0及更高版本。 Zipkin Server的API兼容性(微服务通过集成reporter模块,从而Zipkin Server通信)非常好,对于Spring Cloud Greenwich,Zipkin Server只需安装2.x即可。 方式1:使用Zipkin官方的Shell下载 TIPS 如下命令可下载最新版本。 1curl -sSL https://zipkin.io...

Spring Cloud Gateway限流详解

Spring Cloud Gatway内置的 RequestRateLimiterGatewayFilterFactory 提供限流的能力,基于令牌桶算法实现。目前,它内置的 RedisRateLimiter ,依赖Redis存储限流配置,以及统计数据。当然你也可以实现自己的RateLimiter,只需实现 org.springframework.cloud.gateway.filter.ratelimit.RateLimiter 接口,或者继承 org.springf...

Spring Cloud Gateway排错、调试技巧总结

本文总结Spring Cloud Gateway的排错、调试技巧。欢迎留言补充! 第一式:Actuator监控端点借助Actuator的监控端点,可分析全局过滤器、过滤器工厂、路由详情。详见:Spring Cloud Gateway监控 第二式:日志加日志,按需将如下包的日志级别设置成 debug 或 trace ,总有一款对你有用。 org.springframework.cloud.gateway org.springframework.http.server.r...