# Gitaly Cluster
> 原文:[https://docs.gitlab.com/ee/administration/gitaly/praefect.html](https://docs.gitlab.com/ee/administration/gitaly/praefect.html)
* [Requirements for configuring a Gitaly Cluster](#requirements-for-configuring-a-gitaly-cluster)
* [Setup Instructions](#setup-instructions)
* [Preparation](#preparation)
* [Secrets](#secrets)
* [PostgreSQL](#postgresql)
* [Praefect](#praefect)
* [Enabling TLS support](#enabling-tls-support)
* [Gitaly](#gitaly)
* [Load Balancer](#load-balancer)
* [GitLab](#gitlab)
* [Grafana](#grafana)
* [Distributed reads](#distributed-reads)
* [Automatic failover and leader election](#automatic-failover-and-leader-election)
* [Primary Node Failure](#primary-node-failure)
* [Checking for data loss](#checking-for-data-loss)
* [Checking repository checksums](#checking-repository-checksums)
* [Recovering lost writes](#recovering-lost-writes)
* [Enabling Writes](#enabling-writes)
* [Backend Node Recovery](#backend-node-recovery)
* [Migrating existing repositories to Praefect](#migrating-existing-repositories-to-praefect)
* [Debugging Praefect](#debugging-praefect)
# Gitaly Cluster[](#gitaly-cluster "Permalink")
[Gitaly](index.html) (為 Git 存儲庫提供存儲的服務)可以在群集配置中運行,以提高容錯能力. 在這種配置中,每個 Git 存儲庫都存儲在集群中的每個 Gitaly 節點上. 可以配置多個集群(或分片).
**注意:**可以使用[GitLab Core](https://about.gitlab.com/pricing/#self-managed)和更高層來創建 Gitaly 群集. 但是,技術支持僅限于 GitLab Premium 和 Ultimate 客戶. 在 GitLab.com 中不可用.
Praefect 是 Gitaly 的路由器和事務管理器,并且是運行 Gitaly 集群的必需組件.
[](img/praefect_architecture_v12_10.png)
使用 Gitaly 群集可通過以下方式提高容錯能力:
* 復制寫操作以預熱備用 Gitaly 節點.
* 檢測 Gitaly 節點故障.
* 自動將 Git 請求路由到可用的 Gitaly 節點.
Gitaly 群集的可用性目標是:
* **恢復點目標(RPO):**不到 1 分鐘.
寫入異步復制. 尚未復制到新提升的主數據庫的所有寫入都將丟失.
計劃實現[高度一致性,](https://gitlab.com/groups/gitlab-org/-/epics/1189)以將其改進為"無損失".
* **恢復時間目標(RTO):**少于 10 秒.
每秒通過每個 Praefect 節點運行的運行狀況檢查來檢測中斷. 故障轉移要求每個 Praefect 節點上連續十次失敗的運行狀況檢查.
計劃進行[更快的中斷檢測](https://gitlab.com/gitlab-org/gitaly/-/issues/2608) ,以將其[縮短](https://gitlab.com/gitlab-org/gitaly/-/issues/2608)到不到 1 秒.
當前版本支持:
* 輔助副本的最終一致性.
* Automatic failover from the primary to the secondary.
* 如果復制隊列不為空,則報告可能的數據丟失.
* 僅當檢測到可能的數據丟失時,才將新升級的主要讀標記為標記.
遵循[HA Gitaly 史詩](https://gitlab.com/groups/gitlab-org/-/epics/1489)進行的改進,包括[橫向分發讀取](https://gitlab.com/groups/gitlab-org/-/epics/2013) .
## Requirements for configuring a Gitaly Cluster[](#requirements-for-configuring-a-gitaly-cluster "Permalink")
建議的 Gitaly 群集最低配置要求:
* 1 個負載均衡器
* 1 個 PostgreSQL 服務器(PostgreSQL 11 或更高版本)
* 節點長官 3
* 3 個 Gitaly 節點(1 個主要節點,2 個輔助節點)
有關實現的詳細信息,請參見[設計文檔](https://gitlab.com/gitlab-org/gitaly/-/blob/master/doc/design_ha.md) .
## Setup Instructions[](#setup-instructions "Permalink")
如果使用 Omnibus 軟件包[安裝了](https://about.gitlab.com/install/) GitLab(強烈建議),請按照以下步驟操作:
1. [Preparation](#preparation)
2. [Configuring the Praefect database](#postgresql)
3. [Configuring the Praefect proxy/router](#praefect)
4. [配置每個 Gitaly 節點](#gitaly) ( [每個 Gitaly 節點](#gitaly)一次)
5. [Configure the load balancer](#load-balancer)
6. [Updating the GitLab server configuration](#gitlab)
7. [Configure Grafana](#grafana)
### Preparation[](#preparation "Permalink")
在開始之前,您應該已經有一個正常的 GitLab 實例. [了解如何安裝 GitLab](https://about.gitlab.com/install/) .
設置 PostgreSQL 服務器(PostgreSQL 11 或更高版本). 尚不支持通過 Omnibus GitLab 發行版進行配置. 請關注此[問題](https://gitlab.com/gitlab-org/gitaly/-/issues/2476)以進行更新.
通過[安裝 GitLab](https://about.gitlab.com/install/)準備所有新節點.
* 1 個 Praefect 節點(需要最少的存儲)
* 3 個 Gitaly 節點(高 CPU,高內存,快速存儲)
* 1 個 GitLab 服務器
您將需要每個節點的 IP /主機地址.
1. `LOAD_BALANCER_SERVER_ADDRESS` :負載均衡器的 IP /主機地址
2. `POSTGRESQL_SERVER_ADDRESS` :PostgreSQL 服務器的 IP /主機地址
3. `PRAEFECT_HOST` :Praefect 服務器的 IP /主機地址
4. `GITALY_HOST` :每個 Gitaly 服務器的 IP /主機地址
5. `GITLAB_HOST` :GitLab 服務器的 IP /主機地址
如果使用的是云提供商,則可以通過云提供商的管理控制臺查找每個服務器的地址.
如果您使用的是 Google Cloud Platform,SoftLayer 或提供虛擬私有云(VPC)的任何其他供應商,則可以將每個云實例的私有地址(對應于 Google Cloud Platform 的"內部地址")用于`PRAEFECT_HOST` , `GITALY_HOST` ,和`GITLAB_HOST` .
#### Secrets[](#secrets "Permalink")
組件之間的通信由不同的秘密保護,下面將對此進行描述. 在開始之前,請為每個密鑰生成一個唯一的秘密,并記錄下來. 在完成設置過程時,這將很容易用安全令牌替換這些占位符令牌.
1. `GITLAB_SHELL_SECRET_TOKEN` :當接受 Git 推送時,Git 掛鉤將其用于向 GitLab 發出回調 HTTP API 請求. 出于遺留原因,此秘密已與 GitLab Shell 共享.
2. `PRAEFECT_EXTERNAL_TOKEN` :承載此令牌的 Gitaly 客戶端只能訪問 Praefect 群集上托管的存儲庫.
3. `PRAEFECT_INTERNAL_TOKEN` :此令牌用于 Praefect 群集內的復制流量. 這與`PRAEFECT_EXTERNAL_TOKEN`不同,因為 Gitaly 客戶端必須不能直接訪問 Praefect 群集的內部節點. 可能導致數據丟失.
4. `PRAEFECT_SQL_PASSWORD` :Praefect 使用此密碼連接到 PostgreSQL.
我們將在以下說明中指出需要這些秘密的地方.
### PostgreSQL[](#postgresql "Permalink")
**注意:**如果使用[Geo,](../geo/replication/index.html)請勿將 GitLab 應用程序數據庫和 Praefect 數據庫存儲在同一 PostgreSQL 服務器上. 復制狀態是每個 GitLab 實例的內部狀態,不應復制.
要完成本節,您將需要:
* 完美節點 1
* 1 個 PostgreSQL 服務器(PostgreSQL 11 或更高版本)
* 具有創建數據庫權限的 SQL 用戶
在本節中,我們將使用 Omnibus GitLab 安裝的`psql`從 Praefect 節點配置 PostgreSQL 服務器.
1. SSH 進入**Praefect**節點并以 root 用戶身份登錄:
```
sudo -i
```
2. 以管理員權限連接到 PostgreSQL 服務器. 這可能是`postgres`用戶. 使用數據庫`template1`是因為它默認在所有 PostgreSQL 服務器上創建.
```
/opt/gitlab/embedded/bin/psql -U postgres -d template1 -h POSTGRESQL_SERVER_ADDRESS
```
創建一個將由 Praefect 使用的新用戶`praefect` . 將`PRAEFECT_SQL_PASSWORD`替換為您在準備步驟中生成的強密碼.
```
CREATE ROLE praefect WITH LOGIN CREATEDB PASSWORD 'PRAEFECT_SQL_PASSWORD';
```
3. 這次以`praefect`用戶身份重新連接到 PostgreSQL 服務器:
```
/opt/gitlab/embedded/bin/psql -U praefect -d template1 -h POSTGRESQL_SERVER_ADDRESS
```
創建一個新的數據庫`praefect_production` . 通過同時連接為創建數據庫`praefect`的用戶,我們有信心,他們有機會.
```
CREATE DATABASE praefect_production WITH ENCODING=UTF8;
```
現在已配置 Praefect 使用的數據庫.
### Praefect[](#praefect "Permalink")
要完成本節,您將需要:
* [配置的 PostgreSQL 服務器](#postgresql) ,包括:
* IP /主機地址( `POSTGRESQL_SERVER_ADDRESS` )
* 密碼( `PRAEFECT_SQL_PASSWORD` )
Praefect 應該在專用節點上運行. 不要在應用程序服務器或 Gitaly 節點上運行 Praefect.
1. SSH 進入**Praefect**節點并以 root 用戶身份登錄:
```
sudo -i
```
2. 通過編輯`/etc/gitlab/gitlab.rb`禁用所有其他服務:
```
# Disable all other services on the Praefect node
postgresql['enable'] = false
redis['enable'] = false
nginx['enable'] = false
prometheus['enable'] = false
grafana['enable'] = false
puma['enable'] = false
sidekiq['enable'] = false
gitlab_workhorse['enable'] = false
gitaly['enable'] = false
# Enable only the Praefect service
praefect['enable'] = true
# Prevent database connections during 'gitlab-ctl reconfigure'
gitlab_rails['rake_cache_clear'] = false
gitlab_rails['auto_migrate'] = false
```
3. 通過編輯`/etc/gitlab/gitlab.rb` **Praefect**配置為偵聽網絡接口:
```
praefect['listen_addr'] = '0.0.0.0:2305'
# Enable Prometheus metrics access to Praefect. You must use firewalls
# to restrict access to this address/port.
praefect['prometheus_listen_addr'] = '0.0.0.0:9652'
```
4. 配置強勁`auth_token`通過編輯**提督** `/etc/gitlab/gitlab.rb` . 群集外部的客戶端(如 GitLab Shell)將需要與 Praefect 群集進行通信:
```
praefect['auth_token'] = 'PRAEFECT_EXTERNAL_TOKEN'
```
5. 通過編輯`/etc/gitlab/gitlab.rb`將**Praefect**配置為連接到 PostgreSQL 數據庫.
您將需要用數據庫的 IP /主機地址替換`POSTGRESQL_SERVER_ADDRESS` ,并用上面設置的強密碼`PRAEFECT_SQL_PASSWORD` .
```
praefect['database_host'] = 'POSTGRESQL_SERVER_ADDRESS'
praefect['database_port'] = 5432
praefect['database_user'] = 'praefect'
praefect['database_password'] = 'PRAEFECT_SQL_PASSWORD'
praefect['database_dbname'] = 'praefect_production'
```
如果要使用 TLS 客戶端證書,則可以使用以下選項:
```
# Connect to PostreSQL using a TLS client certificate
# praefect['database_sslcert'] = '/path/to/client-cert'
# praefect['database_sslkey'] = '/path/to/client-key'
# Trust a custom certificate authority
# praefect['database_sslrootcert'] = '/path/to/rootcert'
```
默認情況下,Praefect 將拒絕與 PostgreSQL 建立未加密的連接. 您可以通過取消注釋以下行來覆蓋它:
```
# praefect['database_sslmode'] = 'disable'
```
6. 通過編輯`/etc/gitlab/gitlab.rb`將**Praefect**群集配置為連接到群集中的每個 Gitaly 節點.
虛擬存儲的名稱必須與 GitLab 配置中配置的存儲名稱匹配. 在隨后的步驟中,我們將存儲名稱配置為`default`名稱,因此我們也在此處使用`default`名稱. 該集群具有三個 Gitaly 節點`gitaly-1` , `gitaly-2`和`gitaly-3` ,它們將是彼此的副本.
**注意:**如果您已經在名為`default`現有存儲上存儲了數據,則應使用其他名稱配置虛擬存儲,然后[將數據遷移到 Praefect 存儲](#migrating-existing-repositories-to-praefect) .
將`PRAEFECT_INTERNAL_TOKEN`替換為一個強秘密,Praefect 將在與集群中的 Gitaly 節點通信時使用此秘密. 此令牌與`PRAEFECT_EXTERNAL_TOKEN` .
將`GITALY_HOST`替換為每個 Gitaly 節點的 IP /主機地址.
可以將更多 Gitaly 節點添加到群集以增加副本數. 還可以為大型 GitLab 實例添加更多集群.
**注意:** `gitaly-1`節點當前稱為主要節點. 這可用于從一個節點到另一個節點的手動故障. 這將在被刪除[的未來](https://gitlab.com/gitlab-org/gitaly/-/issues/2634) .
```
# Name of storage hash must match storage name in git_data_dirs on GitLab
# server ('praefect') and in git_data_dirs on Gitaly nodes ('gitaly-1')
praefect['virtual_storages'] = {
'default' => {
'gitaly-1' => {
'address' => 'tcp://GITALY_HOST:8075',
'token' => 'PRAEFECT_INTERNAL_TOKEN',
'primary' => true
},
'gitaly-2' => {
'address' => 'tcp://GITALY_HOST:8075',
'token' => 'PRAEFECT_INTERNAL_TOKEN'
},
'gitaly-3' => {
'address' => 'tcp://GITALY_HOST:8075',
'token' => 'PRAEFECT_INTERNAL_TOKEN'
}
}
}
```
7. 在 GitLab 13.1 和更高版本中[引入](https://gitlab.com/groups/gitlab-org/-/epics/2013) ,啟用了 read 的[分發](#distributed-reads) .
8. 將更改保存到`/etc/gitlab/gitlab.rb`并[重新配置 Praefect](../restart_gitlab.html#omnibus-gitlab-reconfigure) :
```
gitlab-ctl reconfigure
```
9. 為了確保 Praefect [已更新其 Prometheus 監聽地址](https://gitlab.com/gitlab-org/gitaly/-/issues/2734) ,請[重新啟動 Gitaly](../restart_gitlab.html#omnibus-gitlab-restart) :
```
gitlab-ctl restart praefect
```
10. 驗證 Praefect 可以到達 PostgreSQL:
```
sudo -u git /opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml sql-ping
```
如果檢查失敗,請確保已正確執行了步驟. 如果您編輯`/etc/gitlab/gitlab.rb` ,請記住在嘗試`sql-ping`命令之前再次運行`sudo gitlab-ctl reconfigure` .
**必須為每個 Praefect 節點完成上述步驟!**
## Enabling TLS support[](#enabling-tls-support "Permalink")
在 GitLab 13.2 中[引入](https://gitlab.com/gitlab-org/gitaly/-/issues/1698) .
Praefect 支持 TLS 加密. 要與偵聽安全連接的 Praefect 實例進行通信,您必須:
* 在 GitLab 配置中相應存儲條目的`gitaly_address`中使用`tls://` URL 方案.
* 帶上您自己的證書,因為這不會自動提供. 與每個 Praefect 服務器相對應的證書必須安裝在該 Praefect 服務器上.
此外,必須按照[GitLab 自定義證書配置中](https://docs.gitlab.com/omnibus/settings/ssl.html)所述的過程(并在下面重復),將證書或其證書頒發機構安裝在所有 Gitaly 服務器和與其通信的所有 Praefect 客戶端上.
請注意以下幾點:
* 證書必須指定用于訪問 Praefect 服務器的地址. 如果通過以下方式尋址 Praefect 服務器:
* 主機名,您可以為此使用"公用名"字段,也可以將其添加為"使用者備用名".
* IP 地址,您必須將其添加為證書的使用者備用名稱.
* 您可以同時為 Praefect 服務器配置未加密的偵聽地址`listen_addr`和已加密的偵聽地址`tls_listen_addr` . 如果需要,這使您可以從未加密的流量逐漸過渡到加密的流量.
要使用 TLS 配置 Praefect:
**對于所有 GitLab**
1. Prefect 為服務器創建證書.
2. 在 Praefect 服務器上,創建`/etc/gitlab/ssl`目錄,然后在其中復制密鑰和證書:
```
sudo mkdir -p /etc/gitlab/ssl
sudo chmod 755 /etc/gitlab/ssl
sudo cp key.pem cert.pem /etc/gitlab/ssl/
sudo chmod 644 key.pem cert.pem
```
3. 編輯`/etc/gitlab/gitlab.rb`并添加:
```
praefect['tls_listen_addr'] = "0.0.0.0:3305"
praefect['certificate_path'] = "/etc/gitlab/ssl/cert.pem"
praefect['key_path'] = "/etc/gitlab/ssl/key.pem"
```
4. 保存文件并[重新配置 GitLab](../restart_gitlab.html#omnibus-gitlab-reconfigure) .
5. 在 Praefect 客戶端(包括每個 Gitaly 服務器)上,將證書或其證書頒發機構復制到`/etc/gitlab/trusted-certs` :
```
sudo cp cert.pem /etc/gitlab/trusted-certs/
```
6. 在 Praefect 客戶端(Gitaly 服務器除外)上,在`/etc/gitlab/gitlab.rb`編輯`git_data_dirs` ,如下所示:
```
git_data_dirs({
'default' => { 'gitaly_address' => 'tls://praefect1.internal:3305' },
'storage1' => { 'gitaly_address' => 'tls://praefect2.internal:3305' },
})
```
7. 保存文件并[重新配置 GitLab](../restart_gitlab.html#omnibus-gitlab-reconfigure) .
**對于源安裝**
1. Prefect 為服務器創建證書.
2. 在 Praefect 服務器上,創建`/etc/gitlab/ssl`目錄,然后在其中復制密鑰和證書:
```
sudo mkdir -p /etc/gitlab/ssl
sudo chmod 755 /etc/gitlab/ssl
sudo cp key.pem cert.pem /etc/gitlab/ssl/
sudo chmod 644 key.pem cert.pem
```
3. 在 Praefect 客戶端(包括每個 Gitaly 服務器)上,將證書或其證書頒發機構復制到系統信任的證書中:
```
sudo cp cert.pem /usr/local/share/ca-certificates/praefect.crt
sudo update-ca-certificates
```
4. 在 Praefect 客戶端(Gitaly 服務器除外)上,按如下所示編輯`/home/git/gitlab/config/gitlab.yml` `storages` :
```
gitlab:
repositories:
storages:
default:
gitaly_address: tls://praefect1.internal:3305
path: /some/dummy/path
storage1:
gitaly_address: tls://praefect2.internal:3305
path: /some/dummy/path
```
**注意:** `/some/dummy/path`應該設置為存在的本地文件夾,但是該文件夾中不會存儲任何數據. 解決[此問題](https://gitlab.com/gitlab-org/gitaly/-/issues/1282)后,將不再需要[此操作](https://gitlab.com/gitlab-org/gitaly/-/issues/1282) .
5. 保存文件并[重新啟動 GitLab](../restart_gitlab.html#installations-from-source) .
6. 將所有 Praefect 服務器證書或其證書頒發機構復制到每臺 Gitaly 服務器上的系統受信任證書,以便 Praefect 服務器在被 Gitaly 服務器調用時將信任該證書:
```
sudo cp cert.pem /usr/local/share/ca-certificates/praefect.crt
sudo update-ca-certificates
```
7. 編輯`/home/git/praefect/config.toml`并添加:
```
tls_listen_addr = '0.0.0.0:3305'
[tls]
certificate_path = '/etc/gitlab/ssl/cert.pem'
key_path = '/etc/gitlab/ssl/key.pem'
```
8. 保存文件并[重新啟動 GitLab](../restart_gitlab.html#installations-from-source) .
### Gitaly[](#gitaly "Permalink")
**注意:**為**每個** Gitaly 節點完成這些步驟.
要完成本節,您將需要:
* [Configured Praefect node](#praefect)
* 將 3 個(或更多)安裝了 GitLab 的服務器配置為 Gitaly 節點. 這些應該是專用節點,不要在這些節點上運行其他服務.
分配給 Praefect 群集的每個 Gitaly 服務器都需要配置. 該配置與普通的[獨立 Gitaly 服務器相同](index.html) ,除了:
* 存儲名稱公開給 Praefect,而不是 GitLab
* 秘密令牌是與 Praefect 共享的,而不是與 GitLab 共享的
Praefect 群集中所有 Gitaly 節點的配置可以相同,因為我們依靠 Praefect 正確地路由操作.
應特別注意:
* 本節中配置的`gitaly['auth_token']`必須與 Praefect 節點上`praefect['virtual_storages']`下的`token`值匹配. 這是在上[一節中](#praefect)設置的. 本文檔始終使用占位符`PRAEFECT_INTERNAL_TOKEN` .
* 本節中配置的`git_data_dirs`中的存儲名稱必須與 Praefect 節點上`praefect['virtual_storages']`下的存儲名稱匹配. 這是在上[一節中](#praefect)設置的. 本文檔使用`gitaly-1` , `gitaly-2`和`gitaly-3`作為 Gitaly 存儲名稱.
有關 Gitaly 服務器配置的更多信息,請參閱我們的[Gitaly 文檔](index.html#configure-gitaly-servers) .
1. SSH 進入**Gitaly**節點并以 root 用戶身份登錄:
```
sudo -i
```
2. Disable all other services by editing `/etc/gitlab/gitlab.rb`:
```
# Disable all other services on the Praefect node
postgresql['enable'] = false
redis['enable'] = false
nginx['enable'] = false
grafana['enable'] = false
puma['enable'] = false
sidekiq['enable'] = false
gitlab_workhorse['enable'] = false
prometheus_monitoring['enable'] = false
# Enable only the Gitaly service
gitaly['enable'] = true
# Enable Prometheus if needed
prometheus['enable'] = true
# Prevent database connections during 'gitlab-ctl reconfigure'
gitlab_rails['rake_cache_clear'] = false
gitlab_rails['auto_migrate'] = false
```
3. 配置**Gitaly**通過編輯來聽網絡接口`/etc/gitlab/gitlab.rb` :
```
# Make Gitaly accept connections on all network interfaces.
# Use firewalls to restrict access to this address/port.
gitaly['listen_addr'] = '0.0.0.0:8075'
# Enable Prometheus metrics access to Gitaly. You must use firewalls
# to restrict access to this address/port.
gitaly['prometheus_listen_addr'] = '0.0.0.0:9236'
```
4. 配置強勁`auth_token`通過編輯**Gitaly** `/etc/gitlab/gitlab.rb` . 客戶端將需要與該 Gitaly 節點進行通信. 通常,此令牌對于所有 Gitaly 節點都是相同的.
```
gitaly['auth_token'] = 'PRAEFECT_INTERNAL_TOKEN'
```
5. 配置`git push`操作所需的 GitLab Shell `secret_token`和`internal_api_url` .
如果您已經[在自己的服務器上](index.html)配置了[Gitaly](index.html)
```
gitlab_shell['secret_token'] = 'GITLAB_SHELL_SECRET_TOKEN'
# Configure the gitlab-shell API callback URL. Without this, `git push` will
# fail. This can be your front door GitLab URL or an internal load balancer.
# Examples: 'https://example.gitlab.com', 'http://1.2.3.4'
gitlab_rails['internal_api_url'] = 'http://GITLAB_HOST'
```
6. 通過在`/etc/gitlab/gitlab.rb`設置`git_data_dirs`來配置 Git 數據的存儲位置. 每個 Gitaly 節點應具有唯一的存儲名稱(例如`gitaly-1` ).
與其為每個 Gitaly 節點唯一地配置`git_data_dirs`將每個 Gitaly 節點上所有 Gitaly 節點的配置都包括在內通常會更容易. 由于 Praefect `virtual_storages`配置將每個存儲名稱(例如`gitaly-1` )映射到特定節點,并且相應地路由了請求,因此支持此操作. 這意味著艦隊中的每個 Gitaly 節點都可以共享相同的配置.
```
# You can include the data dirs for all nodes in the same config, because
# Praefect will only route requests according to the addresses provided in the
# prior step.
git_data_dirs({
"gitaly-1" => {
"path" => "/var/opt/gitlab/git-data"
},
"gitaly-2" => {
"path" => "/var/opt/gitlab/git-data"
},
"gitaly-3" => {
"path" => "/var/opt/gitlab/git-data"
}
})
```
7. 將更改保存到`/etc/gitlab/gitlab.rb`并[重新配置 Gitaly](../restart_gitlab.html#omnibus-gitlab-reconfigure) :
```
gitlab-ctl reconfigure
```
8. 為了確保 Gitaly [更新了其 Prometheus 監聽地址](https://gitlab.com/gitlab-org/gitaly/-/issues/2734) ,請[重新啟動 Gitaly](../restart_gitlab.html#omnibus-gitlab-restart) :
```
gitlab-ctl restart gitaly
```
**必須對每個 Gitaly 節點完成上述步驟!**
配置完所有 Gitaly 節點后,您可以運行 Praefect 連接檢查器以驗證 Praefect 可以連接到 Praefect 配置中的所有 Gitaly 服務器.
1. SSH into the **Praefect** node and run the Praefect connection checker:
```
sudo /opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml dial-nodes
```
### Load Balancer[](#load-balancer "Permalink")
在高可用的 Gitaly 配置中,需要一個負載平衡器來將內部流量從 GitLab 應用程序路由到 Praefect 節點. 有關使用負載均衡器或進行確切配置的細節超出了 GitLab 文檔的范圍.
我們希望,如果您要管理像 GitLab 這樣的 HA 系統,那么您已經選擇了負載均衡器. 一些示例包括[HAProxy](https://www.haproxy.org/) (開源), [Google 內部負載均衡器](https://cloud.google.com/load-balancing/docs/internal/) , [AWS Elastic 負載均衡器](https://aws.amazon.com/elasticloadbalancing/) ,F5 Big-IP LTM 和 Citrix Net Scaler. 本文檔將概述您需要配置哪些端口和協議.
| LB 端口 | 后端端口 | Protocol |
| --- | --- | --- |
| 2305 | 2305 | TCP |
### GitLab[](#gitlab "Permalink")
要完成本節,您將需要:
* [Configured Praefect node](#praefect)
* [Configured Gitaly nodes](#gitaly)
Praefect 集群需要作為存儲位置公開給 GitLab 應用程序. 這是通過更新`git_data_dirs`完成的.
應特別注意:
* 本節中添加到`git_data_dirs`的存儲名稱必須與 Praefect 節點上`praefect['virtual_storages']`下的存儲名稱匹配. 這是在本指南的[Praefect](#praefect)部分中設置的. 本文檔使用`storage-1`作為 Praefect 存儲名稱.
1. SSH 進入**GitLab**節點并以 root 身份登錄:
```
sudo -i
```
2. 配置`external_url`以便可以通過編輯`/etc/gitlab/gitlab.rb`通過適當的端點訪問`/etc/gitlab/gitlab.rb` GitLab 提供文件:
您需要將`GITLAB_SERVER_URL`替換為當前 GitLab 實例所服務的實際外部 URL:
```
external_url 'GITLAB_SERVER_URL'
```
3. 禁用在 GitLab 主機上運行的默認 Gitaly 服務. 不需要它,因為 GitLab 將連接到配置的集群.
**注意**如果現有數據存儲在默認的 Gitaly 存儲中,則應首先[遷移 Praefect 存儲中的數據](#migrating-existing-repositories-to-praefect) .
```
gitaly['enable'] = false
```
4. 通過編輯`/etc/gitlab/gitlab.rb`將 Praefect 集群添加為存儲位置.
您將需要更換:
* 帶有負載均衡器的 IP 地址或主機名的`LOAD_BALANCER_SERVER_ADDRESS` .
* `PRAEFECT_EXTERNAL_TOKEN`帶有真正的秘密
```
git_data_dirs({
"default" => {
"gitaly_address" => "tcp://LOAD_BALANCER_SERVER_ADDRESS:2305",
"gitaly_token" => 'PRAEFECT_EXTERNAL_TOKEN'
}
})
```
5. 配置`gitlab_shell['secret_token']`以便通過編輯`/etc/gitlab/gitlab.rb`正確驗證`git push`期間來自 Gitaly 節點的回調:
您將需要用真實的機密替換`GITLAB_SHELL_SECRET_TOKEN` .
```
gitlab_shell['secret_token'] = 'GITLAB_SHELL_SECRET_TOKEN'
```
6. 通過編輯`/etc/gitlab/gitlab.rb`添加 Prometheus 監視設置.
您將需要更換:
* `PRAEFECT_HOST`帶有 Praefect 節點的 IP 地址或主機名
* `GITALY_HOST` ,每個 Gitaly 節點的 IP 地址或主機名
```
prometheus['scrape_configs'] = [
{
'job_name' => 'praefect',
'static_configs' => [
'targets' => [
'PRAEFECT_HOST:9652', # praefect-1
'PRAEFECT_HOST:9652', # praefect-2
'PRAEFECT_HOST:9652', # praefect-3
]
]
},
{
'job_name' => 'praefect-gitaly',
'static_configs' => [
'targets' => [
'GITALY_HOST:9236', # gitaly-1
'GITALY_HOST:9236', # gitaly-2
'GITALY_HOST:9236', # gitaly-3
]
]
}
]
```
7. 將更改保存到`/etc/gitlab/gitlab.rb`并[重新配置 GitLab](../restart_gitlab.html#omnibus-gitlab-reconfigure) :
```
gitlab-ctl reconfigure
```
8. 驗證每個`gitlab-shell`實例上的每個`gitlab-shell`都可以到達 GitLab. 在每個 Gitaly 實例上運行:
```
/opt/gitlab/embedded/service/gitlab-shell/bin/check -config /opt/gitlab/embedded/service/gitlab-shell/config.yml
```
9. 驗證 GitLab 是否可以達到 Praefect:
```
gitlab-rake gitlab:gitaly:check
```
10. 在**管理區域>設置>存儲庫>存儲庫**中檢查 Praefect 存儲已配置為存儲新存儲庫. 按照本指南, `default`存儲應具有權重 100 以存儲所有新存儲庫.
11. 通過創建一個新項目來驗證一切正常. 選中"使用自述文件初始化存儲庫"框,以使存儲庫中包含已查看的內容. 如果項目已創建,并且您可以看到 README 文件,那么它將起作用!
### Grafana[](#grafana "Permalink")
Grafana 包含在 GitLab 中,可用于監視您的 Praefect 集群. 有關詳細文檔,請參見[Grafana 儀表板服務](https://docs.gitlab.com/omnibus/settings/grafana.html) .
快速入門:
1. SSH into the **GitLab** node and login as root:
```
sudo -i
```
2. 通過編輯`/etc/gitlab/gitlab.rb`啟用 Grafana 登錄表單.
```
grafana['disable_login_form'] = false
```
3. 將更改保存到`/etc/gitlab/gitlab.rb`并[重新配置 GitLab](../restart_gitlab.html#omnibus-gitlab-reconfigure) :
```
gitlab-ctl reconfigure
```
4. 設置 Grafana 管理員密碼. 此命令將提示您輸入新密碼:
```
gitlab-ctl set-grafana-password
```
5. 在您的 Web 瀏覽器中,在您的 GitLab 服務器上打開`/-/grafana` (例如`https://gitlab.example.com/-/grafana` ).
使用您設置的密碼和用戶名`admin`登錄.
6. 轉到**瀏覽**并查詢`gitlab_build_info`以驗證您是否正在從所有計算機中獲取指標.
恭喜你! 您已經配置了可觀察的高可用性 Praefect 集群.
## Distributed reads[](#distributed-reads "Permalink")
在[beta 版本的](https://about.gitlab.com/handbook/product/#alpha-beta-ga) GitLab 13.1 中引入,功能標志`gitaly_distributed_reads`設置為禁用.
Praefect supports distribution of read operations across Gitaly nodes that are configured for the virtual node.
為了進行[性能測試](https://gitlab.com/gitlab-org/quality/performance/-/issues/231) ,分布式讀取當前處于[beta 狀態](https://about.gitlab.com/handbook/product/#alpha-beta-ga) ,默認情況下處于禁用狀態. 要啟用分布式讀取,必須在 Ruby 控制臺中啟用`gitaly_distributed_reads` [功能標志](../feature_flags.html) :
```
Feature.enable(:gitaly_distributed_reads)
```
如果啟用,則所有帶有`ACCESSOR`選項(如[GetBlob)的](https://gitlab.com/gitlab-org/gitaly/-/blob/v12.10.6/proto/blob.proto#L16) RPC 都將重定向到最新且運行狀況良好的 Gitaly 節點.
在這種情況下*,最新*意味著:
* 沒有為此節點安排任何復制操作.
* 最后的復制操作處于*完成*狀態.
如果沒有這樣的節點,或者在選擇節點期間發生任何其他錯誤,那么將選擇主節點來處理請求.
要跟蹤讀取操作的分布,可以使用`gitaly_praefect_read_distribution` Prometheus 計數器度量. 它有兩個標簽:
* `virtual_storage`.
* `storage`.
它們反映了為此 Praefect 實例定義的配置.
## Automatic failover and leader election[](#automatic-failover-and-leader-election "Permalink")
Praefect 會定期檢查每個后端 Gitaly 節點的運行狀況. 如果發現當前主節點運行狀況不佳,此信息可用于自動故障轉移到新的主節點.
* **PostgreSQL(推薦):**默認啟用,等效于: `praefect['failover_election_strategy'] = sql` . 此配置選項將允許多個 Praefect 節點通過 PostgreSQL 數據庫進行協調,以選擇一個主要的 Gitaly 節點. 如果大多數 Praefect 節點在 10 秒內仍無法訪問當前主節點,此配置將導致 Praefect 節點選擇一個新的主節點,監視其運行狀況,并選擇一個新的主節點.
* **手動:**禁用自動故障轉移. 可以在 Praefect 節點上的`/etc/gitlab/gitlab.rb`重新配置主節點. 通過將`primary = true`移至另一個 Gitaly 節點,將其修改為`praefect['virtual_storages']`字段. 在上述步驟中,將`gitaly-1`設置為主數據庫. 在配置中需要`praefect['failover_enabled'] = false` .
* **內存:**通過在 Praefect 節點上的`/etc/gitlab/gitlab.rb`設置`praefect['failover_election_strategy'] = 'local'` `/etc/gitlab/gitlab.rb` . 如果對于當前的主后端 Gitaly 節點,足夠數量的運行狀況檢查失敗,則將選擇新的主節點. **不要與多個 Praefect 節點一起使用!** 與多個 Praefect 節點一起使用可能會導致大腦分裂.
將來我們可能會實施對 Consul 的支持以及云原生策略.
## Primary Node Failure[](#primary-node-failure "Permalink")
Praefect 通過將健康的輔助節點升級為新的主節點來從發生故障的主 Gitaly 節點中恢復. 為了最大程度地減少數據丟失,Praefect 會選擇從主節點進行最少重復寫入的輔助節點. 仍然會有一些未復制的寫入,從而導致數據丟失.
故障轉移事件發生后,Praefect 會將虛擬存儲切換為只讀模式. 通過防止對新選舉的主數據庫進行新的可能沖突的寫入,這可以簡化數據恢復工作. 這使管理員可以嘗試在允許新寫入之前恢復丟失的數據.
如果您更喜歡寫可用性而不是一致性,則可以通過在`/etc/gitlab/gitlab.rb`設置`praefect['failover_read_only_after_failover'] = false`并[重新配置 Praefect](../restart_gitlab.html#omnibus-gitlab-reconfigure)來關閉此行為.
### Checking for data loss[](#checking-for-data-loss "Permalink")
Praefect `dataloss`子命令可通過檢查未完成的復制作業來幫助識別丟失的寫操作. 這對于確定故障轉移后可能的數據丟失情況很有用. 此命令必須在 Praefect 節點上執行.
```
sudo /opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml dataloss [-virtual-storage <virtual-storage>]
```
如果未指定虛擬存儲,則將檢查每個已配置的虛擬存儲的數據丟失.
```
sudo /opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml dataloss
```
```
Virtual storage: default
Current read-only primary: gitaly-2
Previous write-enabled primary: gitaly-1
Nodes with data loss from failing over from gitaly-1:
@hashed/2c/62/2c624232cdd221771294dfbb310aca000a0df6ac8b66b696d90ef06fdefb64a3.git: gitaly-0
@hashed/4b/22/4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a.git: gitaly-0, gitaly-2
```
當前,如果已直接從先前啟用寫操作的主數據庫復制到該`dataloss`僅考慮該存儲庫為最新. 雖然從最新的輔助數據庫進行協調可以恢復數據,但在數據丟失報告中不可見. 這是通過[Gitaly#2866](https://gitlab.com/gitlab-org/gitaly/-/issues/2866)進行的改進.
**注意數據** `dataloss`仍處于 beta 狀態,并且輸出格式可能會更改.
### Checking repository checksums[](#checking-repository-checksums "Permalink")
要在所有 Gitaly 節點上檢查項目的存儲庫校驗和,請在主 GitLab 節點上運行[副本 Rake 任務](../raketasks/praefect.html#replica-checksums) .
### Recovering lost writes[](#recovering-lost-writes "Permalink")
Praefect `reconcile`子命令可用于恢復先前的主數據庫恢復聯機后丟失的寫入. 僅當虛擬存儲仍處于只讀模式時才有可能.
```
sudo /opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml reconcile -virtual <virtual-storage> -reference <previous-primary> -target <current-primary> -f
```
有關`reconcile`子命令的更多詳細信息,請參閱" [后端節點恢復"](#backend-node-recovery)部分.
### Enabling Writes[](#enabling-writes "Permalink")
在啟用寫入之前,應該進行任何數據恢復嘗試,以消除沖突寫入的任何可能性. 可以使用 Praefect `enable-writes`子命令為寫入重新啟用虛擬存儲.
```
sudo /opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml enable-writes -virtual-storage <virtual-storage>
```
## Backend Node Recovery[](#backend-node-recovery "Permalink")
當 Praefect 后端節點發生故障并且不再能夠復制更改時,后端節點將開始從主節點開始漂移. 如果該節點最終恢復,則需要將其與當前主節點協調. 主節點被視為分片狀態的唯一真實來源. Praefect `reconcile`子命令允許在后端節點和當前主節點之間進行手動協調.
Run the following command on the Praefect server after all placeholders (`<virtual-storage>` and `<target-storage>`) have been replaced:
```
sudo /opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml reconcile -virtual <virtual-storage> -target <target-storage>
```
* 將占位符`<virtual-storage>`替換為包含要檢查的后端節點存儲的虛擬存儲.
* 將占位符`<target-storage>`替換為后端存儲名稱.
該命令將返回與當前主數據庫不一致的存儲庫列表. 這些不一致性中的每一個還將與隨附的復制作業 ID 一起記錄.
## Migrating existing repositories to Praefect[](#migrating-existing-repositories-to-praefect "Permalink")
如果您的 GitLab 實例已經有存儲庫,則不會自動遷移它們.
可以使用[Repository API](../../api/projects.html#edit-project)從一個存儲位置移動存儲[庫](../../api/projects.html#edit-project) :
```
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" --data "repository_storage=praefect" https://example.gitlab.com/api/v4/projects/123
```
## Debugging Praefect[](#debugging-praefect "Permalink")
如果收到錯誤,請檢查`/var/log/gitlab/gitlab-rails/production.log` .
以下是常見的錯誤和潛在原因:
* 500 響應碼
* **ActionView :: Template :: Error(7:權限被拒絕)**
* `praefect['auth_token']`和`gitlab_rails['gitaly_token']`在 GitLab 服務器上不匹配.
* **無法保存項目.** **錯誤:7:權限被拒絕**
* GitLab 服務器上的`praefect['storage_nodes']`秘密令牌與一臺或多臺 Gitaly 服務器上的`gitaly['auth_token']`中的值不匹配.
* 503 響應碼
* **GRPC ::不可用(14:無法連接到所有地址)**
* GitLab 無法到達 Praefect.
* **GRPC ::不可用(14:所有 SubCon 都在 TransientFailure 中...)**
* Praefect 無法到達其一個或多個子 Gitaly 節點. 嘗試運行 Praefect 連接檢查器進行診斷.
- GitLab Docs
- Installation
- Requirements
- GitLab cloud native Helm Chart
- Install GitLab with Docker
- Installation from source
- Install GitLab on Microsoft Azure
- Installing GitLab on Google Cloud Platform
- Installing GitLab on Amazon Web Services (AWS)
- Analytics
- Code Review Analytics
- Productivity Analytics
- Value Stream Analytics
- Kubernetes clusters
- Adding and removing Kubernetes clusters
- Adding EKS clusters
- Adding GKE clusters
- Group-level Kubernetes clusters
- Instance-level Kubernetes clusters
- Canary Deployments
- Cluster Environments
- Deploy Boards
- GitLab Managed Apps
- Crossplane configuration
- Cluster management project (alpha)
- Kubernetes Logs
- Runbooks
- Serverless
- Deploying AWS Lambda function using GitLab CI/CD
- Securing your deployed applications
- Groups
- Contribution Analytics
- Custom group-level project templates
- Epics
- Manage epics
- Group Import/Export
- Insights
- Issues Analytics
- Iterations
- Public access
- SAML SSO for GitLab.com groups
- SCIM provisioning using SAML SSO for GitLab.com groups
- Subgroups
- Roadmap
- Projects
- GitLab Secure
- Security Configuration
- Container Scanning
- Dependency Scanning
- Dependency List
- Static Application Security Testing (SAST)
- Secret Detection
- Dynamic Application Security Testing (DAST)
- GitLab Security Dashboard
- Offline environments
- Standalone Vulnerability pages
- Security scanner integration
- Badges
- Bulk editing issues and merge requests at the project level
- Code Owners
- Compliance
- License Compliance
- Compliance Dashboard
- Create a project
- Description templates
- Deploy Keys
- Deploy Tokens
- File finder
- Project integrations
- Integrations
- Atlassian Bamboo CI Service
- Bugzilla Service
- Custom Issue Tracker service
- Discord Notifications service
- Enabling emails on push
- GitHub project integration
- Hangouts Chat service
- Atlassian HipChat
- Irker IRC Gateway
- GitLab Jira integration
- Mattermost Notifications Service
- Mattermost slash commands
- Microsoft Teams service
- Mock CI Service
- Prometheus integration
- Redmine Service
- Slack Notifications Service
- Slack slash commands
- GitLab Slack application
- Webhooks
- YouTrack Service
- Insights
- Issues
- Crosslinking Issues
- Design Management
- Confidential issues
- Due dates
- Issue Boards
- Issue Data and Actions
- Labels
- Managing issues
- Milestones
- Multiple Assignees for Issues
- Related issues
- Service Desk
- Sorting and ordering issue lists
- Issue weight
- Associate a Zoom meeting with an issue
- Merge requests
- Allow collaboration on merge requests across forks
- Merge Request Approvals
- Browser Performance Testing
- How to create a merge request
- Cherry-pick changes
- Code Quality
- Load Performance Testing
- Merge Request dependencies
- Fast-forward merge requests
- Merge when pipeline succeeds
- Merge request conflict resolution
- Reverting changes
- Reviewing and managing merge requests
- Squash and merge
- Merge requests versions
- Draft merge requests
- Members of a project
- Migrating projects to a GitLab instance
- Import your project from Bitbucket Cloud to GitLab
- Import your project from Bitbucket Server to GitLab
- Migrating from ClearCase
- Migrating from CVS
- Import your project from FogBugz to GitLab
- Gemnasium
- Import your project from GitHub to GitLab
- Project importing from GitLab.com to your private GitLab instance
- Import your project from Gitea to GitLab
- Import your Jira project issues to GitLab
- Migrating from Perforce Helix
- Import Phabricator tasks into a GitLab project
- Import multiple repositories by uploading a manifest file
- Import project from repo by URL
- Migrating from SVN to GitLab
- Migrating from TFVC to Git
- Push Options
- Releases
- Repository
- Branches
- Git Attributes
- File Locking
- Git file blame
- Git file history
- Repository mirroring
- Protected branches
- Protected tags
- Push Rules
- Reduce repository size
- Signing commits with GPG
- Syntax Highlighting
- GitLab Web Editor
- Web IDE
- Requirements Management
- Project settings
- Project import/export
- Project access tokens (Alpha)
- Share Projects with other Groups
- Snippets
- Static Site Editor
- Wiki
- Project operations
- Monitor metrics for your CI/CD environment
- Set up alerts for Prometheus metrics
- Embedding metric charts within GitLab-flavored Markdown
- Embedding Grafana charts
- Using the Metrics Dashboard
- Dashboard YAML properties
- Metrics dashboard settings
- Panel types for dashboards
- Using Variables
- Templating variables for metrics dashboards
- Prometheus Metrics library
- Monitoring AWS Resources
- Monitoring HAProxy
- Monitoring Kubernetes
- Monitoring NGINX
- Monitoring NGINX Ingress Controller
- Monitoring NGINX Ingress Controller with VTS metrics
- Alert Management
- Error Tracking
- Tracing
- Incident Management
- GitLab Status Page
- Feature Flags
- GitLab CI/CD
- GitLab CI/CD pipeline configuration reference
- GitLab CI/CD include examples
- Introduction to CI/CD with GitLab
- Getting started with GitLab CI/CD
- How to enable or disable GitLab CI/CD
- Using SSH keys with GitLab CI/CD
- Migrating from CircleCI
- Migrating from Jenkins
- Auto DevOps
- Getting started with Auto DevOps
- Requirements for Auto DevOps
- Customizing Auto DevOps
- Stages of Auto DevOps
- Upgrading PostgreSQL for Auto DevOps
- Cache dependencies in GitLab CI/CD
- GitLab ChatOps
- Cloud deployment
- Docker integration
- Building Docker images with GitLab CI/CD
- Using Docker images
- Building images with kaniko and GitLab CI/CD
- GitLab CI/CD environment variables
- Predefined environment variables reference
- Where variables can be used
- Deprecated GitLab CI/CD variables
- Environments and deployments
- Protected Environments
- GitLab CI/CD Examples
- Test a Clojure application with GitLab CI/CD
- Using Dpl as deployment tool
- Testing a Phoenix application with GitLab CI/CD
- End-to-end testing with GitLab CI/CD and WebdriverIO
- DevOps and Game Dev with GitLab CI/CD
- Deploy a Spring Boot application to Cloud Foundry with GitLab CI/CD
- How to deploy Maven projects to Artifactory with GitLab CI/CD
- Testing PHP projects
- Running Composer and NPM scripts with deployment via SCP in GitLab CI/CD
- Test and deploy Laravel applications with GitLab CI/CD and Envoy
- Test and deploy a Python application with GitLab CI/CD
- Test and deploy a Ruby application with GitLab CI/CD
- Test and deploy a Scala application to Heroku
- GitLab CI/CD for external repositories
- Using GitLab CI/CD with a Bitbucket Cloud repository
- Using GitLab CI/CD with a GitHub repository
- GitLab Pages
- GitLab Pages
- GitLab Pages domain names, URLs, and baseurls
- Create a GitLab Pages website from scratch
- Custom domains and SSL/TLS Certificates
- GitLab Pages integration with Let's Encrypt
- GitLab Pages Access Control
- Exploring GitLab Pages
- Incremental Rollouts with GitLab CI/CD
- Interactive Web Terminals
- Optimizing GitLab for large repositories
- Metrics Reports
- CI/CD pipelines
- Pipeline Architecture
- Directed Acyclic Graph
- Multi-project pipelines
- Parent-child pipelines
- Pipelines for Merge Requests
- Pipelines for Merged Results
- Merge Trains
- Job artifacts
- Pipeline schedules
- Pipeline settings
- Triggering pipelines through the API
- Review Apps
- Configuring GitLab Runners
- GitLab CI services examples
- Using MySQL
- Using PostgreSQL
- Using Redis
- Troubleshooting CI/CD
- GitLab Package Registry
- GitLab Container Registry
- Dependency Proxy
- GitLab Composer Repository
- GitLab Conan Repository
- GitLab Maven Repository
- GitLab NPM Registry
- GitLab NuGet Repository
- GitLab PyPi Repository
- API Docs
- API resources
- .gitignore API
- GitLab CI YMLs API
- Group and project access requests API
- Appearance API
- Applications API
- Audit Events API
- Avatar API
- Award Emoji API
- Project badges API
- Group badges API
- Branches API
- Broadcast Messages API
- Project clusters API
- Group clusters API
- Instance clusters API
- Commits API
- Container Registry API
- Custom Attributes API
- Dashboard annotations API
- Dependencies API
- Deploy Keys API
- Deployments API
- Discussions API
- Dockerfiles API
- Environments API
- Epics API
- Events
- Feature Flags API
- Feature flag user lists API
- Freeze Periods API
- Geo Nodes API
- Group Activity Analytics API
- Groups API
- Import API
- Issue Boards API
- Group Issue Boards API
- Issues API
- Epic Issues API
- Issues Statistics API
- Jobs API
- Keys API
- Labels API
- Group Labels API
- License
- Licenses API
- Issue links API
- Epic Links API
- Managed Licenses API
- Markdown API
- Group and project members API
- Merge request approvals API
- Merge requests API
- Project milestones API
- Group milestones API
- Namespaces API
- Notes API
- Notification settings API
- Packages API
- Pages domains API
- Pipeline schedules API
- Pipeline triggers API
- Pipelines API
- Project Aliases API
- Project import/export API
- Project repository storage moves API
- Project statistics API
- Project templates API
- Projects API
- Protected branches API
- Protected tags API
- Releases API
- Release links API
- Repositories API
- Repository files API
- Repository submodules API
- Resource label events API
- Resource milestone events API
- Resource weight events API
- Runners API
- SCIM API
- Search API
- Services API
- Application settings API
- Sidekiq Metrics API
- Snippets API
- Project snippets
- Application statistics API
- Suggest Changes API
- System hooks API
- Tags API
- Todos API
- Users API
- Project-level Variables API
- Group-level Variables API
- Version API
- Vulnerabilities API
- Vulnerability Findings API
- Wikis API
- GraphQL API
- Getting started with GitLab GraphQL API
- GraphQL API Resources
- API V3 to API V4
- Validate the .gitlab-ci.yml (API)
- User Docs
- Abuse reports
- User account
- Active sessions
- Deleting a User account
- Permissions
- Personal access tokens
- Profile preferences
- Threads
- GitLab and SSH keys
- GitLab integrations
- Git
- GitLab.com settings
- Infrastructure as code with Terraform and GitLab
- GitLab keyboard shortcuts
- GitLab Markdown
- AsciiDoc
- GitLab Notification Emails
- GitLab Quick Actions
- Autocomplete characters
- Reserved project and group names
- Search through GitLab
- Advanced Global Search
- Advanced Syntax Search
- Time Tracking
- GitLab To-Do List
- Administrator Docs
- Reference architectures
- Reference architecture: up to 1,000 users
- Reference architecture: up to 2,000 users
- Reference architecture: up to 3,000 users
- Reference architecture: up to 5,000 users
- Reference architecture: up to 10,000 users
- Reference architecture: up to 25,000 users
- Reference architecture: up to 50,000 users
- Troubleshooting a reference architecture set up
- Working with the bundled Consul service
- Configuring PostgreSQL for scaling
- Configuring GitLab application (Rails)
- Load Balancer for multi-node GitLab
- Configuring a Monitoring node for Scaling and High Availability
- NFS
- Working with the bundled PgBouncer service
- Configuring Redis for scaling
- Configuring Sidekiq
- Admin Area settings
- Continuous Integration and Deployment Admin settings
- Custom instance-level project templates
- Diff limits administration
- Enable and disable GitLab features deployed behind feature flags
- Geo nodes Admin Area
- GitLab Pages administration
- Health Check
- Job logs
- Labels administration
- Log system
- PlantUML & GitLab
- Repository checks
- Repository storage paths
- Repository storage types
- Account and limit settings
- Service templates
- System hooks
- Changing your time zone
- Uploads administration
- Abuse reports
- Activating and deactivating users
- Audit Events
- Blocking and unblocking users
- Broadcast Messages
- Elasticsearch integration
- Gitaly
- Gitaly Cluster
- Gitaly reference
- Monitoring GitLab
- Monitoring GitLab with Prometheus
- Performance Bar
- Usage statistics
- Object Storage
- Performing Operations in GitLab
- Cleaning up stale Redis sessions
- Fast lookup of authorized SSH keys in the database
- Filesystem Performance Benchmarking
- Moving repositories managed by GitLab
- Run multiple Sidekiq processes
- Sidekiq MemoryKiller
- Switching to Puma
- Understanding Unicorn and unicorn-worker-killer
- User lookup via OpenSSH's AuthorizedPrincipalsCommand
- GitLab Package Registry administration
- GitLab Container Registry administration
- Replication (Geo)
- Geo database replication
- Geo with external PostgreSQL instances
- Geo configuration
- Using a Geo Server
- Updating the Geo nodes
- Geo with Object storage
- Docker Registry for a secondary node
- Geo for multiple nodes
- Geo security review (Q&A)
- Location-aware Git remote URL with AWS Route53
- Tuning Geo
- Removing secondary Geo nodes
- Geo data types support
- Geo Frequently Asked Questions
- Geo Troubleshooting
- Geo validation tests
- Disaster Recovery (Geo)
- Disaster recovery for planned failover
- Bring a demoted primary node back online
- Automatic background verification
- Rake tasks
- Back up and restore GitLab
- Clean up
- Namespaces
- Maintenance Rake tasks
- Geo Rake Tasks
- GitHub import
- Import bare repositories
- Integrity check Rake task
- LDAP Rake tasks
- Listing repository directories
- Praefect Rake tasks
- Project import/export administration
- Repository storage Rake tasks
- Generate sample Prometheus data
- Uploads migrate Rake tasks
- Uploads sanitize Rake tasks
- User management
- Webhooks administration
- X.509 signatures
- Server hooks
- Static objects external storage
- Updating GitLab
- GitLab release and maintenance policy
- Security
- Password Storage
- Custom password length limits
- Restrict allowed SSH key technologies and minimum length
- Rate limits
- Webhooks and insecure internal web services
- Information exclusivity
- How to reset your root password
- How to unlock a locked user from the command line
- User File Uploads
- How we manage the TLS protocol CRIME vulnerability
- User email confirmation at sign-up
- Security of running jobs
- Proxying assets
- CI/CD Environment Variables
- Contributor and Development Docs
- Contribute to GitLab
- Community members & roles
- Implement design & UI elements
- Issues workflow
- Merge requests workflow
- Code Review Guidelines
- Style guides
- GitLab Architecture Overview
- CI/CD development documentation
- Database guides
- Database Review Guidelines
- Database Review Guidelines
- Migration Style Guide
- What requires downtime?
- Understanding EXPLAIN plans
- Rake tasks for developers
- Mass inserting Rails models
- GitLab Documentation guidelines
- Documentation Style Guide
- Documentation structure and template
- Documentation process
- Documentation site architecture
- Global navigation
- GitLab Docs monthly release process
- Telemetry Guide
- Usage Ping Guide
- Snowplow Guide
- Experiment Guide
- Feature flags in development of GitLab
- Feature flags process
- Developing with feature flags
- Feature flag controls
- Document features deployed behind feature flags
- Frontend Development Guidelines
- Accessibility & Readability
- Ajax
- Architecture
- Axios
- Design Patterns
- Frontend Development Process
- DropLab
- Emojis
- Filter
- Frontend FAQ
- GraphQL
- Icons and SVG Illustrations
- InputSetter
- Performance
- Principles
- Security
- Tooling
- Vuex
- Vue
- Geo (development)
- Geo self-service framework (alpha)
- Gitaly developers guide
- GitLab development style guides
- API style guide
- Go standards and style guidelines
- GraphQL API style guide
- Guidelines for shell commands in the GitLab codebase
- HTML style guide
- JavaScript style guide
- Migration Style Guide
- Newlines style guide
- Python Development Guidelines
- SCSS style guide
- Shell scripting standards and style guidelines
- Sidekiq debugging
- Sidekiq Style Guide
- SQL Query Guidelines
- Vue.js style guide
- Instrumenting Ruby code
- Testing standards and style guidelines
- Flaky tests
- Frontend testing standards and style guidelines
- GitLab tests in the Continuous Integration (CI) context
- Review Apps
- Smoke Tests
- Testing best practices
- Testing levels
- Testing Rails migrations at GitLab
- Testing Rake tasks
- End-to-end Testing
- Beginner's guide to writing end-to-end tests
- End-to-end testing Best Practices
- Dynamic Element Validation
- Flows in GitLab QA
- Page objects in GitLab QA
- Resource class in GitLab QA
- Style guide for writing end-to-end tests
- Testing with feature flags
- Translate GitLab to your language
- Internationalization for GitLab
- Translating GitLab
- Proofread Translations
- Merging translations from CrowdIn
- Value Stream Analytics development guide
- GitLab subscription
- Activate GitLab EE with a license