更新 redis集群技术.md

This commit is contained in:
wxin 2024-08-14 21:30:29 +08:00
parent 43f89b2ad6
commit bd5b2ea08d
1 changed files with 6 additions and 6 deletions

View File

@ -81,7 +81,7 @@ Out[15]: b'bar'
主从同步的机制:
<img src="https://oss-wxin-resource.oss-cn-beijing.aliyuncs.com/%E5%9B%BE%E7%89%87/Redis/6.png?Expires=1723640610&OSSAccessKeyId=TMP.3KfeJz2GfydC5m533sXWc3x8M2AoBTEmroU3YwdYX4zeccmetAxNCv2ZYhrhNTFVWP6fUHFL3tEbZ2xPoj72x22vyq3ANJ&Signature=V3P0b1AU%2B8bSpqaS8gRDTELs5mI%3D" alt="image-20230526094614286" style="zoom:50%;" />
<img src="https://oss-wxin-resource.oss-cn-beijing.aliyuncs.com/%E5%9B%BE%E7%89%87/Redis/6.png" alt="image-20230526094614286" style="zoom:50%;" />
从服务器向主服务器发送 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 是一个监视器,它可以根据被监视实例的身份和状态来判断应该执行何种动作
<img src="https://oss-wxin-resource.oss-cn-beijing.aliyuncs.com/%E5%9B%BE%E7%89%87/Redis/9.png?Expires=1723640495&OSSAccessKeyId=TMP.3KfeJz2GfydC5m533sXWc3x8M2AoBTEmroU3YwdYX4zeccmetAxNCv2ZYhrhNTFVWP6fUHFL3tEbZ2xPoj72x22vyq3ANJ&Signature=24R2ysKzJP9xs05vBHHzgYbhsyo%3D" alt="image-20230526150237928" style="zoom:50%;" />
<img src="https://oss-wxin-resource.oss-cn-beijing.aliyuncs.com/%E5%9B%BE%E7%89%87/Redis/9.png" alt="image-20230526150237928" style="zoom:50%;" />
#### 1.Redis Sentinel 功能
@ -445,7 +445,7 @@ Warning: Using a password with '-a' or '-u' option on the command line interface
由一个或多个Sentinel实例组成的Sentinel系统可以监视任意多个主服务器以及所有从服务器并在被监视的主服务器进入下线状态时自动将下线主服务器属下的某个从服务器升级为新的主服务器然后由新的主服务器代替已下线的主服务器继续处理命令请求
<img src="https://oss-wxin-resource.oss-cn-beijing.aliyuncs.com/%E5%9B%BE%E7%89%87/Redis/10.png?Expires=1723640510&OSSAccessKeyId=TMP.3KfeJz2GfydC5m533sXWc3x8M2AoBTEmroU3YwdYX4zeccmetAxNCv2ZYhrhNTFVWP6fUHFL3tEbZ2xPoj72x22vyq3ANJ&Signature=9AMtkpI4DXmROdYPv67LOliVP%2BE%3D" alt="image-20230228223209112" style="zoom:50%;" />
<img src="https://oss-wxin-resource.oss-cn-beijing.aliyuncs.com/%E5%9B%BE%E7%89%87/Redis/10.png" alt="image-20230228223209112" style="zoom:50%;" />
Sentinel负责监控集群中的所有主、从Redis当发现主故障时Sentinel会在所有的从中选一个成为新的主。并且会把其余的从变为新主的从。同时那台有问题的旧主也会变为新主的从也就是说当旧的主即使恢复时并不会恢复原来的主身份而是作为新主的一个从
@ -457,7 +457,7 @@ Warning: Using a password with '-a' or '-u' option on the command line interface
Sentinel 通过用户给定的配置文件来发现主服务器
<img src="https://oss-wxin-resource.oss-cn-beijing.aliyuncs.com/%E5%9B%BE%E7%89%87/Redis/11.png?Expires=1723640521&OSSAccessKeyId=TMP.3KfeJz2GfydC5m533sXWc3x8M2AoBTEmroU3YwdYX4zeccmetAxNCv2ZYhrhNTFVWP6fUHFL3tEbZ2xPoj72x22vyq3ANJ&Signature=%2B0j77v9FHU7o4v%2F37Ri8EkUvkZI%3D" alt="image-20230228223309007" style="zoom:33%;" />
<img src="https://oss-wxin-resource.oss-cn-beijing.aliyuncs.com/%E5%9B%BE%E7%89%87/Redis/11.png" alt="image-20230228223309007" style="zoom:33%;" />
Sentinel 会与被监视的主服务器创建两个网络连接