doc: 阅读redis文档

This commit is contained in:
asahi
2025-09-26 13:34:36 +08:00
parent 492eb5d64a
commit c478a97a99

View File

@@ -191,6 +191,11 @@
- [Configuration](#configuration)
- [Timing of expired events](#timing-of-expired-events)
- [Events in cluster](#events-in-cluster)
- [Redis Cluster Speification](#redis-cluster-speification)
- [Main properties and rationales of the design](#main-properties-and-rationales-of-the-design)
- [Redis Cluster Goals](#redis-cluster-goals)
- [Implemented subset](#implemented-subset)
- [Client and Server roles in the Redis cluster protocol](#client-and-server-roles-in-the-redis-cluster-protocol)
# redis
@@ -3174,4 +3179,25 @@ A Alias for "g$lshztdxe", so that the "AKE" string means all the events exce
`Expired events`将会在redis server删除key时被生成并非`ttl`减为0的时间。
##### Events in cluster
redis cluster中的每个node都会生成其自己的keyspace相关事件。但是和集群环境下`Pub/Sub`机制不同的是,`events notifications`并不会被广播到cluster中的其他节点。keyspace events是`node-specific`的从cluster接收到所有的keyspace events时clients需要为每个node都进行订阅。
redis cluster中的每个node都会生成其自己的keyspace相关事件。但是和集群环境下`Pub/Sub`机制不同的是,`events notifications`并不会被广播到cluster中的其他节点。keyspace events是`node-specific`的从cluster接收到所有的keyspace events时clients需要为每个node都进行订阅。
## Redis Cluster Speification
### Main properties and rationales of the design
#### Redis Cluster Goals
Redis Cluster为redis的分布式实现其目标按照重要性排序如下
- 高性能并且支持线性拓展到1000 nodes并不会使用代理并且不会对values执行merge operations
- `Acceptable degree of write safty`: 系统会尝试保留所有来源clients的写操作
- `Availability`: redis cluster在`绝大多数master nodes可达并且对每个master node都至少有一个replica可达`的场景下维持生存。此外,在使用`replicas migration`时如果master不再拥有任何replica那么其会从其他`拥有多个replicas的master`处接收一个replica。
#### Implemented subset
redis cluster实现了`所有非分布式版本redis支持的single key commands`。对于`performing complex multi-key operations`的命令,例如`set unions and intersections`,仅针对`所有keys都被hash到相同slot`的场景提供了实现。
redis cluster实现了`hash tags`的概念用于强制让部分keys被存储到相同的slot。但是在manual resharding的期间multi-ey operations可能并不可用而single-key operations则是永远可用的。
Redis Cluster并不像standalone版本的redis一样支持multiple databases其只支持database 0。并且`SELECT`命令在集群环境下不允许被执行。
### Client and Server roles in the Redis cluster protocol
在redis集群中nodes负责对数据进行存储并维护集群的状态以及将keys映射到对应的nodes。cluster nodes可以自动发现其他的ndoes并探知`non-working nodes`在错误发生时将replica nodes提升为master。
cluster中所有的nodes都会通过TCP bus和名为`Redis Cluster Bus`的二进制协议来连结。其中,`TCP bus`是一种逻辑上的结构代表cluster nodes中任两个nodes之间都会相互连接。