Skip to content

ReadOnly options on failover #3277

Closed
Closed
@smilad

Description

@smilad

hi
You must map the readOnly Option to Replicaonly options
if we want to connect to the slaves in sentinel is not suported

func (o *UniversalOptions) Failover() *FailoverOptions {
if len(o.Addrs) == 0 {
o.Addrs = []string{"127.0.0.1:26379"}
}

return &FailoverOptions{
	SentinelAddrs: o.Addrs,
	MasterName:    o.MasterName,
	ClientName:    o.ClientName,

	Dialer:    o.Dialer,
	OnConnect: o.OnConnect,

	DB:               o.DB,
	Protocol:         o.Protocol,
	Username:         o.Username,
	Password:         o.Password,
	SentinelUsername: o.SentinelUsername,
	SentinelPassword: o.SentinelPassword,

	MaxRetries:      o.MaxRetries,
	MinRetryBackoff: o.MinRetryBackoff,
	MaxRetryBackoff: o.MaxRetryBackoff,

	DialTimeout:           o.DialTimeout,
	ReadTimeout:           o.ReadTimeout,
	WriteTimeout:          o.WriteTimeout,
	ContextTimeoutEnabled: o.ContextTimeoutEnabled,

	PoolFIFO:        o.PoolFIFO,
	PoolSize:        o.PoolSize,
	PoolTimeout:     o.PoolTimeout,
	MinIdleConns:    o.MinIdleConns,
	MaxIdleConns:    o.MaxIdleConns,
	MaxActiveConns:  o.MaxActiveConns,
	ConnMaxIdleTime: o.ConnMaxIdleTime,
	ConnMaxLifetime: o.ConnMaxLifetime,

	TLSConfig: o.TLSConfig,

	DisableIndentity: o.DisableIndentity,
	IdentitySuffix:   o.IdentitySuffix,
	UnstableResp3:    o.UnstableResp3,
}

}

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions