• for more detail (https://redis.io/topics/cluster-spec)
  • automatically split your dataset among multiple nodes
  • continue operations when a subset of the nodes are experiencing failures
Requirements
  • redis 3.0 +
  • port 6379 or others
  • port + 10000 (16379) used for the Cluster bus
Redis Cluster and Docker
  • Redis Cluster does not support NATted environments
  • use the host networking mode of Docker
Redis Cluster data sharding
  • sharding where every key is conceptually part of what we call an hash slot.
  • simply take the CRC16 of the key modulo 16384
  • for example, 3 Node ( 0 to 5500)node A, ( 5501 to 11000.)Node B
    (11001 to 16383)NodeC
  • when add or remove a node ,just move the hash slot.
Hash tags
  • just cal the hash in {} , for example {user911}sdjlfj, only cal the user911
Redis Cluster master-slave model
  • every hash slot has from 1 (the master itself) to N replicas (N-1 additional slaves nodes).
Redis Cluster consistency guarantees
  • Redis Cluster is not able to guarantee strong consistency.
  • 不保证强一致性
  • In practical terms this means that under certain conditions it is possible that Redis Cluster will lose writes that were acknowledged by the system to the client.
  • 也就是说某些情况下可能会丢失数据
Redis Cluster configuration parameters
  • cluster-enabled <yes/no>: 是否开启 cluser 默认否,stand alone instance 模式
  • cluster-config-file : 没看懂
  • cluster-node-timeout :The maximum amount of time a Redis Cluster node can be unavailable, without it being considered as failing. If a master node is not reachable for more than the specified amount of time, it will be failed over by its slaves. This parameter controls other important things in Redis Cluster. Notably, every node that can't reach the majority of master nodes for the specified amount of time, will stop accepting queries.
  • cluster-slave-validity-factor :