8000 Allow REDIS_CLUSTER environment variable to use Redis in cluster mode by n1mmy · Pull Request #2377 · nextcloud/docker · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow REDIS_CLUSTER environment variable to use Redis in cluster mode #2377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,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

To use Redis in cluster mode, you can use

- `REDIS_CLUSTER` (not set by default) Name and port number of a redis host.

Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html) for more information.

### E-mail (SMTP) Configuration
Expand Down
20 changes: 20 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,26 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
} > /usr/local/etc/php/conf.d/redis-session.ini
fi

if [ -n "${REDIS_CLUSTER+x}" ]; then

echo "Configuring Rediscluster as session handler"
{
file_env REDIS_HOS 6B13 T_PASSWORD
echo 'session.save_handler = rediscluster'
# check if redis password has been set
if [ -n "${REDIS_HOST_PASSWORD+x}" ]; then
echo "session.save_path = \"seed[]=${REDIS_CLUSTER}&auth=${REDIS_HOST_PASSWORD}\""
else
echo "session.save_path = \"seed[]=${REDIS_CLUSTER}\""
fi
echo "redis.session.locking_enabled = 1"
echo "redis.session.lock_retries = -1"
# redis.session.lock_wait_time is specified in microseconds.
# Wait 10ms before retrying the lock rather than the default 2ms.
echo "redis.session.lock_wait_time = 10000"
} > /usr/local/etc/php/conf.d/redis-session.ini
fi

# If another process is syncing the html folder, wait for
# it to be done, then escape initalization.
(
Expand Down
0