Install and configure a remote Elasticsearch instance

お困りですか?

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

コミュニティに質問

This page describes how to provision a remote Elasticsearch instance to work with Bitbucket Data Center.

Bitbucket Data Center requires a remote Elasticsearch instance, as it is not bundled or installed for Bitbucket Data Center.

Bitbucket Data Center can have only one remote connection to Elasticsearch for your cluster. This may be a standalone Elasticsearch installation or a clustered installation behind a load balancer. 

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

(warning) Bitbucket Data Center will only work with Elasticsearch 2.3.5.


Step 1: Install Elasticsearch on a remote machine

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


Step 2: Configure Elasticsearch

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


To configure your remote Elasticsearch instance

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

    index.mapper.dynamic: false
    action.auto_create_index: false
    network.host: 0.0.0.0
    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.

Step 3: Secure Elasticsearch

You need to secure access to your remote Elasticsearch instance with a username and password. We recommend securing your remote Elasticsearch instance with a security plugin that requires anyone connecting to it provides authentication credentials. Atlassian provides a free plugin called Buckler for this purpose. Bitbucket Server also supports authentication to Elasticsearch through other plugins that provide basic authentication, like Elastic's Shield plugin.


To secure your remote Elasticsearch instance with the Buckler plugin

  1. Copy the Buckler plugin URL to your clipboard:

    Elasticsearch 2.3.5 Buckler 0.2.12 for ES 2.3.5
  2. Install the plugin onto your remote Elasticsearch instance using the plugin helper in the Elasticsearch /bin directory:

    cd /path/to/elasticsearch/bin
    ./plugin install -b <link from table above>


  3. Configure basic authentication for Bitbucket to access your remote Elasticsearch installation. We strongly suggest enabling basic HTTP authentication, at minimum, for a remote Elasticsearch instance working with Bitbucket Data Center.
    1. Create a directory called buckler within the elasticsearch/config/buckler directory. 

    2. Within the elasticsearch/config/buckler directory, create a file named buckler.yml

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

      To enable the Buckler for basic HTTP authentication, you add these properties to the file, creating a username and password that Bitbucket will use to access Elasticsearch (configured in a later step).

      elasticsearch/config/buckler/buckler.yml
      auth.basic.http.enabled: true
      auth.basic.username: <username>
      auth.basic.password: <password>
      Here's an example config which enables every feature...
      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
      Here's an explanation of all the parameters you can configure...
      パラメーター 説明
      auth.basic.http.enabled:
      
      true
      Enables basic authentication for HTTP.
      auth.basic.tcp.enabled:
      true
      Enables basic authentication for TCP.
      auth.basic.username:
      <username>
      Username to access Elasticsearch instance.
      auth.basic.password:
      <password>
      Password to access Elasticsearch instance.
      tls.http.enabled:
      true
      Enables TLS for HTTP.
      tls.tcp.enabled:
      true
      Enables TLS for TCP.
      tls.keystore.path:
      <path/to/keystore>
      Absolute filesystem path to the keystore.
      tls.keystore.password:
      <keystorepassword>
      Password for accessing the keystore.
    4. Start your remote Elasticsearch instance. See Elasticsearch (2.3) 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. Add the details of your Elasticsearch instance (created in step 3.3 above):

    <Bitbucket home directory>/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 の連携に必要な構成は完了です。

最終更新日 2018 年 1 月 22 日

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

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