- Use deployment to deploy sentinel Pod
- For scaling, just modify the spec.replicas field
- Add the
spec.replicas
field, but the number of replicas must be an odd number after the increase - The new sentinel copy will automatically add the master information that the current sentinel has monitored
- Modify the number of quorum to (number of copies/2)+1
- Reduce the spec.replicas field, but the number of replicas after shrinking must be an odd number and must be greater than or equal to 3
- Modify the number of quorum to (number of copies/2)+1
- When an event of sentinel type is received, the following steps will be performed
- Determine whether the pods of the deployment are all in the Running state, if not, wait
- The operator starts a coroutine subscription +odown message for each sentinel for cluster mode failure detection and recovery
- Detect all pods with the label sentinel=xxx (xxx is the name of the current sentinel cluster), and add monitoring if the master ip changes or is not monitored.
- Use statefulSet to deploy kvrocks pod
- Sentinel is used to monitor kvrocks master-slave mode, and perform failover and discovery
- Clear sentinel's monitoring of the master before deleting the kvrocks instance
- Delete the kvrocks instance
- When an event of standard type is received, the following steps will be executed
- Detect whether the pods of the statefulSet are all in the Running state, if not waiting
- newly created kvrocks instance, slaveof myself on startup to make it a slave
- newly created kvrocks instance slaveof current master
- sentinel Check whether the monitoring information is correct, delete the old monitoring information incorrectly, and create a new one
Apache Kvrocks Controller is a cluster management tool for Apache Kvrocks.
- Deploy the ETCD pod using a statefulSet. ETCD stores the cluster information.
- Deploy the Apache Kvrocks Controller pod using a deployment.
- Deploy the Apache Kvrocks Cluster pod using a statefulSet. Each statefulSet represents a shard of the cluster.
- Sentinel monitors the kvrocks master-slave mode, facilitating failover and discovery.
- Add the
spec.master
field. However, the resulting number of replicas must be odd. - The new shard will be added automatically, but the slots won't be rebalanced.
- Add the
spec.replicas
field. However, the resulting number of replicas must be odd. - The new node will join based on the shard, and the slots will be synchronized.
- Important: Before shrinking the shard, manually migrate the slots to other shards.
- Reduce the
spec.master
field. The resulting number of replicas must be an odd number and at least 3. - The shard with the highest ID (or number) without slots will be deleted.
- Reduce the
spec.replicas
field. The resulting number of replicas must be an odd number and at least 1. - Nodes with a
slave
role will be deleted.
- Use kubectl edit kvrocks xxxx to modify the kvrocks cluster.
- Add the content below to the master node of the shard you wish to migrate, and then save it.
migrate:
- shard: 1 # the destination shard
slots:
- "1-2" # the slots to migrate
- "300"