注: GitHub Enterprise Server では、最大で 8 つの高可用性レプリカ (パッシブとアクティブ/Go のいずれでも) が利用できます。
Creating a high availability replica
-
Set up a new GitHub Enterprise Server appliance on your desired platform. The replica appliance should mirror the primary appliance's CPU, RAM, and storage settings. We recommend that you install the replica appliance in an independent environment. The underlying hardware, software, and network components should be isolated from those of the primary appliance. If you are a using a cloud provider, use a separate region or zone. For more information, see "GitHub Enterprise Server インスタンスをセットアップする."
-
Ensure that the new appliance can communicate with all other appliances in this high availability environment over ports 122/TCP and 1194/UDP. For more information, see "ネットワーク ポート."
-
In a browser, navigate to the new replica appliance's IP address and upload your GitHub Enterprise license.
-
プライマリアプライアンス上のパスワードと一致する管理者パスワードを設定して続行します。
-
[レプリカとして構成] をクリックします。
-
"Add new SSH key(新しいSSH鍵の追加)"の下でSSH鍵を入力してください。
-
[キーの追加] をクリックします。
-
Connect to the replica appliance's IP address using SSH.
ssh -p 122 admin@REPLICA_IP
-
レプリケーション用のキーの組を生成するには、プライマリ アプライアンスの IP アドレスを指定して
ghe-repl-setup
コマンドを使用し、それが返す公開キーをコピーします。ghe-repl-setup PRIMARY_IP
-
プライマリ アプライアンスの承認されたキーのリストに公開キーを追加するには、
https://PRIMARY-HOSTNAME/setup/settings
を参照して、レプリカからコピーしたキーをリストに追加します。 -
To verify the connection to the primary and enable replica mode for the new replica, run
ghe-repl-setup
again.ghe-repl-setup PRIMARY_IP
-
データ ストアのレプリケーションを開始するには、
ghe-repl-start
コマンドを使います。ghe-repl-start
警告:
ghe-repl-start
を実行すると、プライマリ サーバーを短時間使えなくなり、その間、ユーザーには内部サーバー エラーが表示されることがあります。 もっとわかりやすいメッセージを表示するには、ghe-repl-start
をレプリカ ノードで実行する前にプライマリ ノード上でghe-maintenance -s
を実行し、アプライアンスをメンテナンス モードにします。 レプリケーションを開始したら、ghe-maintenance -u
を使ってメンテナンス モードを無効にします。 プライマリ ノードがメンテナンス モードの間、Git レプリケーションは進行しません。 -
各データストアのレプリケーション チャネルの状態を確認するには、
ghe-repl-status
コマンドを使用します。ghe-repl-status
Creating geo-replication replicas
This example configuration uses a primary and two replicas, which are located in three different geographic regions. While the three nodes can be in different networks, all nodes are required to be reachable from all the other nodes. At the minimum, the required administrative ports should be open to all the other nodes. For more information about the port requirements, see "ネットワーク ポート."
高可用性を実現するには、アクティブ ノードを持つネットワークとパッシブ ノードを持つネットワーク間の待機時間が 70 ミリ秒未満である必要があります。 2 つのネットワーク間にファイアウォールを設定することはお勧めしません。 If latency is more than 70 milliseconds, we recommend cache replica nodes instead. For more information, see "Configuring a repository cache."
-
Create the first replica the same way you would for a standard two node configuration by running
ghe-repl-setup
on the first replica.(replica1)$ ghe-repl-setup PRIMARY_IP (replica1)$ ghe-repl-start
-
Create a second replica and use the
ghe-repl-setup --add
command. The--add
flag prevents it from overwriting the existing replication configuration and adds the new replica to the configuration.(replica2)$ ghe-repl-setup --add PRIMARY_IP (replica2)$ ghe-repl-start
-
By default, replicas are configured to the same datacenter, and will now attempt to seed from an existing node in the same datacenter. Configure the replicas for different datacenters by setting a different value for the datacenter option. The specific values can be anything you would like as long as they are different from each other. Run the
ghe-repl-node
command on each node and specify the datacenter.On the primary:
(primary)$ ghe-repl-node --datacenter [PRIMARY DC NAME]
On the first replica:
(replica1)$ ghe-repl-node --datacenter [FIRST REPLICA DC NAME]
On the second replica:
(replica2)$ ghe-repl-node --datacenter [SECOND REPLICA DC NAME]
Tip: You can set the
--datacenter
and--active
options at the same time. -
An active replica node will store copies of the appliance data and service end user requests. An inactive node will store copies of the appliance data but will be unable to service end user requests. Enable active mode using the
--active
flag or inactive mode using the--inactive
flag.On the first replica:
(replica1)$ ghe-repl-node --active
On the second replica:
(replica2)$ ghe-repl-node --active
-
To apply the configuration, use the
ghe-config-apply
command on the primary.(primary)$ ghe-config-apply
Configuring DNS for geo-replication
Configure Geo DNS using the IP addresses of the primary and replica nodes. You can also create a DNS CNAME for the primary node (e.g. primary.github.example.com
) to access the primary node via SSH or to back it up via backup-utils
.
For testing, you can add entries to the local workstation's hosts
file (for example, /etc/hosts
). These example entries will resolve requests for HOSTNAME
to replica2
. You can target specific hosts by commenting out different lines.
# <primary IP> HOSTNAME
# <replica1 IP> HOSTNAME
<replica2 IP> HOSTNAME