Last active
June 9, 2023 10:33
-
-
Save fredead/1be701d31c700768a076bd884d11e899 to your computer and use it in GitHub Desktop.
Automating creation of a redis cluster
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fireup all our nodes. | |
I could find information about this only which was odd. The tutorial is nice if you are setting up some static site ala the early 00's. | |
So this is some notes on creating a cluster by hang which will feed into the creation of a puppet / ansible / chef / shell / slat script | |
to do the main part of creating the cluster. | |
I note also many clients do not support redis in cluster mode WTF? | |
Open up this in a browser | |
https://redis.io/commands/cluster-slots | |
http://download.redis.io/redis-stable/src/redis-trib.rb -- The only documentation that seem to exist on how to do this | |
for node in list of nodes | |
connect to first cluster | |
redis-cli cluster meet <IP> <PORT> | |
redis-cli cluster nodes | gep connected # should show all nodes from above | |
# Connect to defined slaves an run fom the master id som e cluster nodes | |
for node in list of slaves | |
connect to node | |
CLUSTER REPLICATE <master id> | |
number per node = 16384/no,_masters | |
start = 0 | |
limit = start + number per node | |
end = 16384 | |
for node in list of master | |
connect to node | |
CLUSTER ADDSLOTS start start+1 ... limit | |
start = limit+1 | |
limit = limit + number per node | |
if limit > end { limit = end } | |
# Technically its not clear is this is required | |
x=1 | |
for each node | |
connect to node | |
CLUSTER SET-CONFIG-EPOCH x++ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment