sanderploegsma / redis-cluster

Redis Cluster setup running on Kubernetes
https://sanderp.nl/running-redis-cluster-on-kubernetes-e451bda76cad
MIT License
246 stars 132 forks source link

${POD_IP} in /data/nodes.conf #8

Closed AlexColorado closed 5 years ago

AlexColorado commented 5 years ago

Hi there,

I installed redis-cluster in GKE. I'm doing failover tests, and I restarted all (but one) redis-cluster pods (deleting them one by one).

Before the restarts, the original cluster info looked like this: f20056c91f0f3b33c506928ecaa1f1dddc6d320a 10.20.5.15:6379@16379 slave 8976e3638ae7c64e3815b4d716a70802b6333f70 0 1537506969822 6 connected 8976e3638ae7c64e3815b4d716a70802b6333f70 10.20.6.88:6379@16379 master - 0 1537506968000 3 connected 10923-16383 c20cac02214e6ea1d7bca9cadaa81ef0ea6d6316 10.20.6.87:6379@16379 master - 0 1537506968818 1 connected 0-5460 1ed73f245e5b0e76b230333af052beaaa8c2e118 10.20.3.10:6379@16379 myself,slave c20cac02214e6ea1d7bca9cadaa81ef0ea6d6316 0 1537506966000 4 connected dc0673e5fdf55c8016fdb4e74e4714a8c011c019 10.20.6.89:6379@16379 slave 1b40f01a19c940df1779f159c5a40f14fc88e2ed 0 1537506969000 5 connected 1b40f01a19c940df1779f159c5a40f14fc88e2ed 10.20.5.14:6379@16379 master - 0 1537506967000 2 connected 5461-10922

After restarting the pods, the redis-cluster nodes show ${POD_IP} as their IP address. Everything seems to be working fine. I just wanted to bring this to your attention in case there could be a bug with the latest patch. I will probably delete and recreate the cluster and start from scratch again. But I will leave it as is for a few days in case you require me to check anything.

$ kubectl exec redis-cluster-0 -- redis-cli cluster nodes 1ed73f245e5b0e76b230333af052beaaa8c2e118 10.20.3.10:6379@16379 slave c20cac02214e6ea1d7bca9cadaa81ef0ea6d6316 0 1537510245134 10 connected 8976e3638ae7c64e3815b4d716a70802b6333f70 10.20.5.17:6379@16379 master - 0 1537510244131 3 connected 10923-16383 c20cac02214e6ea1d7bca9cadaa81ef0ea6d6316 ${POD_IP}:6379@16379 myself,master - 0 1537510246000 10 connected 0-5460 dc0673e5fdf55c8016fdb4e74e4714a8c011c019 10.20.6.93:6379@16379 slave 1b40f01a19c940df1779f159c5a40f14fc88e2ed 0 1537510245000 5 connected 1b40f01a19c940df1779f159c5a40f14fc88e2ed 10.20.6.92:6379@16379 master - 0 1537510247139 2 connected 5461-10922 f20056c91f0f3b33c506928ecaa1f1dddc6d320a 10.20.5.18:6379@16379 slave 8976e3638ae7c64e3815b4d716a70802b6333f70 0 1537510246137 6 connected

$ kubectl exec redis-cluster-1 -- redis-cli cluster nodes dc0673e5fdf55c8016fdb4e74e4714a8c011c019 10.20.6.93:6379@16379 slave 1b40f01a19c940df1779f159c5a40f14fc88e2ed 0 1537510258000 5 connected 8976e3638ae7c64e3815b4d716a70802b6333f70 10.20.5.17:6379@16379 master - 0 1537510256000 3 connected 10923-16383 f20056c91f0f3b33c506928ecaa1f1dddc6d320a 10.20.5.18:6379@16379 slave 8976e3638ae7c64e3815b4d716a70802b6333f70 0 1537510258569 6 connected 1ed73f245e5b0e76b230333af052beaaa8c2e118 10.20.3.10:6379@16379 slave c20cac02214e6ea1d7bca9cadaa81ef0ea6d6316 0 1537510259571 10 connected 1b40f01a19c940df1779f159c5a40f14fc88e2ed ${POD_IP}:6379@16379 myself,master - 0 1537510256000 2 connected 5461-10922 c20cac02214e6ea1d7bca9cadaa81ef0ea6d6316 10.20.6.96:6379@16379 master - 0 1537510257566 10 connected 0-5460

$ kubectl exec redis-cluster-2 -- redis-cli cluster nodes dc0673e5fdf55c8016fdb4e74e4714a8c011c019 10.20.6.93:6379@16379 slave 1b40f01a19c940df1779f159c5a40f14fc88e2ed 0 1537510270489 5 connected c20cac02214e6ea1d7bca9cadaa81ef0ea6d6316 10.20.6.96:6379@16379 master - 0 1537510269488 10 connected 0-5460 8976e3638ae7c64e3815b4d716a70802b6333f70 ${POD_IP}:6379@16379 myself,master - 0 1537510268000 3 connected 10923-16383 1b40f01a19c940df1779f159c5a40f14fc88e2ed 10.20.6.92:6379@16379 master - 0 1537510268000 2 connected 5461-10922 f20056c91f0f3b33c506928ecaa1f1dddc6d320a 10.20.5.18:6379@16379 slave 8976e3638ae7c64e3815b4d716a70802b6333f70 0 1537510267484 6 connected 1ed73f245e5b0e76b230333af052beaaa8c2e118 10.20.3.10:6379@16379 slave c20cac02214e6ea1d7bca9cadaa81ef0ea6d6316 0 1537510269000 10 connected

etc.

Thanks!

sanderploegsma commented 5 years ago

Hi, thanks for reporting this! I think I messed up the initialization script, the variable substitution does not seem to work as intended.

I'll see if I can get around to fixing it some time soon, but feel free to submit a PR if you have the time 😄

AlexColorado commented 5 years ago

Hi, I think it's just the sed command. I have submitted a PR with hopefully a fix. :-)