📄 pg_ctl-ref.sgml
字号:
<varlistentry> <term><option>-W</option></term> <listitem> <para> Do not wait for start or shutdown to complete. This is the default for starts and restarts. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="app-pg-ctl-svcoptions"> <title>Windows options</title> <para> <variablelist> <varlistentry> <term><option>-N <replaceable class="parameter">servicename</replaceable></option></term> <listitem> <para> Name of the system service to register. The name will be used as both the service name and the display name. </para> </listitem> </varlistentry> <varlistentry> <term><option>-P <replaceable class="parameter">password</replaceable></option></term> <listitem> <para> Password for the user to start the service. </para> </listitem> </varlistentry> <varlistentry> <term><option>-U <replaceable class="parameter">username</replaceable></option></term> <listitem> <para> User name for the user to start the service. For domain users, use the format <literal>DOMAIN\username</literal>. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1> <title>Environment</title> <variablelist> <varlistentry> <term><envar>PGDATA</envar></term> <listitem> <para> Default data directory location. </para> </listitem> </varlistentry> <varlistentry> <term><envar>PGPORT</envar></term> <listitem> <para> Default port for <xref linkend="app-psql"> (used by the -w option). </para> </listitem> </varlistentry> </variablelist> <para> For others, see <xref linkend="app-postmaster">. </para> </refsect1> <refsect1> <title>Files</title> <variablelist> <varlistentry> <term><filename>postmaster.pid</filename></term> <listitem> <para> The existence of this file in the data directory is used to help <application>pg_ctl</application> determine if the server is currently running or not. </para> </listitem> </varlistentry> <varlistentry> <term><filename>postmaster.opts.default</filename></term> <listitem> <para> If this file exists in the data directory, <application>pg_ctl</application> (in <option>start</option> mode) will pass the contents of the file as options to the <command>postmaster</command> command, unless overridden by the <option>-o</option> option. </para> </listitem> </varlistentry> <varlistentry> <term><filename>postmaster.opts</filename></term> <listitem> <para>If this file exists in the data directory, <application>pg_ctl</application> (in <option>restart</option> mode) will pass the contents of the file as options to the <application>postmaster</application>, unless overridden by the <option>-o</option> option. The contents of this file are also displayed in <option>status</option> mode. </para> </listitem> </varlistentry> <varlistentry> <term><filename>postgresql.conf</filename></term> <listitem> <para> This file, located in the data directory, is parsed to find the proper port to use with <application>psql</application> when the <option>-w</option> is given in <option>start</option> mode. </para> </listitem> </varlistentry> </variablelist> </refsect1> <refsect1> <title>Notes</title> <para> Waiting for complete start is not a well-defined operation and may fail if access control is set up so that a local client cannot connect without manual interaction (e.g., password authentication). </para> </refsect1> <refsect1 id="R1-APP-PGCTL-2"> <title>Examples</title> <refsect2 id="R2-APP-PGCTL-3"> <title>Starting the Server</title> <para> To start up a server:<screen><prompt>$</prompt> <userinput>pg_ctl start</userinput></screen> </para> <para> An example of starting the server, blocking until the server has come up is:<screen><prompt>$</prompt> <userinput>pg_ctl -w start</userinput></screen> </para> <para> For a server using port 5433, and running without <function>fsync</function>, use:<screen><prompt>$</prompt> <userinput>pg_ctl -o "-F -p 5433" start</userinput></screen> </para> </refsect2> <refsect2 id="R2-APP-PGCTL-4"> <title>Stopping the Server</title> <para><screen><prompt>$</prompt> <userinput>pg_ctl stop</userinput></screen> stops the server. Using the <option>-m</option> switch allows one to control <emphasis>how</emphasis> the backend shuts down. </para> </refsect2> <refsect2 id="R2-APP-PGCTL-5"> <title>Restarting the Server</title> <para> Restarting the server is almost equivalent to stopping the server and starting it again except that <command>pg_ctl</command> saves and reuses the command line options that were passed to the previously running instance. To restart the server in the simplest form, use:<screen><prompt>$</prompt> <userinput>pg_ctl restart</userinput></screen> </para> <para> To restart server, waiting for it to shut down and to come up:<screen><prompt>$</prompt> <userinput>pg_ctl -w restart</userinput></screen> </para> <para> To restart using port 5433 and disabling <function>fsync</> after restarting:<screen><prompt>$</prompt> <userinput>pg_ctl -o "-F -p 5433" restart</userinput></screen> </para> </refsect2> <refsect2 id="R2-APP-PGCTL-6"> <title>Showing the Server Status</title> <para> Here is a sample status output from <application>pg_ctl</application>:<screen><prompt>$</prompt> <userinput>pg_ctl status</userinput><computeroutput>pg_ctl: postmaster is running (pid: 13718)Command line was:/usr/local/pgsql/bin/postmaster '-D' '/usr/local/pgsql/data' '-p' '5433' '-B' '128'</computeroutput></screen> This is the command line that would be invoked in restart mode. </para> </refsect2> </refsect1> <refsect1> <title>See Also</title> <para> <xref linkend="app-postmaster"> </para> </refsect1></refentry><!-- Keep this comment at the end of the fileLocal variables:mode:sgmlsgml-omittag:nilsgml-shorttag:tsgml-minimize-attributes:nilsgml-always-quote-attributes:tsgml-indent-step:1sgml-indent-data:tsgml-parent-document:nilsgml-default-dtd-file:"../reference.ced"sgml-exposed-tags:nilsgml-local-catalogs:("/usr/lib/sgml/catalog")sgml-local-ecat-files:nilEnd:-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -