initdb

Name

initdb  --  Create a new Postgres database installation 新しいPostgres データベースインスタンス を作成する。

Synopsis

initdb [ --pgdata=dbdir | -r dbdir ]
    [ --pglib=libdir | -l libdir ]
    [ --template=template | -t template ]
    [ --username=name | -u name ]
    [ --noclean | -n ] [ --debug | -d ]
  

入力

--pglib=libdir, -l libdir, PGLIB

Where are the files that make up Postgres? Apart from files that have to go in particular directories because of their function, the files that make up the Postgres software were installed in a directory called the libdir directory. An example of a file that will be found there that initdb needs is global1.bki.source, which contains all the information that goes into the shared catalog tables.

Postgres を組み立てるためのファイ ルをどこに置くのかを指定します。その機能のために特定のディレ クトリに置かなければならないファイルは別にして、 Postgres ソフトウエアを組み立てる ファイルは、 libdir ディレク トリと呼ばれる1つのディレクトリにインストールされます。共有カ タログテーブルに収納される全ての情報を持つ global1.bki.source は、 initdb が必要とする、そのディレク トリに存在するファイルの一例です。

--pgdata=dbdir, -r dbdir, PGDATA

Where in your Unix filesystem do you want the database data to go? The top level directory is called the PGDATA directory.

データベースのデータを Unix ファイルシステム上のどこに置く のかを指定します。このトップレベルディレクトリは PGDATA ディレクトリと呼ばれます。

--username=name, -u name, PGUSER

Who will be the Postgres superuser for this database system? The Postgres superuser is a Unix user who owns all files that store the database system and also owns the postmaster and backend processes that access them. Or just let it default to you (the Unix user who runs initdb).

誰がこのデータベースシステムの Postgres スーパユーザとなるのかを 指定します。Postgres スーパユーザ は、データベースシステムを格納するファイル全てと、これらのフ ァイルにアクセスする postmaster プロセスとバックエンドプロセ スを所有する Unix ユーザです。指定が無ければ、このデフォルト 値を単純に(initdb を実行する Unix ユーザである)あなたにします。

Note: Only the Unix superuser (root) can create a database system with an owner different from the Postgres superuser.

Unix のスーパユーザ( root )だけが Postgres スーパユーザと異なった所 有者を持つデータベースシステムを作成できます。

Other, less commonly used, parameters are also available:

その他のパラメータは、あまり使われませんが、以下のものが使用可 能です。

--template=template, -t template

Replace the template1 database in an existing database system, and don't touch anything else. This is useful when you need to upgrade your template1 database using initdb from a newer release of Postgres, or when your template1 database has become corrupted by some system problem. Normally the contents of template1 remain constant throughout the life of the database system. You can't destroy anything by running initdb with the --template option.

既存データベース内の template1 データベー スを置換し、それ以外は何も変更しません。これは、より新しいリ リースの Postgres 附属の initdb を使って、 template1 データベースをアップグレードする 必要がある時や、何らかのシステム上の問題によって template1 データベースがおかしくなってしま った時に有用です。通常 template1 の内容は そのデータベースシステムができてからずっと一定に保たれていま す。--template オプションをつけた initdb の実行によって何かを壊すこ とはありません。

--noclean, -n

By default, when initdb determines that error prevent it from completely creating the database system, it removes any files it may have created before determining that it can't finish the job. That includes any core files left by the programs it invokes. This option inhibits any tidying-up and is thus useful for debugging.

デフォルトでは、initdb は、エラーに よってデータベースシステムを正常に作成することができないことが 判ると、作業を完了できないことが判る前に作成していたファイルを 全て削除します。このプログラムによって生成された全ての core フ ァイルも削除されます。このオプションは後かたづけを全て抑制しま すので、デバッグの際に有用です。

--debug, -d

Print debugging output from the bootstrap backend. The bootstrap backend is the program initdb uses to create the catalog tables. This option generates a tremendous amount of output. It also turns off the final vacuuming step.

