Skip to content

Commit 5255f40

Browse files
committed
fix bug
1 parent 57285df commit 5255f40

25 files changed

+108
-108
lines changed

addons/redis/redis-cluster-scripts/redis-cluster-common.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ shutdown_redis_server() {
141141
local service_port="$1"
142142
unset_xtrace_when_ut_mode_false
143143
if ! is_empty "$REDIS_DEFAULT_PASSWORD"; then
144-
redis-cli -h 127.0.0.1 -p "$service_port" -a "$REDIS_DEFAULT_PASSWORD" $REDIS_CLI_TLS_CMD shutdown
144+
redis-cli $REDIS_CLI_TLS_CMD -h 127.0.0.1 -p "$service_port" -a "$REDIS_DEFAULT_PASSWORD" shutdown
145145
else
146-
redis-cli -h 127.0.0.1 -p "$service_port" $REDIS_CLI_TLS_CMD shutdown
146+
redis-cli $REDIS_CLI_TLS_CMD -h 127.0.0.1 -p "$service_port" shutdown
147147
fi
148148
set_xtrace_when_ut_mode_false
149149
echo "shutdown redis server succeeded!"
@@ -155,9 +155,9 @@ check_redis_server_ready() {
155155
local port="$2"
156156
local max_retry=10
157157
local retry_interval=5
158-
check_ready_cmd="redis-cli -h $host -p $port $REDIS_CLI_TLS_CMD ping"
158+
check_ready_cmd="redis-cli $REDIS_CLI_TLS_CMD -h $host -p $port ping"
159159
if ! is_empty "$REDIS_DEFAULT_PASSWORD"; then
160-
check_ready_cmd="redis-cli -h $host -p $port -a $REDIS_DEFAULT_PASSWORD $REDIS_CLI_TLS_CMD ping"
160+
check_ready_cmd="redis-cli $REDIS_CLI_TLS_CMD -h $host -p $port -a $REDIS_DEFAULT_PASSWORD ping"
161161
fi
162162
output=$($check_ready_cmd)
163163
set_xtrace_when_ut_mode_false
@@ -227,10 +227,10 @@ send_cluster_meet() {
227227

228228
unset_xtrace_when_ut_mode_false
229229
if is_empty "$REDIS_DEFAULT_PASSWORD"; then
230-
meet_command="redis-cli -h $primary_endpoint -p $primary_port $REDIS_CLI_TLS_CMD cluster meet $announce_ip $announce_port $announce_bus_port"
230+
meet_command="redis-cli $REDIS_CLI_TLS_CMD -h $primary_endpoint -p $primary_port cluster meet $announce_ip $announce_port $announce_bus_port"
231231
logging_mask_meet_command="$meet_command"
232232
else
233-
meet_command="redis-cli -h $primary_endpoint -p $primary_port -a $REDIS_DEFAULT_PASSWORD $REDIS_CLI_TLS_CMD cluster meet $announce_ip $announce_port $announce_bus_port"
233+
meet_command="redis-cli $REDIS_CLI_TLS_CMD -h $primary_endpoint -p $primary_port -a $REDIS_DEFAULT_PASSWORD cluster meet $announce_ip $announce_port $announce_bus_port"
234234
logging_mask_meet_command="${meet_command/$REDIS_DEFAULT_PASSWORD/********}"
235235
fi
236236
echo "check and correct other primary nodes meet command: $logging_mask_meet_command"
@@ -249,9 +249,9 @@ get_cluster_info() {
249249
local cluster_node="$1"
250250
local cluster_node_port="$2"
251251
unset_xtrace_when_ut_mode_false
252-
local command="redis-cli -h $cluster_node -p $cluster_node_port $REDIS_CLI_TLS_CMD cluster info"
252+
local command="redis-cli $REDIS_CLI_TLS_CMD -h $cluster_node -p $cluster_node_port cluster info"
253253
if ! is_empty "$REDIS_DEFAULT_PASSWORD"; then
254-
command="redis-cli -h $cluster_node -p $cluster_node_port -a $REDIS_DEFAULT_PASSWORD $REDIS_CLI_TLS_CMD cluster info"
254+
command="redis-cli $REDIS_CLI_TLS_CMD -h $cluster_node -p $cluster_node_port -a $REDIS_DEFAULT_PASSWORD cluster info"
255255
fi
256256
cluster_info=$($command)
257257
set_xtrace_when_ut_mode_false
@@ -268,9 +268,9 @@ get_cluster_nodes_info() {
268268
local cluster_node="$1"
269269
local cluster_node_port="$2"
270270
unset_xtrace_when_ut_mode_false
271-
local command="redis-cli -h $cluster_node -p $cluster_node_port $REDIS_CLI_TLS_CMD cluster nodes"
271+
local command="redis-cli $REDIS_CLI_TLS_CMD -h $cluster_node -p $cluster_node_port cluster nodes"
272272
if ! is_empty "$REDIS_DEFAULT_PASSWORD"; then
273-
command="redis-cli -h $cluster_node -p $cluster_node_port -a $REDIS_DEFAULT_PASSWORD $REDIS_CLI_TLS_CMD cluster nodes"
273+
command="redis-cli $REDIS_CLI_TLS_CMD -h $cluster_node -p $cluster_node_port -a $REDIS_DEFAULT_PASSWORD cluster nodes"
274274
fi
275275
cluster_nodes_info=$($command)
276276
set_xtrace_when_ut_mode_false
@@ -491,10 +491,10 @@ build_redis_cluster_create_command() {
491491
local primary_nodes="$1"
492492
unset_xtrace_when_ut_mode_false
493493
if is_empty "$REDIS_DEFAULT_PASSWORD"; then
494-
initialize_command="redis-cli --cluster create $primary_nodes --cluster-yes $REDIS_CLI_TLS_CMD"
494+
initialize_command="redis-cli $REDIS_CLI_TLS_CMD --cluster create $primary_nodes --cluster-yes"
495495
logging_mask_initialize_command="$initialize_command"
496496
else
497-
initialize_command="redis-cli --cluster create $primary_nodes -a $REDIS_DEFAULT_PASSWORD $REDIS_CLI_TLS_CMD --cluster-yes"
497+
initialize_command="redis-cli $REDIS_CLI_TLS_CMD --cluster create $primary_nodes -a $REDIS_DEFAULT_PASSWORD --cluster-yes"
498498
logging_mask_initialize_command="${initialize_command/$REDIS_DEFAULT_PASSWORD/********}"
499499
fi
500500
echo "initialize cluster command: $logging_mask_initialize_command" >&2

addons/redis/redis-cluster-scripts/redis-cluster-manage.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,9 +897,9 @@ scale_out_redis_cluster_shard() {
897897
sync_acl_for_redis_cluster_shard() {
898898
echo "Sync ACL rules for redis cluster shard..."
899899
set +ex
900-
redis_base_cmd="redis-cli -p $SERVICE_PORT -a $REDIS_DEFAULT_PASSWORD $REDIS_CLI_TLS_CMD"
900+
redis_base_cmd="redis-cli $REDIS_CLI_TLS_CMD -p $SERVICE_PORT -a $REDIS_DEFAULT_PASSWORD"
901901
if [ -z "$REDIS_DEFAULT_PASSWORD" ]; then
902-
redis_base_cmd="redis-cli -p $SERVICE_PORT $REDIS_CLI_TLS_CMD"
902+
redis_base_cmd="redis-cli $REDIS_CLI_TLS_CMD -p $SERVICE_PORT"
903903
fi
904904
is_ok=false
905905
acl_list=""

addons/redis/redis-cluster-scripts/redis-cluster-replica-pre-stop.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ load_common_library() {
1616

1717
acl_save_before_stop() {
1818
if ! is_empty "$REDIS_DEFAULT_PASSWORD"; then
19-
acl_save_command="redis-cli -h localhost -p $SERVICE_PORT -a $REDIS_DEFAULT_PASSWORD $REDIS_CLI_TLS_CMD acl save"
19+
acl_save_command="redis-cli $REDIS_CLI_TLS_CMD -h localhost -p $SERVICE_PORT -a $REDIS_DEFAULT_PASSWORD acl save"
2020
logging_mask_acl_save_command="${acl_save_command/$REDIS_DEFAULT_PASSWORD/********}"
2121
else
22-
acl_save_command="redis-cli -h localhost -p $SERVICE_PORT $REDIS_CLI_TLS_CMD acl save"
22+
acl_save_command="redis-cli $REDIS_CLI_TLS_CMD -h localhost -p $SERVICE_PORT acl save"
2323
logging_mask_acl_save_command="$acl_save_command"
2424
fi
2525
echo "acl save command: $logging_mask_acl_save_command"

addons/redis/redis-cluster-scripts/redis-cluster-server-start.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,9 @@ scale_redis_cluster_replica() {
403403
echo "Current instance is a rebuild-instance, forget node id in the cluster firstly."
404404
node_id=$(get_cluster_id_with_retry "$primary_node_endpoint_for_meet" "$primary_node_port" "$current_pod_fqdn")
405405
if [ -z ${REDIS_DEFAULT_PASSWORD} ]; then
406-
redis-cli -p $service_port $REDIS_CLI_TLS_CMD --cluster call $primary_node_endpoint_with_port cluster forget ${node_id}
406+
redis-cli $REDIS_CLI_TLS_CMD -p $service_port --cluster call $primary_node_endpoint_with_port cluster forget ${node_id}
407407
else
408-
redis-cli -p $service_port $REDIS_CLI_TLS_CMD --cluster call $primary_node_endpoint_with_port cluster forget ${node_id} -a ${REDIS_DEFAULT_PASSWORD}
408+
redis-cli $REDIS_CLI_TLS_CMD -p $service_port --cluster call $primary_node_endpoint_with_port cluster forget ${node_id} -a ${REDIS_DEFAULT_PASSWORD}
409409
fi
410410
fi
411411
current_node_with_port="$current_pod_fqdn:$service_port"

addons/redis/redis-cluster-scripts/redis-cluster-switchover.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ get_current_shard_primary() {
6666
local master_info
6767
unset_xtrace_when_ut_mode_false
6868
if is_empty "$REDIS_DEFAULT_PASSWORD"; then
69-
master_info=$(redis-cli -h $host -p $port $REDIS_CLI_TLS_CMD info replication)
69+
master_info=$(redis-cli $REDIS_CLI_TLS_CMD -h $host -p $port info replication)
7070
else
71-
master_info=$(redis-cli -h $host -p $port -a "$REDIS_DEFAULT_PASSWORD" $REDIS_CLI_TLS_CMD info replication)
71+
master_info=$(redis-cli $REDIS_CLI_TLS_CMD -h $host -p $port -a "$REDIS_DEFAULT_PASSWORD" info replication)
7272
fi
7373
set_xtrace_when_ut_mode_false
7474

@@ -91,9 +91,9 @@ get_all_shards_master() {
9191
local cluster_nodes_info
9292
unset_xtrace_when_ut_mode_false
9393
if is_empty "$REDIS_DEFAULT_PASSWORD"; then
94-
cluster_nodes_info=$(redis-cli -h $host -p $port $REDIS_CLI_TLS_CMD cluster nodes)
94+
cluster_nodes_info=$(redis-cli $REDIS_CLI_TLS_CMD -h $host -p $port cluster nodes)
9595
else
96-
cluster_nodes_info=$(redis-cli -h $host -p $port -a "$REDIS_DEFAULT_PASSWORD" $REDIS_CLI_TLS_CMD cluster nodes)
96+
cluster_nodes_info=$(redis-cli $REDIS_CLI_TLS_CMD -h $host -p $port -a "$REDIS_DEFAULT_PASSWORD" cluster nodes)
9797
fi
9898
set_xtrace_when_ut_mode_false
9999

@@ -153,9 +153,9 @@ do_switchover() {
153153
echo "Starting switchover to $candidate_pod"
154154
unset_xtrace_when_ut_mode_false
155155
if is_empty "$REDIS_DEFAULT_PASSWORD"; then
156-
result=$(redis-cli -h "$candidate_pod_fqdn" -p $service_port $REDIS_CLI_TLS_CMD cluster failover)
156+
result=$(redis-cli $REDIS_CLI_TLS_CMD -h "$candidate_pod_fqdn" -p $service_port cluster failover)
157157
else
158-
result=$(redis-cli -h "$candidate_pod_fqdn" -p $service_port -a "$REDIS_DEFAULT_PASSWORD" $REDIS_CLI_TLS_CMD cluster failover)
158+
result=$(redis-cli $REDIS_CLI_TLS_CMD -h "$candidate_pod_fqdn" -p $service_port -a "$REDIS_DEFAULT_PASSWORD" cluster failover)
159159
fi
160160
if [ "$need_check" != "true" ]; then
161161
return 0

addons/redis/redis-cluster-scripts/redis-cluster6-switchover.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ get_current_shard_primary() {
6666
local master_info
6767
unset_xtrace_when_ut_mode_false
6868
if is_empty "$REDIS_DEFAULT_PASSWORD"; then
69-
master_info=$(redis-cli -h $host -p $port info replication)
69+
master_info=$(redis-cli $REDIS_CLI_TLS_CMD -h $host -p $port info replication)
7070
else
71-
master_info=$(redis-cli -h $host -p $port -a "$REDIS_DEFAULT_PASSWORD" info replication)
71+
master_info=$(redis-cli $REDIS_CLI_TLS_CMD -h $host -p $port -a "$REDIS_DEFAULT_PASSWORD" info replication)
7272
fi
7373
set_xtrace_when_ut_mode_false
7474

@@ -91,9 +91,9 @@ get_all_shards_master() {
9191
local cluster_nodes_info
9292
unset_xtrace_when_ut_mode_false
9393
if is_empty "$REDIS_DEFAULT_PASSWORD"; then
94-
cluster_nodes_info=$(redis-cli -h $host -p $port cluster nodes)
94+
cluster_nodes_info=$(redis-cli $REDIS_CLI_TLS_CMD -h $host -p $port cluster nodes)
9595
else
96-
cluster_nodes_info=$(redis-cli -h $host -p $port -a "$REDIS_DEFAULT_PASSWORD" cluster nodes)
96+
cluster_nodes_info=$(redis-cli $REDIS_CLI_TLS_CMD -h $host -p $port -a "$REDIS_DEFAULT_PASSWORD" cluster nodes)
9797
fi
9898
set_xtrace_when_ut_mode_false
9999

@@ -154,9 +154,9 @@ do_switchover() {
154154
echo "Starting switchover to $candidate_pod"
155155
unset_xtrace_when_ut_mode_false
156156
if is_empty "$REDIS_DEFAULT_PASSWORD"; then
157-
result=$(redis-cli -h "$candidate_pod_fqdn" -p $service_port cluster failover)
157+
result=$(redis-cli $REDIS_CLI_TLS_CMD -h "$candidate_pod_fqdn" -p $service_port cluster failover)
158158
else
159-
result=$(redis-cli -h "$candidate_pod_fqdn" -p $service_port -a "$REDIS_DEFAULT_PASSWORD" cluster failover)
159+
result=$(redis-cli $REDIS_CLI_TLS_CMD -h "$candidate_pod_fqdn" -p $service_port -a "$REDIS_DEFAULT_PASSWORD" cluster failover)
160160
fi
161161
set_xtrace_when_ut_mode_false
162162
if [ "$result" != "OK" ]; then

addons/redis/redis-cluster-scripts/redis-ping.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ load_common_library() {
2929
check_redis_ok() {
3030
unset_xtrace_when_ut_mode_false
3131
if ! is_empty "$REDIS_DEFAULT_PASSWORD"; then
32-
cmd="redis-cli -h localhost -p $SERVICE_PORT $REDIS_CLI_TLS_CMD -a $REDIS_DEFAULT_PASSWORD ping"
32+
cmd="redis-cli $REDIS_CLI_TLS_CMD -h localhost -p $SERVICE_PORT -a $REDIS_DEFAULT_PASSWORD ping"
3333
else
34-
cmd="redis-cli -h localhost -p $SERVICE_PORT $REDIS_CLI_TLS_CMD ping"
34+
cmd="redis-cli $REDIS_CLI_TLS_CMD -h localhost -p $SERVICE_PORT ping"
3535
fi
3636
response=$($cmd)
3737
status=$?

addons/redis/redis-cluster-scripts/sync-acl.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22

3-
redis_base_cmd="redis-cli -p $SERVICE_PORT -a $REDIS_DEFAULT_PASSWORD $REDIS_CLI_TLS_CMD"
3+
redis_base_cmd="redis-cli $REDIS_CLI_TLS_CMD -p $SERVICE_PORT -a $REDIS_DEFAULT_PASSWORD"
44
if [ -z "$REDIS_DEFAULT_PASSWORD" ]; then
5-
redis_base_cmd="redis-cli -p $SERVICE_PORT $REDIS_CLI_TLS_CMD"
5+
redis_base_cmd="redis-cli $REDIS_CLI_TLS_CMD -p $SERVICE_PORT"
66
fi
77

88
is_ok=false

0 commit comments

Comments
 (0)