diff --git a/sentinel.go b/sentinel.go index 0f0959b3..34351dc6 100644 --- a/sentinel.go +++ b/sentinel.go @@ -21,8 +21,8 @@ type FailoverOptions struct { // The master name. MasterName string // A seed list of host:port addresses of sentinel nodes. - SentinelAddrs []string - SentinelUsername string + SentinelAddrs []string + // Sentinel password from "requirepass " (if enabled) in Sentinel configuration SentinelPassword string // Following options are copied from Options struct. @@ -90,10 +90,9 @@ func NewFailoverClient(failoverOpt *FailoverOptions) *Client { opt.init() failover := &sentinelFailover{ - masterName: failoverOpt.MasterName, - sentinelAddrs: failoverOpt.SentinelAddrs, - username: failoverOpt.SentinelUsername, - password: failoverOpt.SentinelPassword, + masterName: failoverOpt.MasterName, + sentinelAddrs: failoverOpt.SentinelAddrs, + sentinelPassword: failoverOpt.SentinelPassword, opt: opt, } @@ -279,11 +278,10 @@ func (c *SentinelClient) Remove(ctx context.Context, name string) *StringCmd { } type sentinelFailover struct { - sentinelAddrs []string + sentinelAddrs []string + sentinelPassword string - opt *Options - username string - password string + opt *Options pool *pool.ConnPool poolOnce sync.Once @@ -374,8 +372,8 @@ func (c *sentinelFailover) masterAddr(ctx context.Context) (string, error) { Addr: sentinelAddr, Dialer: c.opt.Dialer, - Username: c.username, - Password: c.password, + Username: c.opt.Username, + Password: c.opt.Password, MaxRetries: c.opt.MaxRetries,