Data Center ノードを追加・削除する
追加のクラスタ ノードをプロビジョニングすることで、ダウンタイムなしで Bitbucket Data Center のキャパシティを迅速にスケーリングできます。このページでは、Bitbucket Data Center の既存のインスタンスに別のクラスタ ノードを追加する方法について説明します。
Bitbucket Server の単一インスタンスから Bitbucket Data Center に移動する場合、このページではなく「Bitbucket Data Center のインストール」に移動してください。
If you are new to Bitbucket Data Center, we suggest you take a look at Clustering with Bitbucket.
クラスタ ノードをプロビジョニングする前の考慮事項
Chef、Puppet、または Vagrant などの自動構成管理ツールを使用するか、同一の仮想マシンのスナップショットをスピンアップすることで、クラスター ノードのプロビジョニングを行うことを強くお勧めします。
クラスタ ノードの最小要件
各 Bitbucket クラスタ ノードが Bitbucket Data Center Web アプリケーションを実行するため、それぞれが次の最小要件を満たす必要があります。
- 各 Bitbucket クラスタ ノードは専用のマシンである必要がありますが、マシンは物理でも仮想でも構いません。
- クラスタ ノードは高速 LAN で接続されている必要があります (すなわち、物理的に同じデータ センター内に存在する必要があります)。
- Java や Git の要件を含む、Bitbucket Server のサポート対象プラットフォームの要件が各クラスタ ノードに適用されます。
- 一貫したパフォーマンスのため、各クラスタ ノードはほぼ同一か、可能な限り同様である必要があります。
- すべてのクラスタ ノードが同じバージョンの Bitbucket Data Center を実行する必要があります。
- すべてのクラスタ ノードが同期クロックを使用し (NTP を使用するなど)、同じタイムゾーンで構成されている必要があります。
ノードを追加する
1. 共有ホーム ディレクトリをノードにマウントする
Bitbucket Data Center は、専用のマシン上に存在し、NFS を使用してアクセスできる共有ファイル システムを使用します。詳細については、「Bitbucket Data Center のインストール」を参照してください。
Mount the shared home directory as ${BITBUCKET_HOME}/shared
. For example, suppose your Bitbucket home directory is /var/atlassian/application-data/bitbucket
, and your shared home directory is available as an NFS export called bitbucket-san:/bitbucket-shared
. Add the following line to /etc/fstab
on the cluster node:
bitbucket-san:/bitbucket-shared /var/atlassian/application-data/bitbucket/shared nfs nfsvers=3,lookupcache=pos,noatime,intr,rsize=32768,wsize=32768 0 0
これをマウントします。
mkdir -p /var/atlassian/application-data/bitbucket/shared
sudo mount -a
2. ノードに Bitbucket Data Center をインストールする
https://www.atlassian.com/software/bitbucket/download から最新の Bitbucket Data Center ディストリビューションをダウンロードし、インストーラーを使用するか、アーカイブ ファイルから手動でアプリケーションをインストールして、クラスタ ノードに Bitbucket Server をインストールします。
3. ノードをクラスタに追加する
Start Bitbucket Server on the new node. See Start and stop Bitbucket. You can optionally give the node a persistent, human readable name by setting a node.name
system property under JVM_SUPPORT_RECOMMENDED_ARGS
in _start-webapp.sh For example:
-Dcluster.node.name=bitbucket-1
Once Bitbucket Server starts, go to http://<load-balancer>/admin/clustering
. You should see the new node listed, which would look similar to this:
Verify that the new node you have started up has successfully joined the cluster. If it does not, check your network configuration and the ${BITBUCKET_HOME}/log/atlassian-bitbucket.log
files on all nodes. If you are unable to find a reason for the node failing to join successfully, contact Atlassian Support .
4. ノードをロード バランサに接続する
Bitbucket Data Center はロード バランサを使用して、クラスタ ノードに対するユーザーからのリクエストを分散します。あるクラスタ ノードがダウンした場合、ロード バランサはすぐに障害を検出し、数秒以内に他のノードにリクエストを自動的に転送します。詳細については、「Bitbucket Data Center のインストール」を参照してください。
HAProxy 以外のハードウェアまたはソフトウェア ロード バランサを使用している場合、新しい Bitbucket クラスタ ノードをロード バランサに追加する方法についてはベンダーのドキュメントを参照してください。
If you are using HAProxy, simply add the following lines to your haproxy.cfg
file:
# In the backend bitbucket_http_backend section, add:
server bitbucket<xx> 192.168.0.<x>:7990 check inter 10000 rise 2 fall 5
# In the backend bitbucket_ssh_backend section, add:
server bitbucket<xx> 192.168.0.<x>:7999 check port 7999
where the values for <x>
and <xx>
don't conflict with an existing node.
ここで、HAProxy を再起動します。
sudo service haproxy restart
新しいノードがクラスタ内にあり、リクエストを受信していることを検証します。これを行うには、各ノードのログを調べ、それらすべてがトラフィックを受信していることを確認します。さらに、一方のノードで実行した更新をもう一方のノードで確認できるかどうかも調べます。
You can monitor the health of your cluster by navigating to HAProxy's statistics page at http://<load-balancer>:8090/
. You should see a page similar to this:
ノードを削除する。
To remove a node, stop Bitbucket on that node. You can then remove the installation and local home directory as required.
To see the number of nodes remaining, go to Administration > Clustering.
AWS および Azure でのスケーリング (拡張および縮小)
If you deployed Bitbucket Data Center on AWS or Azure, your Bitbucket nodes will be in scaling groups. You will add and remove nodes either by changing the minimum and maximum size of each group or using a scaling plan. See the following resources for more info:
Moving to a non-clustered Data Center
If you no longer need clustering, but still want access to Data Center features, you can go back to a non-clustered (single node) Data Center installation. In these instructions we'll assume that you'll use one of your existing cluster nodes as your new, standalone installation. You'll also need to make some infrastructure changes as part of the switch.
機能への影響について
After moving to a single node Data Center, you will lose capabilities that are based on clustering, such as instant scalability or performance and scale. For the complete list of features, see Server and Data Center feature comparison.
はじめる前に
このプロセスをステージング環境で完了し、一連の機能テスト、連携テスト、およびパフォーマンス テストを実行してから、本番環境に変更を加えることをおすすめします。
1. Shut down Bitbucket
続行する前にすべてのクラスタ ノードを停止します。
2. ロード バランサの構成
Configure your load balancer to redirect traffic away from all Bitbucket nodes, except the node you plan to use for your standalone installation.
ロード バランサが不要になった場合はこの手順で削除できます。
3. ホームで共有されているクラスタのの項目をローカルのホームに戻す
Unmount the
<shared home>
directory and copy its contents to the<local home>/shared
directory.
Make sure that the path to the shared subdirectory remains the same, as Git repositories are using absolute paths to other repositories and will break if the path changes.
4. Bitbucket を起動する
Bitbucket を再起動します。
To confirm you're now running a standalone installation, go to Administration > Clustering, which will show you the number of nodes in your cluster.