ミラーのセットアップ

このページの内容

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

A Data Center license is required to use this feature. Get an evaluation license to try it out, or purchase a license now.

スマート ミラーリングにより、大規模なリポジトリを使用する分散チームで Git クローンの速度を大幅に改善できます。このページでは、ミラーのインストール方法と、発生する可能性がある問題のトラブルシューティング方法について説明します。

For an overview of the benefits of using mirrors and how mirror farms can help your organization, see Smart Mirroring. These instructions assume you already have a fully licensed Bitbucket Data Center instance up and running.


On this page

始める前に

次の要件を実現している必要があります。

  • Your primary Bitbucket instance must be a fully licensed Bitbucket Data Center instance - You do not have to run your Bitbucket Data Center instance as a multi-node cluster to use smart mirroring, but you must have an up-to-date Data Center license.

  • The primary instance and all mirror(s) must have HTTPS with a valid (i.e., signed by a Certificate Authority anchored to the root and not expired) SSL certificate - This is a strict requirement of smart mirroring on both the primary instance and all mirror(s), and cannot be bypassed. The mirror setup wizard will not proceed if either the mirror or the primary instance does not have a valid SSL certificate.
  • The primary Bitbucket instance must have SSH enabled - Mirrors keep their repositories synchronized with the primary instance over SSH and cannot use HTTP or HTTPS for this. See Enable SSH access to Git repositories for instructions on enabling SSH access on your primary instance.
  • Each mirror is considered a unique Bitbucket instance - Home directories of mirrors should not be shared with the upstream or with other mirrors.

  • The platform the mirrors are running on must meet the same minimum requirements for Bitbucket Data Center - Check the Supported platforms for detailed requirements, including those for Java and Git, that apply to each mirror.

  • By design, each mirror (standalone or in a mirror farm) must run with an internal H2 database - Using an external database is highly discouraged for mirrors and will compromise performance significantly. 
  • The platform the mirrors are running on must have an OpenSSH client installed - The mirror will need an OpenSSH client installed to fetch changes from the primary Bitbucket Server.

    If you are using Bitbucket version 7.9 or higher, then you must use OpenSSH version 7.2 or higher to avoid sync failures for repositories.

  • The platform the mirrors are running on should not be under-provisioned - Just as with your primary Bitbucket Data Center instance, your mirrors need to be provisioned with enough CPU, memory, and I/O resources to handle their peak workload. See Scaling Bitbucket Server for more information.

  • Running your mirror behind a reverse proxy server and terminating SSL at the proxy is highly recommended - See Proxy and secure Bitbucket.
  • The ports of communication between the primary instance and the mirror should be opened - The mirror host should be able to connect the primary on HTTPS (443) and SSH (7999) ports. Also, the primary needs to reach the mirror on the HTTPS (443) port.


1. ミラーに Bitbucket をインストールする

The easy way to install a mirror is to download and run the Bitbucket installer and select the Install a new mirror option.

This is the same installer that you use for standard Bitbucket Server and Data Center instances. The mirroring functionality is included in the same distribution.



  1. Go to Download Bitbucket Server and download the latest version of the Bitbucket installer to the server where the mirror will run.

  2. インストーラーを実行し、[Install a new mirror] を選択します。

  3. インストール ウィザードの残りの部分を完了します。

アーカイブ ファイルからのインストール

Bitbucket インストーラーを使用したくない場合は、以下を実行できます。

  1. Bitbucket Server をアーカイブ ファイルからインストールし、開始しないままにします
  2. ${BITBUCKET_HOME}/shared/bitbucket.properties に以下の行を追加します:

    application.mode=mirror

2. ミラーで HTTPS をセットアップする

有効な SSL 証明書で HTTPS を使用してセキュアなアクセスを必須にするよう、ミラーを構成する必要があります。 

SSL 証明書は、商業ベースのサービスを提供する VeriSignDigiCert または Thawte などの信頼できるサードパーティ認証局 (CA) によって発行されている必要があります。アトラシアンでは、このようなサービスの提供や、サービスの使用のサポートは行っていません。 

SSL 証明書が用意できたら、「HTTPS を使用してリバース プロキシを保護する」のいずれかのオプションに従い、証明書を使用するようにミラーを構成できます。

You can choose whether to install your SSL certificate in a reverse proxy server or directly into Tomcat, either approach will work. But for performance, running your mirror behind a reverse proxy server such as nginx or HAproxy and terminating SSL at the proxy is highly recommended. See Proxy and secure Bitbucket for more information.

ミラープライマリ (上流の) インスタンスの両方が HTTPS を使用するように構成されている必要があります。ミラー セットアップ ウィザードは、ミラーまたはプライマリ インスタンスが有効な SSL 証明書を持たない場合、処理を続行しません。

