aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/redis_lua/redis_store.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2025-12-01 13:31:35 -0800
committerGitHub <noreply@github.com>2025-12-01 13:31:35 -0800
commit61c0514a1c0119875dc7e7ebb8c45b2914c732bf (patch)
tree0931c571cf3022aa1e241061a22595ce2efce173 /weed/filer/redis_lua/redis_store.go
parent5602f98c479f2f04e3b75deff4372f357168cc0a (diff)
downloadseaweedfs-61c0514a1c0119875dc7e7ebb8c45b2914c732bf.tar.xz
seaweedfs-61c0514a1c0119875dc7e7ebb8c45b2914c732bf.zip
filer: add username and keyPrefix support for Redis stores (#7591)
* filer: add username and keyPrefix support for Redis stores Addresses https://github.com/seaweedfs/seaweedfs/issues/7299 - Add username config option to redis2, redis_cluster2, redis_lua, and redis_lua_cluster stores (sentinel stores already had it) - Add keyPrefix config option to all Redis stores to prefix all keys, useful for Envoy Redis Proxy or multi-tenant Redis setups * refactor: reduce duplication in redis.NewClient creation Address code review feedback by defining redis.Options once and conditionally setting TLSConfig instead of duplicating the entire NewClient call. * filer.toml: add username and keyPrefix to redis2.tmp example
Diffstat (limited to 'weed/filer/redis_lua/redis_store.go')
-rw-r--r--weed/filer/redis_lua/redis_store.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/weed/filer/redis_lua/redis_store.go b/weed/filer/redis_lua/redis_store.go
index 8574baa09..4f6354e96 100644
--- a/weed/filer/redis_lua/redis_store.go
+++ b/weed/filer/redis_lua/redis_store.go
@@ -21,18 +21,22 @@ func (store *RedisLuaStore) GetName() string {
func (store *RedisLuaStore) Initialize(configuration util.Configuration, prefix string) (err error) {
return store.initialize(
configuration.GetString(prefix+"address"),
+ configuration.GetString(prefix+"username"),
configuration.GetString(prefix+"password"),
configuration.GetInt(prefix+"database"),
+ configuration.GetString(prefix+"keyPrefix"),
configuration.GetStringSlice(prefix+"superLargeDirectories"),
)
}
-func (store *RedisLuaStore) initialize(hostPort string, password string, database int, superLargeDirectories []string) (err error) {
+func (store *RedisLuaStore) initialize(hostPort string, username string, password string, database int, keyPrefix string, superLargeDirectories []string) (err error) {
store.Client = redis.NewClient(&redis.Options{
Addr: hostPort,
+ Username: username,
Password: password,
DB: database,
})
+ store.keyPrefix = keyPrefix
store.loadSuperLargeDirectories(superLargeDirectories)
return
}