The source installation puts all the binaries into the bin sub directory in the target location specified by the -prefix parameter.
The packaged install puts the binaries into a folder organised per major PostgreSQL version.
A separate section is dedicated to wrappers and the contributed modules.
The latter is the best way to control the instance except in case of the XID wraparound failure. In this case the only way to run the instance is executing postgres in single user mode.
For historical reason there's usually also the postmaster symbolic link to postgres.
It can start,stop, reload the postgres process. It's also capable to send kill signals to the running instance.
pg_ctl accepts on the command line various options. The most important are the -D or -pgdata= to specify the database storage area and the -m to specify the shutdown mode. Check the section 4.2.2 for details.
pg_ctl also requires the action to perform on the instance.
The supported actions are
- init[db] initialises a directory as PostgreSQL data area
- start starts a PostgreSQL instance
- stop shutdowns a PostgreSQL instance
- reload reloads the configuration's files
- status checks the PostgreSQL instance running status
- promote promotes a standby server
- kill sends a custom signal to the running instance
The switch to set is -F followed by a letter to indicate the wanted output format.
- p saves the sql statements to reconstruct the schema and/or data in plain text with no compression.
- c is the custom PostgreSQL format. Supports parallel restore, compression and object search.
- d the dump is saved in a directory. With this format is possible to dump in parallel.
- t saves the dump in the standard tar format.
As pg_dumpall doesn't support all the pg_dump features is still very useful to save the cluster wide objects like the users with the switch -globals-only.
The reset removes the WAL files and creates a new pg_control. The XID are also restarted.
The instance becomes startable at the cost of losing any reference between the transactions and the data files. All the physical data integrity is lost and any attempt to run DML queries results in data corruption.
The on line manual is absolutely clear on this point.
After running pg_resetxlog the database must start without user access, the entire content must be dumped, the data directory must be dropped and recreated from scratch using initdb and then the dump file can be restored using psql or pg_restore