Bitbucket Server を別のサーバーに移行する
このページでは、Bitbucket Server のインストールを 1 つの物理マシンから別のマシンに移動する方法について説明します。ほとんどの場合、次の 4 ステップのプロセスを行います。状況により、これらのすべては必要ではない場合があります。
- 移行を準備します。
- Bitbucket Server データを移動します。
- Move the Bitbucket Server installation to the new location, and update the value of the
BITBUCKET_HOME
environment variable. - Bitbucket Server bitbucket.properties ファイルを更新します。この手順は、ステップ 2 で移行ウィザードを使用できない場合に必要です。
Bitbucket Server アップグレード ガイドもご参照ください。Bitbucket Server を移行する前または後に Bitbucket Server をアップグレードできます。このページでは、アップグレード方法については説明していません。
1. 移行の準備
Bitbucket Server から別のサーバーへの移行の準備では、以下の手順が完了していることを確認します。
- 新しいマシンのオペレーティング システム、データベース、その他の必要なプラットフォームおよびハードウェアが Bitbucket Server の要件を満たしていることを確認します。
- Bitbucket Server ナレッジベースで、既知の問題がないかどうかを確認します。
- ユーザーに対し、今後の Bitbucket Server のサービス停止を警告します。
- 移行中、ユーザーが既存の Bitbucket Server データを更新できないようにします。これは、Bitbucket Server のアクセス権限を一時的に変更することで実現できます。
- 新しいサーバーが外部ユーザー ディレクトリへのアクセス権を持っていない場合に Bitbucket Server から閉め出されるのを防ぐため、外部ユーザー ディレクトリではなく Bitbucket Server 内でシステム管理者グローバル権限を持つユーザーを作成済みであることを確認します。
2. Bitbucket Server のデータを別のマシンに移動する
このセクションでは、Bitbucket Server のデータを別のマシンに移動する方法の概要について説明します。組み込みのデータベースを引き続き使用する場合、操作は不要です。Bitbucket Server インストールを移動させた際に、Bitbucket Server のデータも移動されます。
Bitbucket Server のデータには、データ ディレクトリ (Git リポジトリを含む)、ログ ファイル、インストール済みプラグイン、一時ファイル、およびキャッシュが含まれます。
Bitbucket Server のデータは次のように移動できます。
- 埋め込みデータベースからサポート対象の外部 DBMS へ。
- 同じ DBMS の別のインスタンスへ。
- 1 つの DBMS からサポート対象の別の DBMS へ (例: MySQL から PostgreSQL へ)。
実際の DBMS を移動することもできます。アトラシアンでは大規模なインストールの場合、Bitbucket Server と DBMS を別のマシンで実行することをおすすめしています。
2 つのステップがあります。
- Create and configure the DBMS in the new location. Please refer to Connect Bitbucket to an external database, and the relevant child page, for more information.
- 次のいずれかを実行します。
- If the new location is currently visible to Bitbucket Server, use the Bitbucket Server Database Migration Wizard. Please refer to Connect Bitbucket to an external database, and the relevant child page, for more information.
- If the new location is not currently visible to Bitbucket Server (perhaps because you are moving to a new hosting provider), you need to perform a database export and then import the backup to the new DBMS. Please refer to the vendor documentation for your DBMS for detailed information.
You will also need to update the bitbucket.properties file in the<Bitbucket home directory>
as described below.
3. Bitbucket Server を別のマシンに移動する
このセクションでは、Bitbucket Server インストールの別のマシンへの移動について説明します。
- Stop Bitbucket Server. See Start and stop Bitbucket.
- Bitbucket ホーム ディレクトリのアーカイブ (zip ファイルなど) を作成します。ホーム ディレクトリには、データ ディレクトリ (Git リポジトリ)、ログ ファイル、インストール済みプラグイン、SSH フィンガープリント、一時ファイルやキャッシュが含まれます。ホーム ディレクトリの場所は次のように定義されます。
- on Windows, by the
BITBUCKET_HOME
environment variable, or by theBITBUCKET_HOME
line of<Bitbucket Server installation directory
>
./bin/set-bitbucket-home.bat
on Linux and Mac, by the
BITBUCKET_HOME
line of<Bitbucket Server installation directory
>/bin/set-bitbucket-home.sh
.
- on Windows, by the
Bitbucket ホーム ディレクトリのアーカイブを新しいマシンにコピーして、そこで新しい場所に展開します。
本番環境の場合、Bitbucket Server ホーム ディレクトリを認証されていないアクセスから保護する必要があります。詳細は「Bitbucket ホーム ディレクトリ」を参照してください。
- When moving the Bitbucket Server home directory from Windows to Linux or Mac, make sure that the files within
<Bitbucket home directory
>/git-hooks
and<Bitbucket home directory
>/shared/data/repositories/<repoID>/hooks
directories have the executable file permission set.
- 次のいずれかの操作を実行して、Bitbucket Server インスタンスを新しい場所でセットアップします。
- 古い Bitbucket Server インストール ディレクトリのアーカイブを作成して、新しいマシンにコピーします。
- 新しいマシンで同じバージョンの Bitbucket Server をゼロからインストールします。
- Redefine the value for
BITBUCKET_HOME
, mentioned in Step 2. above, in the new<Bitbucket Server installation directory
>, using the new location for your copied home directory. See Set the home directory for more information. - If you are continuing to use the Bitbucket Server embedded database, or you used the Migration Wizard to move the Bitbucket Server data, you should now be able to start Bitbucket Server on the new machine and have all your data available. See Start and stop Bitbucket. Once you have confirmed that the new installation of Bitbucket Server is working correctly, revert the access permissions for Bitbucket Server to their original values.
- If you moved the Bitbucket Server data by performing a database export and import, carry on to Step 4. below to update the bitbucket.properties file in the
<Bitbucket home directory>
.
Using rysnc to move your installation
Another way to move your Bitbucket Server installation is to use rsync (learn more at ss64.com). This option may be helpful if you want to avoid the system downtime that using an archive file will require.
If you use rsync, make sure to use the --delete
option. Without it, if you run rsync more than once, files removed from the source machine will not be removed from the target. As a result, the two filesystems will not match, and this can lead to problems with your installation.
4. Bitbucket Server 構成の更新
If you moved the Bitbucket Server data by performing a database export, you must update the bitbucket.properties file within <Bitbucket home directory>/shared
with the changed configuration parameters for the database connection.
The configuration parameters are described in Configuration properties.
Once the configuration parameters are updated, you should be able to start Bitbucket Server on the new machine and have all your data available. See Start and stop Bitbucket. Once you have confirmed that the new installation of Bitbucket Server is working correctly, revert the access permissions for Bitbucket Server to their original values.