Bitbucket Server を PostgreSQL に接続する



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


This page describes how to connect Bitbucket Server to a PostgreSQL database. 

The overall process for using a PostgreSQL database with Bitbucket Server is:

  • Install PostgreSQL where it is accessible to Bitbucket Server.
  • Create a database and user on the PostgreSQL server for Bitbucket Server to use.
  • Install Bitbucket Server on Windows, or on Linux or Mac. See Getting started.
  • 次のいずれかを実行します。
    • at Bitbucket Server install time, run the Setup Wizard to connect Bitbucket Server to the PostgreSQL database, or
    • at a later time, migrate Bitbucket Server to the PostgreSQL database. See Using the Database Migration Wizard.

It is assumed here that you already have PostgreSQL installed and running. For more information about PostgreSQL installation and operation, refer to the PostgreSQL documentation. For additional information review this page on tuning.

PostgreSQL has the idea of schemas. When you create a PostgreSQL database, a 'public' schema is created and set as the default for that database. It is possible to create a different schema (e.g. 'bitbucket') and set that as the default schema. Bitbucket Server will use whatever schema is set as the default for the logged-in user. Bitbucket Server does not provide a way for a user to nominate the schema to use; it uses schema that is set as the PostgreSQL default.

See Supported platforms for the versions of PostgreSQL supported by Bitbucket Server.



If you are migrating your Bitbucket Server data from the HSQL internal database, back up the Bitbucket Server home directory.

If you are migrating your Bitbucket Server data from another external database, back up that database by following the instructions provided by the database vendor before proceeding with these instructions.


Bitbucket Server データベースの作成

Before you can use Bitbucket Server with PostgreSQL, you must:

  • Create a role for Bitbucket Server to use when it connects to the database.
    We strongly recommend that this role be established for Bitbucket Server's use exclusively; it should not be shared by other applications or people.
  • Create a database in which Bitbucket Server can store its data.
    The database must be configured to use the UTF-8 character set.
    During normal operation, Bitbucket Server will acquire 25–30 connections to the database. The maximum number of connections is a configurable system property – see Database pool.
  • Note that Bitbucket Server requires the database to keep idle connections alive for at least 10 minutes. If the database is configured with less than a 10 minute connection timeout, there will be seemingly random connection errors

Here is an example of how to create a user called bitbucketuser with password jellyfish , and a database called bitbucket , which is configured for use by bitbucketuser. Using a PostgreSQL client application like psql or pgAdmin, run the following commands, replacing the user name, password, and database name with your own values.

CREATE ROLE bitbucketuser WITH LOGIN PASSWORD 'jellyfish' VALID UNTIL 'infinity';

If the server that is hosting the PostgreSQL database is not the same server as Bitbucket Server, then please ensure that the Bitbucket Server server can connect to the database server. Please also refer to the PostgreSQL documentation on how to set up pg_hba.conf. If the pg_hba.conf file is not set properly, remote communication to the PostgreSQL server will fail.

Connect Bitbucket Server to the PostgreSQL database

You can now connect Bitbucket Server to the PostgreSQL database, either:

  • インストール時にセットアップ ウィザードを実行する場合
  • when you wish to migrate Bitbucket Server to PostgreSQL, either from the embedded HSQL database or from another external database.

インストール時にセットアップ ウィザードを実行する場合

  1. "Database" 手順で [External] を選択します。
  2. Select PostgreSQL for Database Type.
  3. フォームに入力します。詳細は、以下の表を参照してください。
  4. [Next] をクリックし、Bitbucket Server セットアップ ウィザードの手順に従います。

When migrating to PostgreSQL

  1. Bitbucket Server の管理領域で、[設定] 配下の [データベース] をクリックします。
  2. [データベースの移行] をクリックします。
  3. Select PostgreSQL for Database Type.
  4. フォームに入力します。詳細は、以下の表を参照してください。
  5. [移行の開始] をクリックします。


データベース サーバーを実行するコンピューターのホスト名または IP アドレス。

Bitbucket Server がデータベース サーバーに接続できる TCP ポート。既定値は、MySQL または MariaDB が実行される既定のポートです。MySQL または MariaDB インスタンスが使用しているポートを確認済みの場合は変更できます。

Bitbucket Server が接続するデータベースの名前。

Database username
The username that Bitbucket Server should use to access the database.

Database password
The password that Bitbucket Server should use to access the database.


最終更新日 2019 年 8 月 20 日


Powered by Confluence and Scroll Viewport.