Go-Redis replacement parameters in latest valkey-go #2384
Unanswered
royatanu94
asked this question in
Q&A
Replies: 2 comments 2 replies
-
@rueian Any help is appreciated |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @royatanu94, You can try these Sentinel rueidis.ClientOption{
InitAddress: conf.SentinelAddresses,
Sentinel: rueidis.SentinelOption{
MasterSet: conf.MasterName,
Username: conf.SentinelUsername,
Password: conf.SentinelPassword,
},
Username: conf.Username,
Password: conf.Password,
SelectDB: conf.DB,
TLSConfig: tlsConfig,
Dialer: net.Dialer{Timeout: time.Duration(conf.DialTimeout) * time.Millisecond},
ConnWriteTimeout: time.Duration(conf.WriteTimeout) * time.Millisecond,
BlockingPoolSize: conf.PoolSize,
} Cluster rueidis.ClientOption{
InitAddress: conf.ClusterAddresses,
Username: conf.Username,
Password: conf.Password,
SelectDB: conf.DB,
TLSConfig: tlsConfig,
Dialer: net.Dialer{Timeout: time.Duration(conf.DialTimeout) * time.Millisecond},
ConnWriteTimeout: time.Duration(conf.WriteTimeout) * time.Millisecond,
BlockingPoolSize: conf.PoolSize,
} Standalone rueidis.ClientOption{
InitAddress: []string{conf.Address},
Username: conf.Username,
Password: conf.Password,
SelectDB: conf.DB,
TLSConfig: tlsConfig,
Dialer: net.Dialer{Timeout: time.Duration(conf.DialTimeout) * time.Millisecond},
ConnWriteTimeout: time.Duration(conf.WriteTimeout) * time.Millisecond,
BlockingPoolSize: conf.PoolSize,
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi All,
When establishing a Redis connection using go-redis, we configure it through redis.UniversalOptions with the parameters listed below. Could you help identify the corresponding parameters available in valkey-go?
rcOptions = &redis.UniversalOptions{ Addrs: conf.SentinelAddresses, SentinelUsername: conf.SentinelUsername, SentinelPassword: conf.SentinelPassword, MasterName: conf.MasterName, Username: conf.Username, Password: conf.Password, DB: conf.DB, TLSConfig: tlsConfig, DialTimeout: time.Duration(conf.DialTimeout) * time.Millisecond, ReadTimeout: time.Duration(conf.ReadTimeout) * time.Millisecond, WriteTimeout: time.Duration(conf.WriteTimeout) * time.Millisecond, PoolTimeout: conf.PoolTimeout, PoolSize: conf.PoolSize, } } else if len(conf.ClusterAddresses) > 0 { logger.Infow("connecting to redis", "cluster", true, "addr", conf.ClusterAddresses) rcOptions = &redis.UniversalOptions{ Addrs: conf.ClusterAddresses, Username: conf.Username, Password: conf.Password, DB: conf.DB, TLSConfig: tlsConfig, MaxRedirects: conf.GetMaxRedirects(), PoolTimeout: conf.PoolTimeout, PoolSize: conf.PoolSize, } } else { logger.Infow("connecting to redis", "simple", true, "addr", conf.Address) rcOptions = &redis.UniversalOptions{ Addrs: []string{conf.Address}, Username: conf.Username, Password: conf.Password, DB: conf.DB, TLSConfig: tlsConfig, PoolTimeout: conf.PoolTimeout, PoolSize: conf.PoolSize, } }
TIA
Beta Was this translation helpful? Give feedback.
All reactions