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
until redis-cli -h $NODE_HOST -p $NODE_PORT ping 2>/dev/null | grep -q PONG; do
144
-
retry_count=$((retry_count+1))
145
-
if [ "$retry_count" -gt "$max_retries" ]; then
146
-
echo "Error: Node $NODE_HOST:$NODE_PORT did not respond after $max_retries retries."
143
+
until redis-cli -h $$NODE_HOST -p $$NODE_PORT ping 2>/dev/null | grep -q PONG; do
144
+
retry_count=$$((retry_count+1))
145
+
if [ "$$retry_count" -gt "$$max_retries" ]; then
146
+
echo "Error: Node $$NODE_HOST:$$NODE_PORT did not respond after $$max_retries retries."
147
147
exit 1 # Exit if a node is unresponsive
148
148
fi
149
-
echo "Waiting for $NODE_HOST:$NODE_PORT to respond (attempt $retry_count/$max_retries)..."
149
+
echo "Waiting for $$NODE_HOST:$$NODE_PORT to respond (attempt $$retry_count/$$max_retries)..."
150
150
sleep 3 # Increased sleep between pings
151
151
done
152
152
153
-
echo "Flushing and hard resetting $NODE_HOST:$NODE_PORT"
154
-
redis-cli -h $NODE_HOST -p $NODE_PORT FLUSHALL || echo "Warning: FLUSHALL failed on $NODE_HOST:$NODE_PORT, attempting to continue..."
153
+
echo "Flushing and hard resetting $$NODE_HOST:$$NODE_PORT"
154
+
redis-cli -h $$NODE_HOST -p $$NODE_PORT FLUSHALL || echo "Warning: FLUSHALL failed on $$NODE_HOST:$$NODE_PORT, attempting to continue..."
155
155
# Use CLUSTER RESET HARD
156
-
redis-cli -h $NODE_HOST -p $NODE_PORT CLUSTER RESET HARD || echo "Warning: CLUSTER RESET HARD failed on $NODE_HOST:$NODE_PORT, attempting to continue..."
156
+
redis-cli -h $$NODE_HOST -p $$NODE_PORT CLUSTER RESET HARD || echo "Warning: CLUSTER RESET HARD failed on $$NODE_HOST:$$NODE_PORT, attempting to continue..."
157
157
done
158
158
echo "Node reset complete."
159
159
sleep 5 # Give a moment for resets to settle
@@ -162,29 +162,29 @@ services:
162
162
ATTEMPT=1
163
163
CLUSTER_CREATED=false
164
164
165
-
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
166
-
echo "Attempting to create Redis cluster (Attempt $ATTEMPT/$MAX_ATTEMPTS)..."
167
-
output=$(echo yes | redis-cli --cluster create \
168
-
$NODES \
165
+
while [ $$ATTEMPT -le $$MAX_ATTEMPTS ]; do
166
+
echo "Attempting to create Redis cluster (Attempt $$ATTEMPT/$$MAX_ATTEMPTS)..."
167
+
output=$$(echo yes | redis-cli --cluster create \
168
+
$$NODES \
169
169
--cluster-replicas 1 2>&1)
170
170
171
-
if echo "$output" | grep -q "\[OK\] All 16384 slots covered."; then
171
+
if echo "$$output" | grep -q "\[OK\] All 16384 slots covered."; then
172
172
echo "Cluster created successfully."
173
173
CLUSTER_CREATED=true
174
174
break
175
175
else
176
-
echo "Failed to create cluster on attempt $ATTEMPT."
177
-
echo "Output from redis-cli: $output"
178
-
if [ $ATTEMPT -lt $MAX_ATTEMPTS ]; then
176
+
echo "Failed to create cluster on attempt $$ATTEMPT."
177
+
echo "Output from redis-cli: $$output"
178
+
if [ $$ATTEMPT -lt $$MAX_ATTEMPTS ]; then
179
179
echo "Retrying in 10 seconds..."
180
180
sleep 10
181
181
fi
182
182
fi
183
-
ATTEMPT=$((ATTEMPT + 1))
183
+
ATTEMPT=$$((ATTEMPT + 1))
184
184
done
185
185
186
-
if [ "$CLUSTER_CREATED" = "false" ]; then
187
-
echo "Failed to create cluster after $MAX_ATTEMPTS attempts. Exiting."
186
+
if [ "$$CLUSTER_CREATED" = "false" ]; then
187
+
echo "Failed to create cluster after $$MAX_ATTEMPTS attempts. Exiting."
0 commit comments