aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2019-12-20 20:56:34 -0800
committerGitHub <noreply@github.com>2019-12-20 20:56:34 -0800
commitcd47112c403cfcf448da8f0b172749671c6ba02a (patch)
treed27b8889183e79918f8c74058302902828c1bc19
parent573b74f24fdd64437b5b06e88c1bd4e75233f6c2 (diff)
parentf934a85d58c99cb43a0532fc34598069e036aa1f (diff)
downloadseaweedfs-cd47112c403cfcf448da8f0b172749671c6ba02a.tar.xz
seaweedfs-cd47112c403cfcf448da8f0b172749671c6ba02a.zip
Merge pull request #1165 from dqsully/master
Add readOnly and routeByLatency options to Redis Cluster Store
-rw-r--r--weed/command/scaffold.go2
-rw-r--r--weed/filer2/redis/redis_cluster_store.go10
2 files changed, 9 insertions, 3 deletions
diff --git a/weed/command/scaffold.go b/weed/command/scaffold.go
index 6ad8effc2..eb97af91c 100644
--- a/weed/command/scaffold.go
+++ b/weed/command/scaffold.go
@@ -136,6 +136,8 @@ addresses = [
"localhost:30006",
]
password = ""
+readOnly = true
+routeByLatency = true
[etcd]
enabled = false
diff --git a/weed/filer2/redis/redis_cluster_store.go b/weed/filer2/redis/redis_cluster_store.go
index 11c315391..379b7a2db 100644
--- a/weed/filer2/redis/redis_cluster_store.go
+++ b/weed/filer2/redis/redis_cluster_store.go
@@ -22,13 +22,17 @@ func (store *RedisClusterStore) Initialize(configuration util.Configuration) (er
return store.initialize(
configuration.GetStringSlice("addresses"),
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{
- Addrs: addresses,
- Password: password,
+ Addrs: addresses,
+ Password: password,
+ ReadOnly: readOnly,
+ RouteByLatency: routeByLatency,
})
return
}