Created
November 24, 2021 08:12
-
-
Save fdeantoni/ada259f6df12be5ad537f507e3eaa572 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
# Find ClusterIPs of Redis nodes | |
export REDIS_NODES=$(kubectl get pods -l app=redis-cluster -n redis -o json | jq -r '.items | map(.status.podIP) | join(":6379 ")'):6379 | |
# Activate the Redis cluster | |
kubectl exec -it redis-cluster-0 -n redis -- redis-cli --cluster create --cluster-replicas 1 ${REDIS_NODES} | |
# Check if all went well | |
for x in $(seq 0 5); do echo "redis-cluster-$x"; kubectl exec redis-cluster-$x -n redis -- redis-cli role; echo; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment