postmaster - PostgreSQL multiuser database server
postmaster [ -A [ 0 ] [ 1 ] ] [ -B nbuffers ] [ -c name=value ] [ -d debug-level ] [ -D datadir ] [ -F ] [ -h hostname ] [ -i ] [ -k directory ] [ -l ] [ -N max-connections ] [ -o extra-options ] [ -p port ] [ -S ] [ --name=value ] [ [ -n ] [ -s ] ]
postmaster is the PostgreSQL multiuser database server. In order for a client application to access a database it connects (over a network or locally) to a running postmaster. The postmaster then starts a separate server process (``postgres(1)'') to handle the connection. The postmaster also manages the communication among server processes.
By default the postmaster starts in the foreground and prints log messages to the standard error stream. In practical applications the postmaster should be started as a background process, perhaps at boot time.
One postmaster always manages the data from exactly one database cluster. A database cluster is a collection of databases that is stored at a common file system location (the ``data area''). More than one postmaster process can run on a system at one time, so long as they use different data areas and different communication ports (see below). A data area is created with initdb(1).
When the postmaster starts it needs to know the location of the data area. The location must be specified by the -D option or the PGDATA environment variable; there is no default. Typically, -D or PGDATA points directly to the data area directory created by initdb. Other possible file layouts are discussed in the documentation.
postmaster accepts the following command line arguments. For a detailed discussion of the options consult the documentation. You can also save typing most of these options by setting up a configuration file.
--fsync=true has the opposite effect of this option.
This option is deprecated since it does not allow access to the full functionality of listen_addresses. It's usually better to set listen_addresses directly.
Using this switch discards all logging output, which is probably not what you want, since it makes it very difficult to troubleshoot problems. See below for a better way to start the postmaster in the background.
--silent-mode=false has the opposite effect of this option.
Two additional command line options are available for debugging problems that cause a server process to die abnormally. The ordinary strategy in this situation is to notify all other server processes that they must terminate and then reinitialize the shared memory and semaphores. This is because an errant server process could have corrupted some shared state before terminating. These options select alternative behaviors of the postmaster in this situation. Neither option is intended for use in ordinary operation.
These special-case options are:
A failure message mentioning semget or shmget probably indicates you need to configure your kernel to provide adequate shared memory and semaphores. For more discussion see the documentation.
A failure message suggesting that another postmaster is already running should be checked carefully, for example by using the command
$ ps ax | grep postmasteror
$ ps -ef | grep postmasterdepending on your system. If you are certain that no conflicting postmaster is running, you may remove the lock file mentioned in the message and try again.
A failure message indicating inability to bind to a port may indicate that that port is already in use by some non-PostgreSQL process. You may also get this error if you terminate the postmaster and immediately restart it using the same port; in this case, you must simply wait a few seconds until the operating system closes the port before trying again. Finally, you may get this error if you specify a port number that your operating system considers to be reserved. For example, many versions of Unix consider port numbers under 1024 to be ``trusted'' and only permit the Unix superuser to access them.
If at all possible, do not use SIGKILL to kill the postmaster. Doing so will prevent postmaster from freeing the system resources (e.g., shared memory and semaphores) that it holds before terminating. This may cause problems for starting a fresh postmaster run.
To terminate the postmaster normally, the signals SIGTERM, SIGINT, or SIGQUIT can be used. The first will wait for all clients to terminate before quitting, the second will forcefully disconnect all clients, and the third will quit immediately without proper shutdown, resulting in a recovery run during restart. The SIGHUP signal will reload the server configuration files.
The utility command pg_ctl(1) can be used to start and shut down the postmaster safely and comfortably.
The -- options will not work on FreeBSD or OpenBSD. Use -c instead. This is a bug in the affected operating systems; a future release of PostgreSQL will provide a workaround if this is not fixed.
To start postmaster in the background using default values, type:
$ nohup postmaster >logfile 2>&1 </dev/null &
To start postmaster with a specific port:
$ postmaster -p 1234This command will start up postmaster communicating through the port 1234. In order to connect to this postmaster using psql, you would need to run it as
$ psql -p 1234or set the environment variable PGPORT:
$ export PGPORT=1234 $ psql
Named run-time parameters can be set in either of these styles:
$ postmaster -c work_mem=1234 $ postmaster --work-mem=1234Either form overrides whatever setting might exist for work_mem in postgresql.conf. Notice that underscores in parameter names can be written as either underscore or dash on the command line.
Закладки на сайте
Проследить за страницей
Created 1996-2021 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру