diff --git a/.config/redis.config.php b/.config/redis.config.php index 2069812f4..d47658cf1 100644 --- a/.config/redis.config.php +++ b/.config/redis.config.php @@ -1,5 +1,27 @@ '\OC\Memcache\Redis', + 'memcache.locking' => '\OC\Memcache\Redis', + 'redis.cluster' => array( + 'seeds' => $redisClusterSeeds, + 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), + ), + ); + + if (getenv('REDIS_HOST_USER') !== false) { + $CONFIG['redis.cluster']['user'] = (string) getenv('REDIS_HOST_USER'); + } +} elseif (getenv('REDIS_HOST')) { $CONFIG = array( 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', diff --git a/32/apache/config/redis.config.php b/32/apache/config/redis.config.php index 2069812f4..d47658cf1 100644 --- a/32/apache/config/redis.config.php +++ b/32/apache/config/redis.config.php @@ -1,5 +1,27 @@ '\OC\Memcache\Redis', + 'memcache.locking' => '\OC\Memcache\Redis', + 'redis.cluster' => array( + 'seeds' => $redisClusterSeeds, + 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), + ), + ); + + if (getenv('REDIS_HOST_USER') !== false) { + $CONFIG['redis.cluster']['user'] = (string) getenv('REDIS_HOST_USER'); + } +} elseif (getenv('REDIS_HOST')) { $CONFIG = array( 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', diff --git a/32/fpm-alpine/config/redis.config.php b/32/fpm-alpine/config/redis.config.php index 2069812f4..d47658cf1 100644 --- a/32/fpm-alpine/config/redis.config.php +++ b/32/fpm-alpine/config/redis.config.php @@ -1,5 +1,27 @@ '\OC\Memcache\Redis', + 'memcache.locking' => '\OC\Memcache\Redis', + 'redis.cluster' => array( + 'seeds' => $redisClusterSeeds, + 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), + ), + ); + + if (getenv('REDIS_HOST_USER') !== false) { + $CONFIG['redis.cluster']['user'] = (string) getenv('REDIS_HOST_USER'); + } +} elseif (getenv('REDIS_HOST')) { $CONFIG = array( 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', diff --git a/32/fpm/config/redis.config.php b/32/fpm/config/redis.config.php index 2069812f4..d47658cf1 100644 --- a/32/fpm/config/redis.config.php +++ b/32/fpm/config/redis.config.php @@ -1,5 +1,27 @@ '\OC\Memcache\Redis', + 'memcache.locking' => '\OC\Memcache\Redis', + 'redis.cluster' => array( + 'seeds' => $redisClusterSeeds, + 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), + ), + ); + + if (getenv('REDIS_HOST_USER') !== false) { + $CONFIG['redis.cluster']['user'] = (string) getenv('REDIS_HOST_USER'); + } +} elseif (getenv('REDIS_HOST')) { $CONFIG = array( 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', diff --git a/33/apache/config/redis.config.php b/33/apache/config/redis.config.php index 2069812f4..d47658cf1 100644 --- a/33/apache/config/redis.config.php +++ b/33/apache/config/redis.config.php @@ -1,5 +1,27 @@ '\OC\Memcache\Redis', + 'memcache.locking' => '\OC\Memcache\Redis', + 'redis.cluster' => array( + 'seeds' => $redisClusterSeeds, + 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), + ), + ); + + if (getenv('REDIS_HOST_USER') !== false) { + $CONFIG['redis.cluster']['user'] = (string) getenv('REDIS_HOST_USER'); + } +} elseif (getenv('REDIS_HOST')) { $CONFIG = array( 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', diff --git a/33/fpm-alpine/config/redis.config.php b/33/fpm-alpine/config/redis.config.php index 2069812f4..d47658cf1 100644 --- a/33/fpm-alpine/config/redis.config.php +++ b/33/fpm-alpine/config/redis.config.php @@ -1,5 +1,27 @@ '\OC\Memcache\Redis', + 'memcache.locking' => '\OC\Memcache\Redis', + 'redis.cluster' => array( + 'seeds' => $redisClusterSeeds, + 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), + ), + ); + + if (getenv('REDIS_HOST_USER') !== false) { + $CONFIG['redis.cluster']['user'] = (string) getenv('REDIS_HOST_USER'); + } +} elseif (getenv('REDIS_HOST')) { $CONFIG = array( 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', diff --git a/33/fpm/config/redis.config.php b/33/fpm/config/redis.config.php index 2069812f4..d47658cf1 100644 --- a/33/fpm/config/redis.config.php +++ b/33/fpm/config/redis.config.php @@ -1,5 +1,27 @@ '\OC\Memcache\Redis', + 'memcache.locking' => '\OC\Memcache\Redis', + 'redis.cluster' => array( + 'seeds' => $redisClusterSeeds, + 'password' => getenv('REDIS_HOST_PASSWORD_FILE') ? trim(file_get_contents(getenv('REDIS_HOST_PASSWORD_FILE'))) : (string) getenv('REDIS_HOST_PASSWORD'), + ), + ); + + if (getenv('REDIS_HOST_USER') !== false) { + $CONFIG['redis.cluster']['user'] = (string) getenv('REDIS_HOST_USER'); + } +} elseif (getenv('REDIS_HOST')) { $CONFIG = array( 'memcache.distributed' => '\OC\Memcache\Redis', 'memcache.locking' => '\OC\Memcache\Redis', diff --git a/README.md b/README.md index eef0ff67c..fc9fb720d 100644 --- a/README.md +++ b/README.md @@ -290,6 +290,10 @@ To use Redis for memory caching as well as PHP session storage, specify the foll - `REDIS_HOST_USER` (not set by default) Optional username for Redis, only use for external Redis servers that require a user. - `REDIS_HOST_PASSWORD` (not set by default) Redis password +For Redis Cluster, set the seed list as a comma-separated list of host:port pairs. When `REDIS_CLUSTER_SEEDS` is set, Redis Cluster config is used instead of `REDIS_HOST`. + +- `REDIS_CLUSTER_SEEDS` (not set by default) Comma-separated list of cluster seeds, e.g. `redis-1:6379,redis-2:6379,redis-3:6379` + Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html) for more information. ### E-mail (SMTP) Configuration