Redis_double_write_consistency_issues_and_solutions
Redis double write consistency issues and solutionsFirst, the process of reading and writing
Read:
(1) Read the cache first, if the data hits, return
(2) If the data is missing, read db
(3) Cache the data read in db into the cache
write:
(1) first eliminate the cache
(2) Write db again
Second, the data inconsistency reasons
Operates the cache first. If a read request occurs before the database is successfully written, the old data may be cached, causing data inconsistency.
In a distribut
2020-06-02
Redis
double-write-consistency
SpringCloud之服务消费者(Feign)
SpringCloud之服务消费者(Feign)一、Feign简介Feign是一个声明式的伪Http客户端,它使得写Http客户端变得更简单。使用Feign,只需要创建一个接口并注解。它具有可插拔的注解特性,可使用Feign 注解和JAX-RS注解。Feign支持可插拔的编码器和解码器。Feign默认集成了Ribbon,并和Eureka结合,默认实现了负载均衡的效果。
简而言之:
Feign 采用的是基于接口的注解
Feign 整合了ribbon
二、准备工作
1.搭建并启动eureka服务
新建springboot项目
名称随意
添加依赖,这里只需eureka server即可
选择项目保存位置,可以按需修改
建好后先在命令行打包检查项目依赖是否有问题
在resource目录下新建配置文件application.yml,内容如下:
123456789101112server: port: 8761spring: application: name: eureka-servereureka: client: registerWit
2020-04-04
SpringCloud
Feign
Git_For_Windows添加SSH公钥
Git For Windows 设置SSH公钥Git For Windows在每次提交代码的时候都需要输入用户名和密码,为了节省时间和精力,我们应该设置一个SSH公钥,这样就不用每次输入用户名和密码了。
具体步骤如下:
1、生成ssh密钥1cd ~/.ssh
使用 ssh-keygen 生成密钥
1ssh-keygen -t rsa -C "your_email@example.com"
后面的三次输入均可使用默认值,Enter回车跳过
密钥生成成功
1234Your identification has been saved in /home/you/.ssh/id_rsa.Your public key has been saved in /home/you/.ssh/id_rsa.pub.The key fingerprint is:xxxxxxxxxxxxx your_email@example.com
123# 查看公钥,复制备用cat id_rsa.pubssh-rsa xxxxxxxxxxxxxx_your public rsa_xxxxxxxxxxxxxxxxxxx
2020-03-28
Git For Windows
ssh公钥