How to Install and configure a remote Elasticsearch instance

お困りですか?

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

コミュニティに質問

このページでは、Bitbucket Data Center で機能するようにリモート Elasticsearch インスタンスをプロビジョニングする方法について説明します。

Bitbucket Data Center にはリモート Elasticsearch インスタンスがバンドルまたはインストールされないため、Bitbucket Data Center 用にリモート Elasticsearch インスタンスを用意する必要があります。

Bitbucket Data Center はクラスタの Elasticsearch へのリモート接続を 1 つのみ持つことができます。これは、スタンドアロンの Elasticsearch インストールまたはロード バランサの背後のクラスタ化されたインストールにすることができます。 

For details of about how Bitbucket uses Elasticsearch, including troubleshooting tips and frequently asked questions, see Administer code search.



ステップ 1: リモート マシンに Elasticsearch をインストールする

We don't provide specific instructions for installing Elasticsearch, but a good place to start is the Elasticsearch guide for installation. Elastic provides installation packages in several different formats here. Note that the authentication plugin – Buckler, described within the Secure Elasticsearch section – only supports specific versions of Elasticsearch. Refer to the Supported platforms - Additional Tools section to see the current Elasticsearch release we support.

ステップ 2: Elasticsearch を構成する

The elasticsearch.yml file contains configuration details for your Elasticsearch instance.

リモート Elasticsearch インスタンスを構成する方法

  1. Locate the elasticsearch.yml file within the configuration directory of your Elasticsearch (6.8.6) instance. 
     
  2. Add these parameters to your elasticsearch.yml file

    action.auto_create_index: ".watches,.triggered_watches,.watcher-history-*"
    network.host: 0.0.0.0
    xpack.security.enabled: false
    Third party plugins, such as Elastic's Shield plugin, may require specific exceptions to be set for action.auto_create_index. Consult your provider's documentation for more information.

ステップ 3: Elasticsearch を保護する

リモート Elasticsearch インスタンスへのアクセスをユーザー名とパスワードで保護する必要があります。接続するすべてのユーザーに認証資格情報を要求するセキュリティ プラグインでリモート Elasticsearch インスタンスを保護することをお勧めします。アトラシアンはこのための、Buckler と呼ばれる無料のプラグインを提供しています。また、Bitbucket Server は、基本認証を提供する他のプラグイン (Elastic の Shield プラグインなど) を通じた Elasticsearch への認証もサポートしています。


Buckler プラグインを使用して リモート Elasticsearch インスタンスを保護する方法

Buckler プラグインの URL をクリップボードにコピーします。

Elasticsearch versionBuckler plugin
Elasticsearch 7.16.3Buckler 3.0.1
Elasticsearch 7.16.2Buckler 3.0.0
Elasticsearch 7.10.2Buckler 2.1.5
Elasticsearch 7.9.3Buckler 2.1.4
Elasticsearch 7.5.2Buckler 2.1.3
Elasticsearch 6.8.23Buckler 2.2.1
Elasticsearch 6.8.22Buckler 2.2.0
Elasticsearch 6.8.6Buckler 2.1.2
Elasticsearch 6.6.1Buckler 2.1.1
Elasticsearch 6.5.3Buckler 2.0.1

Install the plugin onto your remote Elasticsearch instance using the plugin helper in the Elasticsearch /bin directory:

./elasticsearch-plugin install -b "<link from table above>"


リモート Elasticsearch インストールにアクセスするには、Bitbucket の基本認証を設定します。Bitbucket Data Center と連携するリモート Elasticsearch インスタンスでは少なくとも基本 HTTP 認証を有効化することを強く推奨します。

  1. Create a directory called buckler within the elasticsearch/config/ directory. 
  2. Within the elasticsearch/config/buckler directory, create a file named buckler.yml

    rpm または deb ファイルを使用してインストールする場合

    The location of your configuration directory varies depending on how you installed Elasticsearch. For rpm/deb installations the location is typically in /etc/elasticsearch

    ファイルが誤った場所に置かれた場合、Buckler は権限を行使しないため、インスタンス / クラスタは保護されません。

  3. Enable Buckler: at this point there are no configuration properties within buckler.yml, so the features of the Buckler plugin are disabled. 


    基本 HTTP 認証で Buckler を有効にするには、次のプロパティをファイルに追加し、Bitbucket が Elasticsearch へのアクセスに使用するユーザー名とパスワードを作成します (後の手順で構成します)。

    elasticsearch/config/buckler/buckler.yml
    auth.basic.http.enabled: true
    auth.basic.username: <username>
    auth.basic.password: <password>
    すべての機能を有効化する構成の例...
    auth.basic.http.enabled: true
    auth.basic.tcp.enabled: true
    auth.basic.username: admin
    auth.basic.password: basicpassword
    tls.http.enabled: true
    tls.tcp.enabled: true
    tls.keystore.path: /path/to/keystore
    tls.keystore.password: keystorepassword
    構成可能なすべてのパラメーターの説明...
    パラメーター説明
    auth.basic.http.enabled:
    
    true
    HTTP の基本認証を有効にします。
    auth.basic.tcp.enabled:
    true
    TCP の基本認証を有効にします。
    auth.basic.username:
    <username>
    Elasticsearch インスタンスにアクセスするためのユーザー名です。
    auth.basic.password:
    <password>
    Elasticsearch インスタンスにアクセスするためのパスワードです。
    tls.http.enabled:
    true
    HTTP の TLS を有効にします。
    tls.tcp.enabled:
    true
    TCP の TLS を有効にします。
    tls.keystore.path:
    <path/to/keystore>
    キーストアへのファイルシステムの絶対パスです。
    tls.keystore.password:
    <keystorepassword>
    キーストアにアクセスするためのパスワードです。

    If you enable TLS, the following block will need to be added to elasticsearch.yml

    http.type: buckler
    transport.type: buckler


    これは、Buckler バージョン 1.0.1 以降で有効です。

  4. Start your remote Elasticsearch instance. See Elasticsearch (6.8.6) documentation for specific instructions.

ステップ 4: Elasticsearch を Bitbucket に接続する

Elasticsearch インスタンスの構成が完了したら、それを Bitbucket に接続する必要があります。 

To configure your remote Elasticsearch instance using the bitbucket.properties file

Once a parameter is set in the bitbucket.properties file, it cannot be edited later from the admin UI. Any changes that need to be made to the Elasticsearch configuration must be made within the bitbucket.properties file.
  1. Locate the bitbucket.properties file in the <Bitbucket home directory>/shared directory. 
  2. Elasticsearch インスタンスの詳細 (上記の ステップ 3.3 で作成したもの) を追加します。

    <Bitbucket ホーム ディレクトリ>/shared/bitbucket.properties
    plugin.search.elasticsearch.baseurl=http://localhost:9200/
    plugin.search.elasticsearch.username=<username>
    plugin.search.elasticsearch.password=<password>
  3. ファイルを保存して閉じます。
  4. 組み込みの Elasticsearch インスタンスを開始せずに Bitbucket Server を起動します。

    Linux の場合start-bitbucket.sh --no-search 
    Windows の場合start-bitbucket.bat /no-search

これで、リモート Elasticsearch インスタンスと Bitbucket Server の連携に必要な構成は完了です。

最終更新日 2022 年 5 月 9 日

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

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