<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # Disaster Recovery (Geo) > 原文:[https://docs.gitlab.com/ee/administration/geo/disaster_recovery/](https://docs.gitlab.com/ee/administration/geo/disaster_recovery/) * [Promoting a **secondary** Geo node in single-secondary configurations](#promoting-a-secondary-geo-node-in-single-secondary-configurations) * [Step 1\. Allow replication to finish if possible](#step-1-allow-replication-to-finish-if-possible) * [Step 2\. Permanently disable the **primary** node](#step-2-permanently-disable-the-primary-node) * [Step 3\. Promoting a **secondary** node](#step-3-promoting-a-secondary-node) * [Promoting a **secondary** node running on a single machine](#promoting-a-secondary-node-running-on-a-single-machine) * [Promoting a **secondary** node with multiple servers](#promoting-a-secondary-node-with-multiple-servers) * [Promoting a **secondary** node with an external PostgreSQL database](#promoting-a-secondary-node-with-an-external-postgresql-database) * [Step 4\. (Optional) Updating the primary domain DNS record](#step-4-optional-updating-the-primary-domain-dns-record) * [Step 5\. (Optional) Add **secondary** Geo node to a promoted **primary** node](#step-5-optional-add-secondary-geo-node-to-a-promoted-primary-node) * [Step 6\. (Optional) Removing the secondary’s tracking database](#step-6-optional-removing-the-secondarys-tracking-database) * [Promoting secondary Geo replica in multi-secondary configurations](#promoting-secondary-geo-replica-in-multi-secondary-configurations) * [Step 1\. Prepare the new **primary** node to serve one or more **secondary** nodes](#step-1-prepare-the-new-primary-node-to-serve-one-or-more-secondary-nodes) * [Step 2\. Initiate the replication process](#step-2-initiate-the-replication-process) * [Troubleshooting](#troubleshooting) * [I followed the disaster recovery instructions and now two-factor auth is broken](#i-followed-the-disaster-recovery-instructions-and-now-two-factor-auth-is-broken) # Disaster Recovery (Geo)[](#disaster-recovery-geo-premium-only "Permalink") Geo 復制您的數據庫,Git 存儲庫和其他少量資產. 將來,我們將支持和復制更多數據,使您能夠在災難情況下以最少的精力進行故障轉移. 有關更多信息,請參見地[電流限制](../replication/index.html#current-limitations) . **警告:**多輔助配置的災難恢復在**Alpha 中** . 有關最新更新,請查看多級[災難恢復史詩](https://gitlab.com/groups/gitlab-org/-/epics/65) . ## Promoting a **secondary** Geo node in single-secondary configurations[](#promoting-a-secondary-geo-node-in-single-secondary-configurations "Permalink") 目前,我們不提供自動方式來升級 Geo 副本并進行故障轉移,但是如果您具有對該計算機的`root`訪問權,則可以手動進行. 此過程將**輔助**地理節點升級為**主要**節點. 為了盡快恢復地理冗余,應在遵循這些說明后立即添加新的**輔助**節點. ### Step 1\. Allow replication to finish if possible[](#step-1-allow-replication-to-finish-if-possible "Permalink") 如果**輔助**節點仍在從**主**節點復制數據,請盡可能嚴格遵循[計劃的故障轉移文檔](planned_failover.html) ,以避免不必要的數據丟失. ### Step 2\. Permanently disable the **primary** node[](#step-2-permanently-disable-the-primary-node "Permalink") **警告:**如果**主**節點脫機,則可能是**主**節點上保存的數據尚未復制到**輔助**節點. 如果繼續,此數據應視為丟失. 如果**主**節點發生故障,則應盡一切可能避免發生裂腦情況,即在兩個不同的 GitLab 實例中可能發生寫操作,從而使恢復工作復雜化. 因此,為故障轉移做準備,我們必須禁用**主**節點. 1. SSH 進入**主**節點以停止并禁用 GitLab,如果可能的話: ``` sudo gitlab-ctl stop ``` 如果服務器意外重啟,請阻止 GitLab 重新啟動: ``` sudo systemctl disable gitlab-runsvdir ``` **注意:(** **僅 CentOS** )在 CentOS 6 或更舊的版本中,如果沒有可用的機器重啟,沒有簡單的方法可以阻止啟動[GitLab](https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/3058) (請參閱[Omnibus GitLab 問題#3058](https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/3058) ). 完全卸載 GitLab 軟件包可能是最安全的: ``` yum remove gitlab-ee ``` **注意:** ( **Ubuntu 14.04 LTS** )如果您使用的是較舊版本的 Ubuntu 或基于 Upstart init 系統的任何其他發行版,則可以通過以下操作來阻止 GitLab 在計算機重啟時啟動: ``` initctl stop gitlab-runsvvdir echo 'manual' > /etc/init/gitlab-runsvdir.override initctl reload-configuration ``` 2. 如果您沒有對**主**節點的 SSH 訪問權限,請使計算機脫機并通過任何方式阻止其重啟. 由于您可能有很多方法可以完成此操作,因此我們將避免使用單個建議. 您可能需要: * 重新配置負載均衡器. * 更改 DNS 記錄(例如,將主要 DNS 記錄指向**輔助**節點,以停止使用**主要**節點). * 停止虛擬服務器. * 阻止通過防火墻的流量. * 從**主**節點撤消對象存儲權限. * 物理斷開機器連接. 3. 如果您打算[更新主域 DNS 記錄](#step-4-optional-updating-the-primary-domain-dns-record) ,則可能希望立即降低 TTL,以加快傳播速度. ### Step 3\. Promoting a **secondary** node[](#step-3-promoting-a-secondary-node "Permalink") 升級輔助服務器時,請注意以下事項: * A new **secondary** should not be added at this time. If you want to add a new **secondary**, do this after you have completed the entire process of promoting the **secondary** to the **primary**. * 如果遇到`ActiveRecord::RecordInvalid: Validation failed: Name has already been taken`在此過程中, `ActiveRecord::RecordInvalid: Validation failed: Name has already been taken`錯誤,請閱讀[故障排除建議](../replication/troubleshooting.html#fixing-errors-during-a-failover-or-when-promoting-a-secondary-to-a-primary-node) . #### Promoting a **secondary** node running on a single machine[](#promoting-a-secondary-node-running-on-a-single-machine "Permalink") 1. SSH 登錄到**輔助**節點并以 root 用戶身份登錄: ``` sudo -i ``` 2. 編輯`/etc/gitlab/gitlab.rb`以通過刪除啟用`geo_secondary_role`所有行來反映其新的**主要**狀態: ``` ## In pre-11.5 documentation, the role was enabled as follows. Remove this line. geo_secondary_role['enable'] = true ## In 11.5+ documentation, the role was enabled as follows. Remove this line. roles ['geo_secondary_role'] ``` 3. 將**輔助**節點升級為**主要**節點. 在將輔助節點升級為主節點之前,應運行飛行前檢查. 它們可以單獨運行,也可以與升級腳本一起運行. 要將輔助節點與預檢檢查一起提升為主節點: ``` gitlab-ctl promote-to-primary-node ``` **警告:**跳過飛行前檢查將把輔助設備升級為主要設備,而無需進一步確認! 如果您已經運行了[預檢檢查,](planned_failover.html#preflight-checks)或者不想運行它們,則可以使用以下方法跳過預檢檢查: ``` gitlab-ctl promote-to-primary-node --skip-preflight-check ``` 您還可以單獨運行飛行前檢查: ``` gitlab-ctl promotion-preflight-checks ``` 4. 驗證您可以使用先前用于**輔助**節點的 URL 連接到新提升的**主**節點. 5. 如果成功,則**輔助**節點現在已提升為**主要**節點. #### Promoting a **secondary** node with multiple servers[](#promoting-a-secondary-node-with-multiple-servers "Permalink") `gitlab-ctl promote-to-primary-node`命令尚不能與多臺服務器一起使用,因為它只能在僅一臺機器的**輔助** `gitlab-ctl promote-to-primary-node`上執行更改. 相反,您必須手動執行此操作. 1. SSH 進入**輔助**數據庫中的數據庫節點,并觸發 PostgreSQL 升級為可讀寫: ``` sudo gitlab-pg-ctl promote ``` 在 GitLab 12.8 及更早版本中,請參閱[消息: `sudo: gitlab-pg-ctl: command not found`](../replication/troubleshooting.html#message-sudo-gitlab-pg-ctl-command-not-found) . 2. 在**輔助**計算機上的每臺計算機上編輯`/etc/gitlab/gitlab.rb` ,以通過刪除啟用`geo_secondary_role`所有行來將其新狀態反映為**主要** `geo_secondary_role` : ``` ## In pre-11.5 documentation, the role was enabled as follows. Remove this line. geo_secondary_role['enable'] = true ## In 11.5+ documentation, the role was enabled as follows. Remove this line. roles ['geo_secondary_role'] ``` 進行這些更改后,請在每臺機器上[重新配置 GitLab,](../../restart_gitlab.html#omnibus-gitlab-reconfigure)以使更改生效. 3. 將**中學**提升到**小學** . SSH 進入單個應用程序服務器并執行: ``` sudo gitlab-rake geo:set_secondary_as_primary ``` 4. 驗證您可以使用先前用于**輔助服務器**的 URL 連接到新升級的**主**服務器. 5. 成功! **中學**已升格為**小學** . #### Promoting a **secondary** node with an external PostgreSQL database[](#promoting-a-secondary-node-with-an-external-postgresql-database "Permalink") `gitlab-ctl promote-to-primary-node`命令不能與外部 PostgreSQL 數據庫一起使用,因為它只能在使用 GitLab 的**輔助**節點和數據庫在同一臺機器上執行更改. 結果,需要手動處理: 1. 升級與**輔助**站點關聯的副本數據庫. 這會將數據庫設置為可讀寫: * Amazon RDS- [將只讀副本提升為獨立數據庫實例](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.html#USER_ReadRepl.Promote) * PostgreSQL 的 Azure 數據庫- [停止復制](https://docs.microsoft.com/en-us/azure/postgresql/howto-read-replicas-portal#stop-replication) * 其他外部 PostgreSQL 數據庫-將以下腳本保存在輔助節點中,例如`/tmp/geo_promote.sh` ,然后修改連接參數以匹配您的環境. 然后,執行它以提升副本: ``` #!/bin/bash PG_SUPERUSER = postgres # The path to your pg_ctl binary. You may need to adjust this path to match # your PostgreSQL installation PG_CTL_BINARY = /usr/lib/postgresql/10/bin/pg_ctl # The path to your PostgreSQL data directory. You may need to adjust this # path to match your PostgreSQL installation. You can also run # `SHOW data_directory;` from PostgreSQL to find your data directory PG_DATA_DIRECTORY = /etc/postgresql/10/main # Promote the PostgreSQL database and allow read/write operations sudo -u $PG_SUPERUSER $PG_CTL_BINARY -D $PG_DATA_DIRECTORY promote ``` 2. 在**輔助**站點中的每個節點上編輯`/etc/gitlab/gitlab.rb` ,以通過刪除啟用`geo_secondary_role`所有行來將其新狀態反映**為主** `geo_secondary_role` : ``` ## In GitLab 11.4 and earlier, remove this line. geo_secondary_role['enable'] = true ## In GitLab 11.5 and later, remove this line. roles ['geo_secondary_role'] ``` 進行這些更改后,請在每個節點上[重新配置 GitLab](../../restart_gitlab.html#omnibus-gitlab-reconfigure) ,以使更改生效. 3. 將**中學**提升到**小學** . SSH 進入單個輔助應用程序節點并執行: ``` sudo gitlab-rake geo:set_secondary_as_primary ``` 4. 驗證您可以使用先前用于**輔助**站點的 URL 連接到新升級的**主**站點. 成功! **輔助**站點現在已提升為**主要**站點. ### Step 4\. (Optional) Updating the primary domain DNS record[](#step-4-optional-updating-the-primary-domain-dns-record "Permalink") 將主域的 DNS 記錄更新為指向**輔助**節點將避免需要將對主域的所有引用更新為輔助域,例如更改 Git 遠程服務器和 API URL. 1. SSH 進入**輔助**節點并以 root 用戶身份登錄: ``` sudo -i ``` 2. 更新主域的 DNS 記錄. 更新主域名的 DNS 記錄指向**輔助**節點后,編輯`/etc/gitlab/gitlab.rb` **輔助**節點上,以反映新的網址: ``` # Change the existing external_url configuration external_url 'https://<new_external_url>' ``` **Note:** Changing `external_url` won’t prevent access via the old secondary URL, as long as the secondary DNS records are still intact. 3. 重新配置**輔助**節點以使更改生效: ``` gitlab-ctl reconfigure ``` 4. 執行以下命令以更新新提升的**主**節點 URL: ``` gitlab-rake geo:update_primary_node_url ``` 此命令將使用`/etc/gitlab/gitlab.rb`定義的更改的`external_url`配置. 5. 僅對于 GitLab 11.11 到 12.7,您可能需要更新數據庫中的**主**節點名稱. 此錯誤已在 GitLab 12.8 中修復. 要確定是否需要執行此操作,請在`/etc/gitlab/gitlab.rb`文件中搜索`gitlab_rails["geo_node_name"]`設置. 如果用`#`注釋掉或根本找不到它,則您將需要更新數據庫中**主**節點的名稱. 您可以像這樣搜索它: ``` grep "geo_node_name" /etc/gitlab/gitlab.rb ``` 要更新數據庫中**主**節點的名稱: ``` gitlab-rails runner 'Gitlab::Geo.primary_node.update!(name: GeoNode.current_node_name)' ``` 6. 驗證您可以使用其 URL 連接到新升級的**主數據庫** . 如果您更新了主域的 DNS 記錄,則這些更改可能尚未傳播,具體取決于以前的 DNS 記錄 TTL. ### Step 5\. (Optional) Add **secondary** Geo node to a promoted **primary** node[](#step-5-optional-add-secondary-geo-node-to-a-promoted-primary-node "Permalink") 使用上述過程將**輔助**節點提升為**主要**節點不會在新的**主要**節點上啟用 Geo. 要使新的**輔助**節點在線,請按照[Geo 設置說明進行操作](../replication/index.html#setup-instructions) . ### Step 6\. (Optional) Removing the secondary’s tracking database[](#step-6-optional-removing-the-secondarys-tracking-database "Permalink") 每個**次級**有一個用于保存從**初級**的所有項目的同步狀態的特殊的跟蹤數據庫. 由于**輔助服務器**已經升級,因此不再需要跟蹤數據庫中的數據. 可以使用以下命令刪除數據: ``` sudo rm -rf /var/opt/gitlab/geo-postgresql ``` 如果您在`gitlab.rb`文件中啟用了任何`geo_secondary[]`配置選項,則可以安全地注釋掉這些選項或將其刪除,然后[重新配置 GitLab](../../restart_gitlab.html#omnibus-gitlab-reconfigure)以使更改生效. ## Promoting secondary Geo replica in multi-secondary configurations[](#promoting-secondary-geo-replica-in-multi-secondary-configurations "Permalink") 如果您有多個**輔助**節點,并且需要升級其中一個,建議您按照[單輔助配置中的"](#promoting-a-secondary-geo-node-in-single-secondary-configurations)升級[**輔助** Geo"節點進行操作](#promoting-a-secondary-geo-node-in-single-secondary-configurations) ,之后還需要執行兩個額外步驟. ### Step 1\. Prepare the new **primary** node to serve one or more **secondary** nodes[](#step-1-prepare-the-new-primary-node-to-serve-one-or-more-secondary-nodes "Permalink") 1. SSH 進入新的**主**節點并以 root 用戶身份登錄: ``` sudo -i ``` 2. Edit `/etc/gitlab/gitlab.rb` ``` ## Enable a Geo Primary role (if you haven't yet) roles ['geo_primary_role'] ## # Allow PostgreSQL client authentication from the primary and secondary IPs. These IPs may be # public or VPC addresses in CIDR format, for example ['198.51.100.1/32', '198.51.100.2/32'] ## postgresql['md5_auth_cidr_addresses'] = ['<primary_node_ip>/32', '<secondary_node_ip>/32'] # Every secondary server needs to have its own slot so specify the number of secondary nodes you're going to have postgresql['max_replication_slots'] = 1 ## ## Disable automatic database migrations temporarily ## (until PostgreSQL is restarted and listening on the private address). ## gitlab_rails['auto_migrate'] = false ``` (有關這些設置的更多詳細信息,您可以閱讀[配置主服務器](../replication/database.html#step-1-configure-the-primary-server) ) 3. 保存文件并重新配置 GitLab,以進行數據庫偵聽更改和要應用的復制插槽更改. ``` gitlab-ctl reconfigure ``` 重新啟動 PostgreSQL 以使其更改生效: ``` gitlab-ctl restart postgresql ``` 4. 現在,重新啟動 PostgreSQL 并重新偵聽私有地址,即可重新啟用遷移. 編輯`/etc/gitlab/gitlab.rb`并將配置**更改**為`true` : ``` gitlab_rails['auto_migrate'] = true ``` 保存文件并重新配置 GitLab: ``` gitlab-ctl reconfigure ``` ### Step 2\. Initiate the replication process[](#step-2-initiate-the-replication-process "Permalink") 現在,我們需要使每個**輔助**節點偵聽新的**主要**節點上的更改. 為此,您需要再次[啟動復制過程](../replication/database.html#step-3-initiate-the-replication-process) ,但這一次是針對另一個**主**節點. 所有舊的復制設置將被覆蓋. ## Troubleshooting[](#troubleshooting "Permalink") ### I followed the disaster recovery instructions and now two-factor auth is broken[](#i-followed-the-disaster-recovery-instructions-and-now-two-factor-auth-is-broken "Permalink") 10.5 之前的 Geo 的安裝說明無法復制`otp_key_base`機密,該機密用于加密存儲在數據庫中的兩因素身份驗證機密. 如果**主**節點和**輔助**節點之間的設置不同,啟用了雙重身份驗證的用戶將無法在故障轉移后登錄. 如果您仍然可以訪問舊的**主**節點,則可以按照" [升級到 GitLab 10.5"](../replication/version_specific_updates.html#updating-to-gitlab-105)部分中的說明解決錯誤. 否則,密碼將丟失,您需要[為所有用戶重置兩步驗證](../../../security/two_factor_authentication.html#disabling-2fa-for-everyone) .
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看