You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
GCP memory store has a Redis implementation. You can either create a Redis cluster, or you can have a single Redis instance with replicas.
Im able to use the go-redis client to connect to and use the single instance redis, but it doesn't look like there is an option to enable the read only replicas (I do see the ReadOnly option, but the docs/comments suggest it only works for cluster clients)
// Only cluster clients.
ReadOnly bool
Has anyone found a way around this, or looked at implementing something that supports it?
Notionally I was thinking we could maintain a map of clients, and keep track of which ones were were only. Ideally a better solution might be something like gorms DBResolver, that picks a primary or replica DB based on the type of command being executed.
Looking at the code that creates the redis client it looks like this
type Client struct {
*baseClient
cmdable
hooks
ctx context.Context
}
I'm wondering if we could add a field replicaBaseClients []*baseClient
When were executing the command determine if its readonly or write command?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
GCP memory store has a Redis implementation. You can either create a Redis cluster, or you can have a single Redis instance with replicas.
Im able to use the go-redis client to connect to and use the single instance redis, but it doesn't look like there is an option to enable the read only replicas (I do see the ReadOnly option, but the docs/comments suggest it only works for cluster clients)
Has anyone found a way around this, or looked at implementing something that supports it?
Notionally I was thinking we could maintain a map of clients, and keep track of which ones were were only. Ideally a better solution might be something like gorms DBResolver, that picks a primary or replica DB based on the type of command being executed.
Looking at the code that creates the redis client it looks like this
I'm wondering if we could add a field
replicaBaseClients []*baseClient
When were executing the command determine if its readonly or write command?
Beta Was this translation helpful? Give feedback.
All reactions