From bd5b2ea08d512bea061f4a81e05bf7d5f53403c6 Mon Sep 17 00:00:00 2001
From: wxin <15253413025@163.com>
Date: Wed, 14 Aug 2024 21:30:29 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20redis=E9=9B=86=E7=BE=A4?=
=?UTF-8?q?=E6=8A=80=E6=9C=AF.md?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
redis集群技术.md | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/redis集群技术.md b/redis集群技术.md
index 94f18c9..1172956 100644
--- a/redis集群技术.md
+++ b/redis集群技术.md
@@ -81,7 +81,7 @@ Out[15]: b'bar'
主从同步的机制:
-
+
从服务器向主服务器发送 SYNC 命令
@@ -97,11 +97,11 @@ Out[15]: b'bar'
命令传播是一个持续的过程:只要复制仍在继续,命令传播就会一直进行,使得主从服务器的状态可以一直保持一致
-![image-20230228220953326](https://oss-wxin-resource.oss-cn-beijing.aliyuncs.com/%E5%9B%BE%E7%89%87/Redis/7.png?Expires=1723640462&OSSAccessKeyId=TMP.3KfeJz2GfydC5m533sXWc3x8M2AoBTEmroU3YwdYX4zeccmetAxNCv2ZYhrhNTFVWP6fUHFL3tEbZ2xPoj72x22vyq3ANJ&Signature=sVi%2BDrswiyckwFpBeY5kSlzczzk%3D)
+![image-20230228220953326](https://oss-wxin-resource.oss-cn-beijing.aliyuncs.com/%E5%9B%BE%E7%89%87/Redis/7.png)
#### 4.Redis复制一致性问题
-![image-20230228221045012](https://oss-wxin-resource.oss-cn-beijing.aliyuncs.com/%E5%9B%BE%E7%89%87/Redis/8.png?Expires=1723640475&OSSAccessKeyId=TMP.3KfeJz2GfydC5m533sXWc3x8M2AoBTEmroU3YwdYX4zeccmetAxNCv2ZYhrhNTFVWP6fUHFL3tEbZ2xPoj72x22vyq3ANJ&Signature=Rr8mKRyqUuD4YgLNkNquRsg2W%2BY%3D)
+![image-20230228221045012](https://oss-wxin-resource.oss-cn-beijing.aliyuncs.com/%E5%9B%BE%E7%89%87/Redis/8.png)
在读写分离环境下,客户端向主服务器发送写命令 SET n 10086,主服务器在执行这个写命令之后,向客户端返回回复,并将这个写命令传播给从服务器
@@ -419,7 +419,7 @@ Warning: Using a password with '-a' or '-u' option on the command line interface
Sentinel 是一个监视器,它可以根据被监视实例的身份和状态来判断应该执行何种动作
-
+
#### 1.Redis Sentinel 功能
@@ -445,7 +445,7 @@ Warning: Using a password with '-a' or '-u' option on the command line interface
由一个或多个Sentinel实例组成的Sentinel系统可以监视任意多个主服务器,以及所有从服务器,并在被监视的主服务器进入下线状态时,自动将下线主服务器属下的某个从服务器升级为新的主服务器,然后由新的主服务器代替已下线的主服务器继续处理命令请求
-
+
Sentinel负责监控集群中的所有主、从Redis,当发现主故障时,Sentinel会在所有的从中选一个成为新的主。并且会把其余的从变为新主的从。同时那台有问题的旧主也会变为新主的从,也就是说当旧的主即使恢复时,并不会恢复原来的主身份,而是作为新主的一个从
@@ -457,7 +457,7 @@ Warning: Using a password with '-a' or '-u' option on the command line interface
Sentinel 通过用户给定的配置文件来发现主服务器
-
+
Sentinel 会与被监视的主服务器创建两个网络连接