filer: redis cluster add option for password

fix https://github.com/chrislusf/seaweedfs/issues/971
This commit is contained in:
Chris Lu 2019-05-20 09:00:30 -07:00
parent fbbc74abb4
commit 54b835e1ae
2 changed files with 5 additions and 2 deletions

View file

@ -141,6 +141,7 @@ addresses = [
"localhost:30005", "localhost:30005",
"localhost:30006", "localhost:30006",
] ]
password = ""
` `

View file

@ -21,12 +21,14 @@ func (store *RedisClusterStore) GetName() string {
func (store *RedisClusterStore) Initialize(configuration util.Configuration) (err error) { func (store *RedisClusterStore) Initialize(configuration util.Configuration) (err error) {
return store.initialize( return store.initialize(
configuration.GetStringSlice("addresses"), configuration.GetStringSlice("addresses"),
configuration.GetString("password"),
) )
} }
func (store *RedisClusterStore) initialize(addresses []string) (err error) { func (store *RedisClusterStore) initialize(addresses []string, password string) (err error) {
store.Client = redis.NewClusterClient(&redis.ClusterOptions{ store.Client = redis.NewClusterClient(&redis.ClusterOptions{
Addrs: addresses, Addrs: addresses,
Password: password,
}) })
return return
} }