Browse Source

Merge pull request #1165 from dqsully/master

Add readOnly and routeByLatency options to Redis Cluster Store
pull/1167/head
Chris Lu 5 years ago
committed by GitHub
parent
commit
cd47112c40
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      weed/command/scaffold.go
  2. 6
      weed/filer2/redis/redis_cluster_store.go

2
weed/command/scaffold.go

@ -136,6 +136,8 @@ addresses = [
"localhost:30006", "localhost:30006",
] ]
password = "" password = ""
readOnly = true
routeByLatency = true
[etcd] [etcd]
enabled = false enabled = false

6
weed/filer2/redis/redis_cluster_store.go

@ -22,13 +22,17 @@ func (store *RedisClusterStore) Initialize(configuration util.Configuration) (er
return store.initialize( return store.initialize(
configuration.GetStringSlice("addresses"), configuration.GetStringSlice("addresses"),
configuration.GetString("password"), configuration.GetString("password"),
configuration.GetBool("useReadOnly"),
configuration.GetBool("routeByLatency"),
) )
} }
func (store *RedisClusterStore) initialize(addresses []string, password string) (err error) {
func (store *RedisClusterStore) initialize(addresses []string, password string, readOnly, routeByLatency bool) (err error) {
store.Client = redis.NewClusterClient(&redis.ClusterOptions{ store.Client = redis.NewClusterClient(&redis.ClusterOptions{
Addrs: addresses, Addrs: addresses,
Password: password, Password: password,
ReadOnly: readOnly,
RouteByLatency: routeByLatency,
}) })
return return
} }
Loading…
Cancel
Save