mirror of https://github.com/go-redis/redis.git
add option for sentinel password
This commit is contained in:
parent
90febb9820
commit
c6e879efe2
|
@ -28,6 +28,7 @@ type FailoverOptions struct {
|
|||
OnConnect func(*Conn) error
|
||||
|
||||
Password string
|
||||
SentinelPassword string
|
||||
DB int
|
||||
|
||||
MaxRetries int
|
||||
|
@ -82,6 +83,7 @@ func NewFailoverClient(failoverOpt *FailoverOptions) *Client {
|
|||
failover := &sentinelFailover{
|
||||
masterName: failoverOpt.MasterName,
|
||||
sentinelAddrs: failoverOpt.SentinelAddrs,
|
||||
password: failoverOpt.SentinelPassword,
|
||||
|
||||
opt: opt,
|
||||
}
|
||||
|
@ -276,6 +278,7 @@ type sentinelFailover struct {
|
|||
sentinelAddrs []string
|
||||
|
||||
opt *Options
|
||||
password string
|
||||
|
||||
pool *pool.ConnPool
|
||||
poolOnce sync.Once
|
||||
|
@ -334,6 +337,8 @@ func (c *sentinelFailover) masterAddr() (string, error) {
|
|||
sentinel := NewSentinelClient(&Options{
|
||||
Addr: sentinelAddr,
|
||||
|
||||
Password: c.password,
|
||||
|
||||
MaxRetries: c.opt.MaxRetries,
|
||||
|
||||
DialTimeout: c.opt.DialTimeout,
|
||||
|
|
Loading…
Reference in New Issue