随笔分类 -  spring cloud

摘要:@Component @Configuration public class GateWayFilter implements GlobalFilter, Ordered { @Override public Mono<Void> filter(ServerWebExchange exchange, 阅读全文
posted @ 2020-04-28 14:08 Draymond 阅读(651) 评论(0) 推荐(0)
摘要:构建于springboot2.x,spring webFlux,project reactor之上,更加符合未来的技术体系 使用非阻塞的方式 pom <!--gateway--> <dependency> <groupId>org.springframework.cloud</groupId> <a 阅读全文
posted @ 2020-04-26 22:33 Draymond 阅读(689) 评论(1) 推荐(0)
摘要:待做 阅读全文
posted @ 2020-04-26 22:17 Draymond 阅读(420) 评论(0) 推荐(0)
摘要:待做 阅读全文
posted @ 2020-04-26 22:16 Draymond 阅读(659) 评论(0) 推荐(0)
摘要:1:方法的熔断 /** * 服务熔断 * * @return */ @HystrixCommand(fallbackMethod = "numLessZeroException", commandProperties = { //ctrl+shift+A 查询HystrixCommandProper 阅读全文
posted @ 2020-04-26 22:14 Draymond 阅读(191) 评论(0) 推荐(0)
摘要:1:pom <!-- hystrix --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </depen 阅读全文
posted @ 2020-04-21 21:13 Draymond 阅读(399) 评论(0) 推荐(0)
摘要:pom <!-- hystrix--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </dependen 阅读全文
posted @ 2020-04-21 20:55 Draymond 阅读(632) 评论(0) 推荐(0)
摘要:yml配置 #自定义ribbon的超时时间 ribbon: ReadTimeout: 5000 #处理请求的超时时间,默认为5秒 ConnectTimeout: 5000 #连接建立的超时时长,默认5秒 MaxAutoRetries: 1 #同一台实例的最大重试次数,但是不包括首次调用,默认为1次 阅读全文
posted @ 2020-04-18 20:09 Draymond 阅读(4920) 评论(0) 推荐(1)
摘要:ribbon的使用方式 ribbon调用服务方式 ribbon+restTemplete openFeign的调用服务方式 controller层直接调用service openFeign是对ribbon做了进一步的封装 阅读全文
posted @ 2020-04-18 16:22 Draymond 阅读(1639) 评论(0) 推荐(2)
摘要:作用 类似ribbon提供客户端的负载均衡 1:pom <! eureka-client --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eu 阅读全文
posted @ 2020-04-18 16:13 Draymond 阅读(1160) 评论(0) 推荐(0)
摘要:作用 客户端的负载均衡,与RestTemplate结合使用 1:pom eureka的客户端与nocos的客户端pom依赖,都集成了ribbon,所以不再需要重复添加依赖 2:将RestTemplate注入到spring容i中 @Component @Configuration public cla 阅读全文
posted @ 2020-04-18 14:52 Draymond 阅读(1346) 评论(0) 推荐(0)
摘要:cap模型 CAP原则又称CAP定理,指的是在一个分布式系统中,一致性(Consistency)、可用性(Availability)、分区容错性(Partition tolerance)。CAP 原则指的是,这三个要素最多只能同时实现两点,不可能三者兼顾 一致性(Consistency):同一时间看 阅读全文
posted @ 2020-04-18 14:32 Draymond 阅读(21133) 评论(0) 推荐(0)
摘要:1:pom <!-- nacos-discovery --> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> 阅读全文
posted @ 2020-04-18 14:19 Draymond 阅读(1197) 评论(0) 推荐(0)
摘要:1:作用 本地调试的时候,不用跑相同的项目,就可以模拟多个相同服务的实例 2:步骤 2.1 右键payment copy configuaration 2.2 修改名字 与 VM options -DServer.port=9011 9001端口映射到9011 2.3 nacos查看 2.4 访问测 阅读全文
posted @ 2020-04-18 13:32 Draymond 阅读(449) 评论(0) 推荐(0)
摘要:1:pom 1.1:父pom <!--Spring cloud alibaba dependencies --> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-alibaba-dependenci 阅读全文
posted @ 2020-04-17 14:00 Draymond 阅读(622) 评论(0) 推荐(0)
摘要:1:下载 https://github.com/alibaba/nacos/releases 网盘下载地址 1.2.1版本 链接:https://pan.baidu.com/s/1DM-ZlLvpmtK0OOcAl-Rj4g 提取码:rt5v 2:安装运行 运行bin下面的命令 3:查看运行结果 h 阅读全文
posted @ 2020-04-17 13:51 Draymond 阅读(545) 评论(0) 推荐(0)
摘要:1:注入 DiscoveryClient // import org.springframework.cloud.client.discovery.DiscoveryClient; @Autowired private DiscoveryClient discoveryClient; 2:对外提供方 阅读全文
posted @ 2020-04-16 16:37 Draymond 阅读(1614) 评论(0) 推荐(0)
摘要:yml spring: application: name: cloud-payment-service # 也是注册到eureka服务的名称( 服务别名(使用服务别名去注册中心获取实际的RPC远程调用地址) ) 名字相同,则为注册的相同的服务,不同的实例(该名称不可随意改动,否则,client调用 阅读全文
posted @ 2020-04-16 11:00 Draymond 阅读(1552) 评论(0) 推荐(0)
摘要:yml 消费端 eureka: client: fetch-registry: true register-with-eureka: true service-url: defaultZone: http://eureka7002.com:7002/eureka/,http://eureka7001 阅读全文
posted @ 2020-04-16 10:58 Draymond 阅读(328) 评论(0) 推荐(0)
摘要:分配端口 7001 7002 7003 yml eureka: instance: hostname: eureka7001.com #eureka服务端的实例名称 client: register-with-eureka: false #false表示不向注册中心注册自己 fetch-regist 阅读全文
posted @ 2020-04-16 10:56 Draymond 阅读(184) 评论(1) 推荐(0)