バックエンドのブートからのデバッグ用出力を表示します。バック エンドのブートは、initdb がカタロ グテーブルを生成する時に使用するプログラムです。このオプショ ンは途方もないほどの量の出力を行ないます。また、最後のゴミ掃 除段階では無効にされます。

Files are also input to initdb:

次のファイルもまたinitdb への入力です。

postconfig

If appearing somewhere in the Unix command search path (defined by the PATH environment variable). This is a program that specifies defaults for some of the command options. See below.

(環境変数 PATH によって定義された)Unix のコマンド検索パス のどこかにあった場合に使用されます。これは、いくつかのコマン ドオプションのデフォルト値を指定するプログラムです。後述しま す。

PGLIB/global1.bki.source

Contents for the shared catalog tables in the new database system. This file is part of the Postgres software.

新規データベースシステム中の共有カタログテーブルの内容です。 このファイルは Postgres ソフトウエ アの一部です。

PGLIB/local1_template1.bki.source

Contents for the template1 tables in the new database system. This file is part of the Postgres software.

新規データベースシステム中の template1 テーブルの内容です。 このファイルは Postgres ソフトウ エアの一部です。

出力

initdb will create files in the PGDATA data area which are the system tables and framework for a complete installation.

initdbPGDATA データ 領域に、システムテーブルとフレームワークであるファイルを、インス タンスを完全にするために作成します。

説明

initdb creates a new Postgres database system. A database system is a collection of databases that are all administered by the same Unix user and managed by a single postmaster.

initdb は新しい Postgres データベースシステムを作 成します。データベースシステムとは、ある Unix ユーザによって 管理され、1 つの postmaster によって処理されるデータベースの 集合です。

Creating a database system consists of creating the directories in which the database data will live, generating the shared catalog tables (tables that don't belong to any particular database), and creating the template1 database. What is the template1 database? When you create a database, Postgres does it by copying everything from the template1 database. It contains catalog tables filled in for things like the builtin types.

データベースシステムの作成は、データベースのデータを保存するディレ クトリの作成、(特定のデータベースに全く属さないテーブルである、) 共有カタログテーブルの生成、template1 データベー スの作成から成ります。template1 データベースとは 何でしょう? データベースを作成する時、 Postgrestemplate1 から全てをコピーしてその作成を行ないま す。そこには組み込み型といったものを全て含むカタログテーブルが含ま れています。

After initdb creates the database, it completes the initialization by running vacuum, which resets some optimization parameters.

initdb は、データベースを作成した後、い くつかの最適化パラメータをリセットする vacuum を実行して、初期化を完了します。

There are three ways to give parameters to initdb.

initdb にパラメータを付与する方法には、 次の 3 つの方法があります。

Command options always override parameters specified any other way. The values returned by postconfig override any environment variables, but your postconfig program may base its output on the environment variables if you want their values to be used.

コマンドオプションは常に他の方法で指定されたパラメータを上書きしま す。postconfig で返される値は、環境変数 を全て上書きします。しかし、環境変数の値を使いたければ、 postconfig プログラムをその値に基づいて 出力するように作成することができます。

The value that postconfig outputs must have the format

var1=value1 var2=value2 ...
   

postconfigが出力する値は

var1=value1 var2=value2 ...
   
といった形式でなければなりません。 It can output nothing if it doesn't want to supply any parameters. The var values are equal to the corresponding environment variable names. For example,
PGDATA=/tmp/postgres_test
   
has the same effect as invoking initdb with an environment variable called PGDATA whose value is /tmp/postgres_test. 何もパラメータを提供したくない場合は、何も出力しなくても構いませ ん。var の値は、対応する環境変数の名 前に一致します。例えば、
PGDATA=/tmp/postgres_test
   
は、PGDATA という環境変数の値を /tmp/postgres_test に設定して、 initdb を呼び出すことと同じ効果があり ます。