postmaster

Name

postmaster  --  Executes the PostgreSQL multi-user backend process.

Synopsis

postmaster [ -B nBuffers ] [ -D DataDir ] [ -N maxBackends ] [ -S ]
    [ -d DebugLevel ] [ -i ] [ -l ]
    [ -o BackendOptions ] [ -p port ] [ -n | -s ]
  

Parameters

postmaster accepts the following command line arguments:

-B buffers

Use this parameter to set the number of shared-memory disk buffers that postmaster should allocate for use by backend server processes. By default, this is 64 buffers at 8 kilobytes per buffer.

-D directory

Use this parameter to specify where the database directory tree should begin (the root directory). If this is not supplied, postmaster will use either the PGDATA environment variable or /$POSTGRESHOME/data. If neither environment variable is set, the default compile-time directory is used.

-N processes

Use this parameter to set the maximum number of concurrent backend processes that postmaster can start. By default, this value is set to 32. The maximum allowed number for this value is 1024.

Note

The value given with -B is required to be at least twice the number supplied for this parameter.

-S

Specifies that the postmaster process should start up in silent mode. That is, it will disassociate from the user's (controlling) tty, start its own process group, and redirect its standard output and standard error to /dev/null.

NoteWarning
 

Note that using this switch makes it very difficult to troubleshoot problems, since all tracing and logging output that would normally be generated by this postmaster and its child backends will be discarded.

-d level

Use this parameter to set the amount of debugging output that will be produced by the backend processes. If this number is set to one, all connection traffic will be tracked. A value of two and higher produce higher levels of debugging output.

NoteNote
 

Unless the standard output and standard error streams from postmaster are redirected to a file, all debugging information will be displayed to the controlling tty of the postmaster process.

-i

Use this parameter to allow client connections via TCP/IP. If this option is not specified, clients will accept only local domain socket connections.

-l

Use this parameter to allow secure connections via SSL. The -i parameter must also be given.

NoteNote
 

You must have compiled PostgreSQL with SSL enabled to use this option.

-o options

Use this parameter to specify options that postmaster should send to all backend processes when they are first started. Surround the string with quotes if it contains any spaces.

-p port

Use this parameter to specify the TCP/IP port number or socket file extension that this instance of postmaster should listen for connections on. If this is left unspecified, the default is taken from the PGPORT environment variable, or the compile-time default (usually 5432).

There are two parameter options provided for use in situations where postmaster has been terminating abnormally and more debugging information is needed to determine the cause. Using these parameters will change the program's behavior during termination.

NoteWarning
 

These parameters should not be used in normal operation.

-n

Use this parameter to stop postmaster from reinitializing shared data structures. A debugging tool can then be used to gain information about the memory's state at the time of the crash.

-s

Use this parameter to have postmaster use the SIGSTOP signal to stop backend processes at crash time. Using this signal will keep the backend processes in memory instead of terminating them, which allows you to force a core dump from each backend process manually. The core dumps can then be examined for debugging information individually.

Results

semget: No space left on device

This message is displayed if there were errors allocating shared memory. Try running the ipcclean program to clean up shared memory and semaphore space, then run postmaster again. You could also be receiving this error if your system's kernel is configured with restrictive shared memory limits; in this case, you will need to reconfigure the kernel. You can also try reducing the shared memory that postmaster uses by reducing the values of your supplied -B and -N options.

StreamServerPort: cannot bind to port

This error message is displayed if there is already a process listening on the port you specified. Check the process list with ps to see if postmaster has already been started; if it hasn't, try specifying another port number. You can run into this error occasionally if you attempt to run postmaster directly after shutting it down. If this is the case, wait a minute or so before attempting to start postmaster again and the problem should go away.

IpcMemoryAttach: shmat() failed: Permission denied

This error message is usually displayed if another instance of postmaster had been started by another user on the port you specified, and at some point terminated. Shared memory conflicts such as this can happen if there is more than one PostgreSQL installation on a single host, as shared memory keys are based on the port numbers postmaster instances are running on. After making sure there are no postmaster instances running, execute the ipcclean program to clean up shared memory and semaphores, then try running postmaster again.

Description

The postmaster program is the point of management between frontend processes (such as psql) and individual backend processes (instances of the postgres program), as well as the manager of shared memory resources and semaphores. Users should not interact directly with this program; it should be started as a background process.

Only one instance of postmaster should be running per data cluster (the collection of data within the directory specified with -D when starting postmaster) and port. Multiple postmaster instances can exist on a machine if they are using different database clusters and ports.

Examples

The following example demonstrates how to start postmaster using default values.

% nohup postmaster >logfile 2>&1 &

The next example starts postmaster with a specific port.

% nohup postmaster -p 1234 &