Help us learn about your current experience with the documentation. Take the survey.
使用 Linux 包部署独立 Redis 服务器
- Tier: Free, Premium, Ultimate
- Offering: GitLab Self-Managed
可以使用 Linux 包来配置一个独立的 Redis 服务器。 在此配置下,Redis 不会进行扩容,因此存在单点故障的风险。 然而,在扩容环境中,目标是让系统能够支持更多用户或提高吞吐量。 Redis 本身通常非常稳定,能够处理大量请求,因此只部署单个实例是一种可以接受的权衡。 关于 GitLab 扩容选项的概览,请参阅参考架构页面。
设置独立的 Redis 实例
以下步骤是使用 Linux 包配置 Redis 服务器所需的最基本操作:
-
通过 SSH 登录到 Redis 服务器。
-
使用 GitLab 下载页面上的步骤 1 和 2来下载并安装您所需的 Linux 包。请勿完成下载页面上的任何其他步骤。
-
编辑
/etc/gitlab/gitlab.rb文件并添加以下内容:## Enable Redis and disable all other services ## https://docs.gitlab.com/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 -
重新配置 GitLab以使更改生效。
-
记下 Redis 节点的 IP 地址或主机名、端口和 Redis 密码。在配置 GitLab 应用服务器时,这些信息是必需的。
如果需要,可以添加并支持高级配置选项。
设置 GitLab Rails 应用实例
在安装了 GitLab 的实例上:
-
编辑
/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>' -
保存对
/etc/gitlab/gitlab.rb文件的更改。 -
重新配置 GitLab以使更改生效。
故障排查
请参阅 Redis 故障排查指南。