forked from mirror/redis
Merge pull request #1043 from ramonberrutti/sentinel_password
add option for sentinel password
This commit is contained in:
commit
9dba04507e
|
@ -29,6 +29,7 @@ type FailoverOptions struct {
|
||||||
OnConnect func(*Conn) error
|
OnConnect func(*Conn) error
|
||||||
|
|
||||||
Password string
|
Password string
|
||||||
|
SentinelPassword string
|
||||||
DB int
|
DB int
|
||||||
|
|
||||||
MaxRetries int
|
MaxRetries int
|
||||||
|
@ -83,6 +84,7 @@ func NewFailoverClient(failoverOpt *FailoverOptions) *Client {
|
||||||
failover := &sentinelFailover{
|
failover := &sentinelFailover{
|
||||||
masterName: failoverOpt.MasterName,
|
masterName: failoverOpt.MasterName,
|
||||||
sentinelAddrs: failoverOpt.SentinelAddrs,
|
sentinelAddrs: failoverOpt.SentinelAddrs,
|
||||||
|
password: failoverOpt.SentinelPassword,
|
||||||
|
|
||||||
opt: opt,
|
opt: opt,
|
||||||
}
|
}
|
||||||
|
@ -281,6 +283,7 @@ type sentinelFailover struct {
|
||||||
sentinelAddrs []string
|
sentinelAddrs []string
|
||||||
|
|
||||||
opt *Options
|
opt *Options
|
||||||
|
password string
|
||||||
|
|
||||||
pool *pool.ConnPool
|
pool *pool.ConnPool
|
||||||
poolOnce sync.Once
|
poolOnce sync.Once
|
||||||
|
@ -339,6 +342,8 @@ func (c *sentinelFailover) masterAddr() (string, error) {
|
||||||
sentinel := NewSentinelClient(&Options{
|
sentinel := NewSentinelClient(&Options{
|
||||||
Addr: sentinelAddr,
|
Addr: sentinelAddr,
|
||||||
|
|
||||||
|
Password: c.password,
|
||||||
|
|
||||||
MaxRetries: c.opt.MaxRetries,
|
MaxRetries: c.opt.MaxRetries,
|
||||||
|
|
||||||
DialTimeout: c.opt.DialTimeout,
|
DialTimeout: c.opt.DialTimeout,
|
||||||
|
|
Loading…
Reference in New Issue