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.
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.
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:
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.
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.
Print the initgtm version and exit.
Show help about initgtm command line arguments, and exit.
Specifies the directory where the GTM data is to be stored; can be overridden using the -D option.