Postgres-XC 1.1 Documentation
Prev | Up |  | Next

# initgtm

## Name

initgtm -- create a new Postgres-XC GTM or GTM-Proxy for database cluster

## Synopsis

`initgtm` [`option`...] --pgdata | -D `directory` -Z `nodetype`

## Description

> Note: The following description applies both to Postgres-XC and PostgreSQL if not described explicitly.

`initgtm` creates a new GTM or GTM-Proxy node for a Postgres-XC database cluster. A database cluster has a unique GTM. A GTM-Proxy acts as an intermediate component between GTM and Postgres-XC nodes to group request messages. Each Coordinator and Datanode of the cluster need to register to GTM when starting up.

Creating a GTM for cluster consists of creating the directories and files in which the GTM data will live.

Although `initgtm` will attempt to create the specified data directory, it might not have permission if the parent directory of the desired data directory is root-owned. To initialize in such a setup, create an empty data directory as root, then use `chown` to assign ownership of that directory to the database user account, then `su` to become the database user to run `initgtm`.

`initgtm` must be run as the user that will own the server process, because the server needs to have access to the files and directories that `initgtm` creates. Since the server cannot be run as root, you must not run `initgtm` as root either. (It will in fact refuse to do so.)

> Note: The following description applies only to Postgres-XC

`initgtm` will be performed locally.

## Options

`-D `directory``
`--pgdata=`directory``

  This option specifies the directory where the GTM data should be stored. Data folder and node type are the only information required by `initgtm`. You can avoid writing it by setting the `PGDATA` environment variable.

`-Z `nodetype``

  This option specifies the node type which is initialized. It is possible to specify gtm to set up a GTM node, or gtm_proxy to set up a GTM-Proxy.

Other, less commonly used, parameters are also available:

`-d`
`--debug`

  Print debugging output from the bootstrap backend and a few other messages of lesser interest for the general public. The bootstrap backend is the program `initgtm` uses to create the catalog tables. This option generates a tremendous amount of extremely boring output.

`-n`
`--noclean`

  By default, when `initgtm` determines that an error prevented it from completely creating GTM data it removes any files it might have created before discovering that it cannot finish the job. This option inhibits tidying-up and is thus useful for debugging.

`-V`
`--version`

  Print the initgtm version and exit.

`-?`
`--help`

  Show help about initgtm command line arguments, and exit.

## Environment

`PGDATA`

  Specifies the directory where the GTM data is to be stored; can be overridden using the `-D` option.

## Notes

> Note: The following description applies only to Postgres-XC

`initgtm` runs only locally.

## See Also

gtm_ctl

Prev | Home | Next
initdb | Up | pg_controldata