3. ミラーの開始

Start your mirror.


sudo service atlbitbucket start
See Start and stop Bitbucket for more information on starting and stopping mirrors with the service command.

4. ミラーのセットアップ

ミラーが開始したら、ブラウザで https://<mirror-full-name> にナビゲートすることでセットアップ ウィザードに移動できます。ここで <mirror-full-name> は、DNS でのミラーの完全修飾名です。この名前は Mirror base URL として事前に入力され、[Submit configuration] のクリック後に変更することはできません。プライマリ Bitbucket インスタンスがこの名前でミラーに到達できることをご確認ください。 

フィールドの説明

ミラー名人間にわかりやすい形式でのインスタンス名。この名前は、ユーザーがクローン元のミラーを選択したときに表示されます。
ユーザーが素早く認識できる名前を選択するようにしてください。
ミラー ベース URLミラーにアクセスできる URL です。
Primary server URLプライマリ Bitbucket Data Center インスタンスの URL。

詳細を構成したら、[Submit configuration] をクリックします。 


[Submit configuration] をクリックしてからセットアップ ウィザードのフィールドを変更することはできないため、慎重に入力することをおすすめします。送信後にミラーのセットアップを変更する必要がある場合、ミラーを停止し、ミラーのホーム ディレクトリを完全に削除してから、手順 2 「ミラーで SSL をセットアップする」に戻ります。

応用: 自動セットアップ

As an alternative to the setup wizard, you can automate the setup process without needing to navigate to the mirror in a browser. You can supply the <Mirror name>, <Mirror base URL>, and <Primary server URL> to your new mirror by adding the following properties to your ${BITBUCKET_HOME}/shared/bitbucket.properties file. These properties can only be applied on the initial start of a new mirror, not after the mirror has already been set up.

setup.displayName=<Mirror name>
setup.baseUrl=<Mirror base URL>
plugin.mirroring.upstream.url=<Primary server URL>
plugin.mirroring.upstream.type=server

This can be useful if you deploy new mirrors using an automated process such as Puppet. See Automated setup for Bitbucket for more information.

Once you have successfully set up your mirror, it will guide you to log into the primary instance as an administrator to approve it. 

5. ミラー リクエストの承認

Once a mirror has been installed and configured, a request is sent to the primary Bitbucket Data Center instance. 

An approved mirror will have access to all projects and repositories in the primary Bitbucket Data Center instance. Smart Mirroring has been designed to require secure communication throughout and restrict all functionality to the appropriate privilege level (e.g., system administrator) to ensure the security of all your sensitive information. It is still your responsibility to set up mirrors with the same stringent security practices as your primary Bitbucket Data Center instance. See the FAQ How secure is Smart Mirroring? for more information.

ミラー リクエストの承認方法

  1. In your primary Bitbucket Data Center instance, go to Admin > Mirrors. The authorization request will appear.

  2. Click Authorize to approve the mirror request and start syncing the projects and repositories of the primary Bitbucket Data Center instance.

6. ミラーするプロジェクトの決定

Once a mirror instance is approved you need to decide which projects to mirror. Go to Admin > Mirrors and type in the name of a project in the search box. Do this for each project you want to mirror. You can also choose to mirror all projects.

If you choose to mirror all projects, you will not be able to select individual projects. This can't be undone. If you decide you no longer want to mirror all projects, you'll need to completely remove and then reinstall the mirror.



トラブルシューティング

このセクションでは、ミラーのインストール時の問題のトラブルシューティングのガイドを提供します。その他の参照情報としては、Bitbucket Data Center のよくある質問を網羅している「Bitbucket Data Center FAQ」をご確認ください。

有効な HTTPS 構成がない

  • Your primary Bitbucket Data Center instance and the mirror server must be configured for HTTPS access in order to use a mirror instance. See Proxy and secure Bitbucket for more information.
  • The value for the Primary server URL field must include the "https://" prefix.

プロジェクトの同期が "プロジェクト情報を取得しています..." で停止する

ミラー ベース URL が誤って設定されている

  • The property Mirror base URL can only be set once. If configured incorrectly you will need to delete your mirror and set it up again.

Bitbucket にアプリケーション リンクを追加したときに "入力した URL から応答がありません" と表示される

現在、Bamboo が Bitbucket Server のインスタンスに接続しようとする際、Git 操作の実行にベース URL を使用します。URL をミラー インスタンスについても利用可能にするよう、ミラーされたリポジトリについては Generic Git を使用する必要があります。

最終更新日 2022 年 11 月 8 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.