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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
9 additions and
3 deletions
-
weed/command/scaffold.go
-
weed/filer2/redis/redis_cluster_store.go
|
@ -136,6 +136,8 @@ addresses = [ |
|
|
"localhost:30006", |
|
|
"localhost:30006", |
|
|
] |
|
|
] |
|
|
password = "" |
|
|
password = "" |
|
|
|
|
|
readOnly = true |
|
|
|
|
|
routeByLatency = true |
|
|
|
|
|
|
|
|
[etcd] |
|
|
[etcd] |
|
|
enabled = false |
|
|
enabled = false |
|
|
|
@ -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 |
|
|
} |
|
|
} |