File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -532,14 +532,14 @@ func (a *Admin) ResetPassword(newPassword string) error {
532532 }
533533 for addr , c := range a .Connections ().GetAll () {
534534 a .log .Info ("reset password" , "addr" , addr )
535- setPasswdResp := c .Cmd ("CONFIG" , "SET" , "requirepass" , newPassword )
536- if err := a .Connections ().ValidateResp (setPasswdResp , addr , "cannot set new requirepass" ); err != nil {
537- return err
538- }
539535 setMasterauth := c .Cmd ("CONFIG" , "SET" , "masterauth" , newPassword )
540536 if err := a .Connections ().ValidateResp (setMasterauth , addr , "cannot set new masterauth" ); err != nil {
541537 return err
542538 }
539+ setPasswdResp := c .Cmd ("CONFIG" , "SET" , "requirepass" , newPassword )
540+ if err := a .Connections ().ValidateResp (setPasswdResp , addr , "cannot set new requirepass" ); err != nil {
541+ return err
542+ }
543543 }
544544 return nil
545545}
Original file line number Diff line number Diff line change @@ -29,9 +29,13 @@ failover() {
2929 echo "Master: ${masterID}"
3030 slave=$(cat ${CLUSTER_CONFIG} | grep ${masterID} | grep "slave" | awk 'NR==1{print $2}' | sed 's/:6379@16379//')
3131 echo "Slave: ${slave}"
32- redis-cli -h ${slave} -a "${REDIS_PASSWORD}" CLUSTER FAILOVER
33- echo "Wait for MASTER <-> SLAVE syncFinished"
34- sleep 20
32+ if [[ -z "${REDIS_PASSWORD}" ]]; then
33+ redis-cli -h ${slave} CLUSTER FAILOVER
34+ else
35+ redis-cli -h ${slave} -a "${REDIS_PASSWORD}" CLUSTER FAILOVER
36+ fi
37+ echo "Wait for MASTER <-> SLAVE syncFinished"
38+ sleep 20
3539}
3640if [ -f ${CLUSTER_CONFIG} ]; then
3741 cat ${CLUSTER_CONFIG} | grep "myself" | grep "master" && \
You can’t perform that action at this time.
0 commit comments