JIRA アプリケーションの SQL Server 2012 への接続
ここでは、Jira を Microsoft SQL Server 2012 データベースに接続する手順を説明します。
はじめる前に
- Jira アプリケーションを別のサーバに移行する場合は、データのエクスポートを XML バックアップとして作成します。その後、「データベースの切り替え」の説明に従い、元のデータベースから新しいデータベースにデータを移行できます。
- インストールを開始してセットアップ ウィザードを実行中の場合を除き、始める前に Jira を停止する必要があります。
1. SQL Server データベースの作成と設定
あとで Jira をデータベースに接続する際に必要になるため、データベースを作成するときに、データベース名、ユーザ名、スキーマ名、ポート番号を記録しておいてください。
Create a database for JIRA (e.g.
jiradb
).照合タイプでは、大文字と小文字が区別されないことに注意します。
SQL Server は Unicode エンコード形式で文字を格納します。これで、文字エンコード問題を十分回避できます。
Create a database user which JIRA will connect as (e.g.
jiradbuser
). This user should not be the database owner, but should be in thedb_owner
role.Create an empty 'schema' in the database for the JIRA tables (e.g.
jiraschema
).作成したデータベース ユーザーが、データベースに接続し、新しく作成したスキーマでテーブルを作成および更新できる権限を持っていることを確認します。
- SQL Server で TCP/IP が有効であり、適切なリスニング ポートが設定されていることを確認します。デフォルトの SQL Server インストールのユーザー ポート番号は 1433 です。
SQL Server が適切な認証モードで稼働していることを確認します。
- SET NOCOUNT オプションのチェックを外します。
- SQL Server Management Studio を開きます。
- [ツール] > [オプション] > [クエリ実行] > [SQL Server] > [詳細] に移動し、[SET NOCOUNT] チェック ボックスの選択を解除します。
[サーバー] > [プロパティ] > [接続] > [デフォルト接続] に移動し、[no count] オプションの選択を解除します。
新規作成したデータベース上で右クリックして、[クエリ コンソール] にアクセスし、 “New Query” を選択します。次のコマンドを実行し、分離レベルを設定します。
ALTER DATABASE THE-NEW-DATABASE-CREATED-FOR-JIRA SET READ_COMMITTED_SNAPSHOT ON
2. Jira を構成してデータベースに接続する
Jira Serverを構成して SQL Server データベースに接続するには、2 つの方法があります。
Using the JIRA setup wizard — Use this method, if you have just installed JIRA and are setting it up for the first time. Your settings will be saved to the
dbconfig.xml
file in your JIRA application home directory.Using the JIRA configuration tool — Use this method, if you have an existing JIRA instance. Your settings will be saved to the
dbconfig.xml
file in your JIRA application home directory.
データベース接続フィールド
The table shows the fields you'll need to fill out when connecting JIRA to your database. You can also refer to them, and the sample dbconfig.xml
file below, if you'd like to create or edit the dbconfig.xml
file manually.
セットアップウィザード / 設定ツール | dbconfig.xml | 説明 |
---|---|---|
ホスト名 |
| SQL Server がインストールされたサーバーマシンのマシン名または IP アドレスです。 |
ポート |
| SQL Server のサーバーがリスンする TCP/IP ポートです。このフィールドが空の場合、デフォルト ポートが使用されます。 |
データベース |
| SQL Server データベース(JIRA のデータ保存先)の名前です。上記 ステップ 1で作成済みのはずです。 |
ユーザ名 |
| JIRA が SQL Server サーバー接続時に使用するユーザーです。上記 ステップ 1で作成済みのはずです。 |
パスワード | <password> タグに格納されます (下記例の太字部分):<password> jiradbuser </password> | SQL Server サーバーが認証に使用するユーザーのパスワードです。 |
スキーマ | <schema-name> タグ格納されます (下記例の太字部分):<schema-name> dbo </schema-name> | SQL Server サーバーが使用するスキーマの名前です。上記 ステップ 1で作成済みのはずです。 |
dbconfig.xml ファイルのサンプル
上記の dbconfig.xml
ファイルに含まれる、pool
で始まる <jdbc-datasource/>
の子要素の詳細については、「データベース接続のチューニング」を参照してください。
<jira-database-config>
<name>defaultDS</name>
<delegator-name>default</delegator-name>
<database-type>mssql</database-type>
<schema-name>jiraschema</schema-name>
<jdbc-datasource>
<url>jdbc:sqlserver://dbserver:1433;databaseName=jiradb</url>
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
<username>jiradbuser</username>
<password>password</password>
<pool-min-size>20</pool-min-size>
<pool-max-size>20</pool-max-size>
<pool-max-wait>30000</pool-max-wait>
<pool-max-idle>20</pool-max-idle>
<pool-remove-abandoned>true</pool-remove-abandoned>
<pool-remove-abandoned-timeout>300</pool-remove-abandoned-timeout>
<validation-query>select 1</validation-query>
<min-evictable-idle-time-millis>60000</min-evictable-idle-time-millis>
<time-between-eviction-runs-millis>300000</time-between-eviction-runs-millis>
<pool-test-while-idle>true</pool-test-while-idle>
<pool-test-on-borrow>false</pool-test-on-borrow>
</jdbc-datasource>
</jira-database-config>
3. JIRA の起動
ここまでで、SQL Server データベースに接続するための JIRA の設定が完了したはずです。これで、起動できます!