Mes Post-Its
Raphael Piccolo

redis cluster

Retour
# create 6 redis servers
redis-server --port 7000 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
redis-server --port 7001 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
redis-server --port 7002 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
redis-server --port 7003 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
redis-server --port 7004 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
redis-server --port 7005 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes

# create a cluster from those servers (3 masters / 3 slaves)
redis-cli --cluster create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 --cluster-replicas 1

# reshard. 
redis-cli --cluster reshard 127.0.0.1:7000

# health
redis-cli --cluster check 127.0.0.1:7000

# crash a master
redis-cli -p 7002 debug segfault

# check cluster topology
redis-cli -p 7000 cluster nodes

# add master node
redis-cli --cluster add-node 127.0.0.1:7006 127.0.0.1:7000

# add slave node
redis-cli --cluster add-node 127.0.0.1:7006 127.0.0.1:7000 --cluster-slave
redis-cli --cluster add-node 127.0.0.1:7006 127.0.0.1:7000 --cluster-slave --cluster-master-id 3c3a0c74aae0b56170ccb03a76b60cfe7dc1912e

# delete node 
redis-cli --cluster del-node 127.0.0.1:7000 `<node-id>`

cv.raphaelpiccolo.com |Connexion