You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Having a redis cluster at your disposal can always come in handy!
Make sure you have a Kubernetes cluster ready.
(base) mahamudur.khan@Mac redis % kubectl get nodes
NAME STATUS ROLES AGE VERSION
docker-desktop Ready control-plane 4m45s v1.32.2
We can now setup the redis cluster.
(base) mahamudur.khan@Mac redis % kubectl apply -f redis-cluster.yml
secret/redis-secret created
service/redis-headless created
statefulset.apps/redis created
job.batch/redis-cluster-init created
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 redis-1
127.0.0.1 redis-2
127.0.0.1 redis-3
Finally, we can run the python script to test:
(base) mahamudur.khan@Mac redis % python testCluster.py
Connected to Redis cluster successfully!
Successfuly set test value 'khansun' for key 'rediscluster'
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