summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2015-11-17 06:46:17 -0500
committerPeter Eisentraut <peter_e@gmx.net>2016-02-02 21:04:29 -0500
commit7d17e683fcc28a1b371c7dd02935728cd2cbf9bf (patch)
tree5c27c3a9dedb188013e4d886c8a24feebfebf69d /doc/src
parentac7238dc0faccb0ad077aa9922df6e75b0b1bda3 (diff)
Add support for systemd service notifications
Insert sd_notify() calls at server start and stop for integration with systemd. This allows the use of systemd service units of type "notify", which greatly simplifies the systemd configuration. Reviewed-by: Pavel Stěhule <pavel.stehule@gmail.com>
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/installation.sgml16
-rw-r--r--doc/src/sgml/runtime.sgml35
2 files changed, 51 insertions, 0 deletions
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 8dcedc0aaa4..00686a73caf 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -813,6 +813,22 @@ su - postgres
</varlistentry>
<varlistentry>
+ <term><option>--with-systemd</option></term>
+ <listitem>
+ <para>
+ Build with support
+ for <application>systemd</application><indexterm><primary>systemd</primary></indexterm>
+ service notifications. This improves integration if the server binary
+ is started under <application>systemd</application> but has no impact
+ otherwise; see <xref linkend="server-start"> for more
+ information. <application>libsystemd</application> and the
+ associated header files need to be installed to be able to use this
+ option.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>--without-readline</option></term>
<listitem>
<para>
diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml
index cda05f578af..209eb9e5234 100644
--- a/doc/src/sgml/runtime.sgml
+++ b/doc/src/sgml/runtime.sgml
@@ -369,6 +369,41 @@ fi
<filename>contrib/start-scripts/linux</filename> in the
<productname>PostgreSQL</productname> source distribution.
</para>
+
+ <para>
+ When using <application>systemd</application>, you can use the following
+ service unit file (e.g.,
+ at <filename>/etc/systemd/system/postgresql.service</filename>):<indexterm><primary>systemd</primary></indexterm>
+<programlisting>
+[Unit]
+Description=PostgreSQL database server
+Documentation=man:postgres(1)
+
+[Service]
+Type=notify
+User=postgres
+ExecStart=/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
+ExecReload=/bin/kill -HUP $MAINPID
+KillMode=mixed
+KillSignal=SIGINT
+TimeoutSec=0
+
+[Install]
+WantedBy=multi-user.target
+</programlisting>
+ Using <literal>Type=notify</literal> requires that the server binary was
+ built with <literal>configure --with-systemd</literal>.
+ </para>
+
+ <para>
+ Consider carefully the timeout
+ setting. <application>systemd</application> has a default timeout of 90
+ seconds as of this writing and will kill a process that does not notify
+ readiness within that time. But a <productname>PostgreSQL</productname>
+ server that might have to perform crash recovery at startup could take
+ much longer to become ready. The suggested value of 0 disables the
+ timeout logic.
+ </para>
</listitem>
<listitem>