Running initdb

Running initdb#

TPAは、最初にpostgres_data_dir が存在しない場合は作成し、正しい所有権、権限、およびSELinuxコンテキストがあることを確認します。次に、ディレクトリにVERSION ファイルがまだ含まれていない限り、 initdb を実行してpostgres_data_dir を初期化します。

pre-initdb hook を使用できます

postgres_data_dir が作成され、initdb が実行される前にタスクを実行します。フックがpostgres_data_dir を初期化する場合、TPAはVERSION ファイルを見つけられるため、initdb を実行しません。

オプションでpostgres_initdb_opts をinitdb に渡すオプションのリストに設定できます。

cluster_vars:
  postgres_locale: de_DE.UTF-8
  postgres_initdb_opts:
  - --data-checksums

デフォルトで含まれる--data-checksums オプションを常に含めることをお勧めします。

initdb を実行すると、TPAは環境にTZ=UTC を設定し、LC_ALL を指定したpostgres_locale に設定します。

別の構成ディレクトリ#

デフォルトでは、 postgres_conf_dir はpostgres_data_dir と等しく、 Postgres構成ファイルpostgresql.conf 、pg_ident.conf 、pg_hba.conf 、およびconf.d のインクルードファイルはデータディレクトリに作成されます。 initdb を実行した後、postgres_conf_dir を変更すると、TPAは生成された構成ファイルを新しい場所に移動します。