📄 postmaster.sgml
字号:
<!--$PostgreSQL: pgsql/doc/src/sgml/ref/postmaster.sgml,v 1.53.6.1 2005/12/02 23:13:53 tgl Exp $PostgreSQL documentation--><refentry id="app-postmaster"> <refmeta> <refentrytitle id="APP-POSTMASTER-TITLE"><application>postmaster</application></refentrytitle> <manvolnum>1</manvolnum> <refmiscinfo>Application</refmiscinfo> </refmeta> <refnamediv> <refname id="postmaster-ref">postmaster</refname> <refpurpose><productname>PostgreSQL</productname> multiuser database server</refpurpose> </refnamediv> <indexterm zone="app-postmaster"> <primary>postmaster</primary> </indexterm> <refsynopsisdiv> <cmdsynopsis> <command>postmaster</command> <arg>-A <group choice="plain"><arg>0</arg><arg>1</arg></group></arg> <arg>-B <replaceable>nbuffers</replaceable></arg> <arg>-c <replaceable>name</replaceable>=<replaceable>value</replaceable></arg> <arg>-d <replaceable>debug-level</replaceable></arg> <arg>-D <replaceable>datadir</replaceable></arg> <arg>-F</arg> <arg>-h <replaceable>hostname</replaceable></arg> <arg>-i</arg> <arg>-k <replaceable>directory</replaceable></arg> <arg>-l</arg> <arg>-N <replaceable>max-connections</replaceable></arg> <arg>-o <replaceable>extra-options</replaceable></arg> <arg>-p <replaceable>port</replaceable></arg> <arg>-S</arg> <arg>--<replaceable>name</replaceable>=<replaceable>value</replaceable></arg> <group><arg>-n</arg><arg>-s</arg></group> </cmdsynopsis> </refsynopsisdiv> <refsect1> <title>Description</title> <para> <command>postmaster</command> is the <productname>PostgreSQL</productname> multiuser database server. In order for a client application to access a database it connects (over a network or locally) to a running <command>postmaster</command>. The <command>postmaster</command> then starts a separate server process (<quote><xref linkend="app-postgres"></quote>) to handle the connection. The <command>postmaster</command> also manages the communication among server processes. </para> <para> By default the <command>postmaster</command> starts in the foreground and prints log messages to the standard error stream. In practical applications the <command>postmaster</command> should be started as a background process, perhaps at boot time. </para> <para> One <command>postmaster</command> 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 <quote>data area</quote>). More than one <command>postmaster</command> 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 <xref linkend="app-initdb">. </para> <para> When the <command>postmaster</command> starts it needs to know the location of the data area. The location must be specified by the <option>-D</option> option or the <envar>PGDATA</envar> environment variable; there is no default. Typically, <option>-D</option> or <envar>PGDATA</envar> points directly to the data area directory created by <application>initdb</>. Other possible file layouts are discussed in <xref linkend="runtime-config-file-locations">. </para> </refsect1> <refsect1 id="app-postmaster-options"> <title>Options</title> <para> <command>postmaster</command> accepts the following command line arguments. For a detailed discussion of the options consult <xref linkend="runtime-config">. You can also save typing most of these options by setting up a configuration file. <variablelist> <varlistentry> <term><option>-A 0|1</option></term> <listitem> <para> Enables run-time assertion checks, which is a debugging aid to detect programming mistakes. This option is only available if assertions were enabled when <productname>PostgreSQL</> was compiled. If so, the default is on. </para> </listitem> </varlistentry> <varlistentry> <term><option>-B <replaceable class="parameter">nbuffers</replaceable></option></term> <listitem> <para> Sets the number of shared buffers for use by the server processes. The default value of this parameter is chosen automatically by <application>initdb</application>; refer to <xref linkend="runtime-config-resource-memory"> for more information. </para> </listitem> </varlistentry> <varlistentry> <term><option>-c <replaceable>name</replaceable>=<replaceable>value</replaceable></option></term> <listitem> <para> Sets a named run-time parameter. The configuration parameters supported by <productname>PostgreSQL</productname> are described in <xref linkend="runtime-config">. Most of the other command line options are in fact short forms of such a parameter assignment. <option>-c</> can appear multiple times to set multiple parameters. </para> </listitem> </varlistentry> <varlistentry> <term><option>-d <replaceable>debug-level</replaceable></option></term> <listitem> <para> Sets the debug level. The higher this value is set, the more debugging output is written to the server log. Values are from 1 to 5. </para> </listitem> </varlistentry> <varlistentry> <term><option>-D <replaceable class="parameter">datadir</replaceable></option></term> <listitem> <para> Specifies the file system location of the data directory or configuration file(s). See <xref linkend="runtime-config-file-locations"> for details. </para> </listitem> </varlistentry> <varlistentry> <term><option>-F</option></term> <listitem> <para> Disables <function>fsync</function> calls for improved performance, at the risk of data corruption in the event of a system crash. Specifying this option is equivalent to disabling the <xref linkend="guc-fsync"> configuration parameter. Read the detailed documentation before using this! </para> <para> <option>--fsync=true</option> has the opposite effect of this option. </para> </listitem> </varlistentry> <varlistentry> <term><option>-h <replaceable class="parameter">hostname</replaceable></option></term> <listitem> <para> Specifies the IP host name or address on which the <command>postmaster</command> is to listen for TCP/IP connections from client applications. The value can also be a comma-separated list of addresses, or <literal>*</> to specify listening on all available interfaces. An empty value specifies not listening on any IP addresses, in which case only Unix-domain sockets can be used to connect to the <command>postmaster</command>. Defaults to listening only on <systemitem class="systemname">localhost</systemitem>. Specifying this option is equivalent to setting the <xref linkend="guc-listen-addresses"> configuration parameter. </para> </listitem> </varlistentry> <varlistentry> <term><option>-i</option></term> <listitem> <para> Allows remote clients to connect via TCP/IP (Internet domain) connections. Without this option, only local connections are accepted. This option is equivalent to setting <varname>listen_addresses</> to <literal>*</> in <filename>postgresql.conf</> or via <option>-h</>. </para> <para> This option is deprecated since it does not allow access to the full functionality of <xref linkend="guc-listen-addresses">. It's usually better to set <varname>listen_addresses</> directly. </para> </listitem> </varlistentry> <varlistentry> <term><option>-k <replaceable class="parameter">directory</replaceable></option></term> <listitem> <para> Specifies the directory of the Unix-domain socket on which the <command>postmaster</command> is to listen for connections from client applications. The default is normally <filename>/tmp</filename>, but can be changed at build time. </para> </listitem> </varlistentry> <varlistentry> <term><option>-l</option></term> <listitem> <para> Enables secure connections using <acronym>SSL</acronym>. <productname>PostgreSQL</productname> must have been compiled with support for <acronym>SSL</acronym> for this option to be available. For more information on using <acronym>SSL</acronym>, refer to <xref linkend="ssl-tcp">. </para> </listitem> </varlistentry> <varlistentry> <term><option>-N <replaceable class="parameter">max-connections</replaceable></option></term> <listitem> <para> Sets the maximum number of client connections that this <command>postmaster</command> will accept. By default, this value is 32, but it can be set as high as your system will support. (Note that <option>-B</option> is required to be at least twice <option>-N</option>. See <xref linkend="kernel-resources"> for a discussion of system resource requirements for large numbers of client connections.) Specifying this option is equivalent to setting the <xref linkend="guc-max-connections"> configuration parameter. </para> </listitem> </varlistentry> <varlistentry> <term><option>-o <replaceable class="parameter">extra-options</replaceable></option></term> <listitem> <para> The command line-style options specified in <replaceable class="parameter">extra-options</replaceable> are passed to all server processes started by this <command>postmaster</command>. See <xref linkend="app-postgres"> for possibilities. If the option string contains any spaces, the entire string must be quoted. </para> </listitem> </varlistentry> <varlistentry> <term><option>-p <replaceable class="parameter">port</replaceable></option></term> <listitem> <para> Specifies the TCP/IP port or local Unix domain socket file extension on which the <command>postmaster</command> is to listen for connections from client applications. Defaults to the value of the <envar>PGPORT</envar> environment variable, or if <envar>PGPORT</envar> is not set, then defaults to the value established during compilation (normally 5432). If you specify a port other than the default port, then all client applications must specify the same port using either command-line options or <envar>PGPORT</envar>. </para> </listitem> </varlistentry> <varlistentry> <term><option>-S</option></term> <listitem> <para> Specifies that the <command>postmaster</command> process should start up in silent mode. That is, it will disassociate from the user's (controlling) terminal, start its own process group, and redirect its standard output and standard error to <filename>/dev/null</filename>. </para> <para> 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 <command>postmaster</command> in the background.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -