{{< details >}}

  1. Tier: 基础版, 专业版, 旗舰版
  2. Offering: 私有化部署

{{< /details >}}

使用 Linux 软件包可以配置一个独立的 Redis 服务器。在这种配置下,Redis 没有进行扩展,代表了单点故障。然而,在扩展环境中,目标是允许环境处理更多用户或提高吞吐量。Redis 本身通常是稳定的,可以处理许多请求,因此只有一个实例是可以接受的权衡。请参阅参考架构页面以获取极狐GitLab 扩展选项的概述。

设置独立的 Redis 实例

以下步骤是使用 Linux 软件包配置 Redis 服务器的最低要求:

  1. SSH 进入 Redis 服务器。
  2. 下载并安装所需的 Linux 软件包,使用极狐GitLab 下载页面的步骤 1 和 2。不要完成下载页面上的其他步骤。

  3. 编辑 /etc/gitlab/gitlab.rb 并添加以下内容:

    ## Enable Redis and disable all other services
    ## https://docs.gitlab.cn/omnibus/roles/
    roles ['redis_master_role']
    
    ## Redis configuration
    redis['bind'] = '0.0.0.0'
    redis['port'] = 6379
    redis['password'] = '<redis_password>'
    
    ## Disable automatic database migrations
    ## Only the primary GitLab application server should handle migrations
    gitlab_rails['auto_migrate'] = false
    
  4. 重新配置极狐GitLab 以使更改生效。
  5. 记录 Redis 节点的 IP 地址或主机名、端口和 Redis 密码。这些在配置极狐GitLab 应用服务器时是必要的。

支持高级配置选项,如有需要可以添加。

设置极狐GitLab Rails 应用实例

在安装极狐GitLab 的实例上:

  1. 编辑 /etc/gitlab/gitlab.rb 文件并添加以下内容:

    ## Disable Redis
    redis['enable'] = false
    
    gitlab_rails['redis_host'] = 'redis.example.com'
    gitlab_rails['redis_port'] = 6379
    
    ## Required if Redis authentication is configured on the Redis node
    gitlab_rails['redis_password'] = '<redis_password>'
    
  2. 将更改保存到 /etc/gitlab/gitlab.rb

  3. 重新配置极狐GitLab 以使更改生效。

故障排除

请参阅 Redis 故障排除指南