mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-12-17 17:51:20 +08:00
Merge pull request #1165 from dqsully/master
Add readOnly and routeByLatency options to Redis Cluster Store
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user