Commit 49f79493 authored by Achilleas Pipinellis's avatar Achilleas Pipinellis

Merge branch 'docs-redis-cleanup-rem' into 'master'

Remove outdated Redis cleanup doc

See merge request gitlab-org/gitlab!70085
parents 69f82184 195bc164
--- ---
stage: Enablement redirect_to: 'index.md'
group: Distribution remove_date: '2021-12-10'
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
--- ---
# Cleaning up stale Redis sessions **(FREE SELF)** This document was moved to [another location](index.md).
Since version 6.2, GitLab stores web user sessions as key-value pairs in Redis. <!-- This redirect file can be deleted after 2021-12-10. -->
Prior to GitLab 7.3, user sessions did not automatically expire from Redis. If <!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
you have been running a large GitLab server (thousands of users) since before
GitLab 7.3 we recommend cleaning up stale sessions to compact the Redis
database after you upgrade to GitLab 7.3. You can also perform a cleanup while
still running GitLab 7.2 or older, but in that case new stale sessions will
start building up again after you clean up.
In GitLab versions prior to 7.3.0, the session keys in Redis are 16-byte
hexadecimal values such as '976aa289e2189b17d7ef525a6702ace9'. Starting with
GitLab 7.3.0, the keys are
prefixed with `session:gitlab:`, so they would look like
`session:gitlab:976aa289e2189b17d7ef525a6702ace9`. Below we describe how to
remove the keys in the old format.
NOTE:
The instructions below must be modified in accordance with your
configuration settings if you have used the advanced Redis
settings outlined in
[Configuration Files Documentation](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/README.md).
First we define a shell function with the proper Redis connection details.
```shell
rcli() {
# This example works for Omnibus installations of GitLab 7.3 or newer. For an
# installation from source you will have to change the socket path and the
# path to redis-cli.
sudo /opt/gitlab/embedded/bin/redis-cli -s /var/opt/gitlab/redis/redis.socket "$@"
}
# test the new shell function; the response should be PONG
rcli ping
```
Now we do a search to see if there are any session keys in the old format for
us to clean up.
```shell
# returns the number of old-format session keys in Redis
rcli keys '*' | grep '^[a-f0-9]\{32\}$' | wc -l
```
If the number is larger than zero, you can proceed to expire the keys from
Redis. If the number is zero there is nothing to clean up.
```shell
# Tell Redis to expire each matched key after 600 seconds.
rcli keys '*' | grep '^[a-f0-9]\{32\}$' | awk '{ print "expire", $0, 600 }' | rcli
# This will print '(integer) 1' for each key that gets expired.
```
Over the next 15 minutes (10 minutes expiry time plus 5 minutes Redis
background save interval) your Redis database will be compacted. If you are
still using GitLab 7.2, users who are not clicking around in GitLab during the
10 minute expiry window will be signed out of GitLab.
...@@ -8,11 +8,6 @@ info: To determine the technical writer assigned to the Stage/Group associated w ...@@ -8,11 +8,6 @@ info: To determine the technical writer assigned to the Stage/Group associated w
Keep your GitLab instance up and running smoothly. Keep your GitLab instance up and running smoothly.
- [Clean up Redis sessions](cleaning_up_redis_sessions.md): Prior to GitLab 7.3,
user sessions did not automatically expire from Redis. If
you have been running a large GitLab server (thousands of users) since before
GitLab 7.3 we recommend cleaning up stale sessions to compact the Redis
database after you upgrade to GitLab 7.3.
- [Rake tasks](../../raketasks/index.md): Tasks for common administration and operational processes such as - [Rake tasks](../../raketasks/index.md): Tasks for common administration and operational processes such as
[cleaning up unneeded items from GitLab instance](../../raketasks/cleanup.md), integrity checks, [cleaning up unneeded items from GitLab instance](../../raketasks/cleanup.md), integrity checks,
and more. and more.
......
...@@ -207,10 +207,6 @@ sudo gitlab-rake gitlab:cleanup:sessions:active_sessions_lookup_keys ...@@ -207,10 +207,6 @@ sudo gitlab-rake gitlab:cleanup:sessions:active_sessions_lookup_keys
bundle exec rake gitlab:cleanup:sessions:active_sessions_lookup_keys RAILS_ENV=production bundle exec rake gitlab:cleanup:sessions:active_sessions_lookup_keys RAILS_ENV=production
``` ```
## Cleaning up stale Redis sessions
[Clean up stale sessions](../administration/operations/cleaning_up_redis_sessions.md) to compact the Redis database after you upgrade to GitLab 7.3.
## Container Registry garbage collection ## Container Registry garbage collection
Container Registry can use considerable amounts of disk space. To clear up Container Registry can use considerable amounts of disk space. To clear up
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment