From 301bc2f69d6648a488253ea9701846c40fedf511 Mon Sep 17 00:00:00 2001 From: Dakota Sullivan Date: Wed, 18 Dec 2019 08:34:19 -0700 Subject: [PATCH 1/3] Add readOnly and routeByLatency options to Redis Cluster Store --- weed/filer2/redis/redis_cluster_store.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/weed/filer2/redis/redis_cluster_store.go b/weed/filer2/redis/redis_cluster_store.go index 11c315391..fcb81a004 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("connection_use_read_only"), + configuration.GetBool("connection_route_by_latency"), ) } -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 } From a0c9d9c0e78dd3e865edd79cd4f308f900a02973 Mon Sep 17 00:00:00 2001 From: Dakota Sullivan Date: Fri, 20 Dec 2019 19:23:01 -0700 Subject: [PATCH 2/3] Fix config property names --- weed/filer2/redis/redis_cluster_store.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/weed/filer2/redis/redis_cluster_store.go b/weed/filer2/redis/redis_cluster_store.go index fcb81a004..379b7a2db 100644 --- a/weed/filer2/redis/redis_cluster_store.go +++ b/weed/filer2/redis/redis_cluster_store.go @@ -22,8 +22,8 @@ func (store *RedisClusterStore) Initialize(configuration util.Configuration) (er return store.initialize( configuration.GetStringSlice("addresses"), configuration.GetString("password"), - configuration.GetBool("connection_use_read_only"), - configuration.GetBool("connection_route_by_latency"), + configuration.GetBool("useReadOnly"), + configuration.GetBool("routeByLatency"), ) } From f934a85d58c99cb43a0532fc34598069e036aa1f Mon Sep 17 00:00:00 2001 From: Dakota Sullivan Date: Fri, 20 Dec 2019 19:27:15 -0700 Subject: [PATCH 3/3] Add readOnly and routeByLatency options to scaffold.go --- weed/command/scaffold.go | 2 ++ 1 file changed, 2 insertions(+) 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