Commit 603ac77b authored by Stan Hu's avatar Stan Hu

Merge branch 'redis-version-check-4.0' into 'master'

Raise warning if Redis version < 4.0.0

Closes #213749

See merge request gitlab-org/gitlab!29395
parents d08508b9 0f01c3d5
......@@ -8,10 +8,15 @@ type: reference
The following are the requirements for providing your own Redis instance:
- GitLab 12.0 and later requires Redis version 3.2 or higher. Version 3.2 or higher is recommend as this is
what ships with the GitLab Omnibus package. Older Redis versions do not
support an optional count argument to SPOP which is now required for
[Merge Trains](../../ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md).
- Redis version 5.0 or higher is recommended, as this is what ships with
Omnibus GitLab packages starting with GitLab 12.7.
- Support for Redis 3.2 is deprecated with GitLab 12.10 and will be completely
removed in GitLab 13.0.
- GitLab 12.0 and later requires Redis version 3.2 or higher. Older Redis
versions do not support an optional count argument to SPOP which is now
required for [Merge Trains](../../ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md).
- In addition, if Redis 4 or later is available, GitLab makes use of certain
commands like `UNLINK` and `USAGE` which were introduced only in Redis 4.
- Standalone Redis or Redis high availability with Sentinel are supported. Redis
Cluster is not supported.
- Managed Redis from cloud providers such as AWS ElastiCache will work. If these
......
# frozen_string_literal: true
require 'redis'
module SystemCheck
module App
class RedisVersionCheck < SystemCheck::BaseCheck
MIN_REDIS_VERSION = '2.8.0'
set_name "Redis version >= #{MIN_REDIS_VERSION}?"
MIN_REDIS_VERSION = '3.2.0'
RECOMMENDED_REDIS_VERSION = '4.0.0'
set_name "Redis version >= #{RECOMMENDED_REDIS_VERSION}?"
@custom_error_message = ''
def check?
redis_version = run_command(%w(redis-cli --version))
redis_version = redis_version.try(:match, /redis-cli (\d+\.\d+\.\d+)/)
redis_version = Gitlab::Redis::Queues.with do |redis|
redis.info['redis_version']
end
status = true
if !redis_version
@custom_error_message = "Could not retrieve the Redis version. Please check if your settings are correct"
status = false
elsif Gem::Version.new(redis_version) < Gem::Version.new(MIN_REDIS_VERSION)
@custom_error_message = "Your Redis version #{redis_version} is not supported anymore. Update your Redis server to a version >= #{RECOMMENDED_REDIS_VERSION}"
status = false
elsif Gem::Version.new(redis_version) < Gem::Version.new(RECOMMENDED_REDIS_VERSION)
@custom_error_message = "Support for your Redis version #{redis_version} has been deprecated and will be removed soon. Update your Redis server to a version >= #{RECOMMENDED_REDIS_VERSION}"
status = false
end
redis_version && (Gem::Version.new(redis_version[1]) > Gem::Version.new(MIN_REDIS_VERSION))
status
end
def show_error
try_fixing_it(
"Update your redis server to a version >= #{MIN_REDIS_VERSION}"
@custom_error_message
)
for_more_information(
'gitlab-public-wiki/wiki/Trouble-Shooting-Guide in section sidekiq'
'doc/administration/high_availability/redis.md#provide-your-own-redis-instance-core-only'
)
fix_and_rerun
end
......
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