Skip to content

Commit 2e45c14

Browse files
committed
Replace the virtual_host and tcpip_socket parameters with a unified
listen_addresses parameter, as per recent discussion. The default behavior is now to listen on localhost, which eliminates the need for the -i postmaster switch in many scenarios. Andrew Dunstan
1 parent 0d88dd1 commit 2e45c14

File tree

9 files changed

+147
-159
lines changed

9 files changed

+147
-159
lines changed

doc/FAQ_QNX4

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PostgreSQL on QNX 4
22
--------------------
3-
last updated: $Date: 2002/07/09 04:47:07 $
3+
last updated: $Date: 2004/03/23 01:23:47 $
44

55
current maintainer: Bernd Tegge (tegge@repas-aeg.de)
66
original author: Andreas Kardos (kardos@repas-aeg.de)
@@ -23,10 +23,9 @@ functionality cannot be used. Shared library support could probably be
2323
implemented in future.
2424

2525
QNX 4 does not support UNIX domain sockets. Clients must use TCP/IP
26-
sockets. Therefore you either have to set "tcpip_socket = true" in
27-
your postgresql.conf or to start postmaster with the -i option.
28-
Furthermore it's advisable to set to set the PGHOST or SOCK environment
29-
variable for postmaster in an environment using native QNX networking.
26+
sockets. Therefore, do not set "listen_addresses" to empty in your
27+
postgresql.conf file. In fact, it's advisable to explicitly set
28+
"listen_addresses" in an environment using native QNX networking.
3029
Otherwise the postmaster might not use the IP-Address you think it does :-)
3130

3231
Prerequisites:

doc/src/sgml/client-auth.sgml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/client-auth.sgml,v 1.64 2004/03/09 16:57:46 neilc Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/client-auth.sgml,v 1.65 2004/03/23 01:23:48 tgl Exp $
33
-->
44

55
<chapter id="client-authentication">
@@ -112,31 +112,37 @@ hostnossl <replaceable>database</replaceable> <replaceable>user</replaceable>
112112
<listitem>
113113
<para>
114114
This record matches connection attempts made using TCP/IP.
115-
Note that TCP/IP connections are disabled unless the server is
116-
started with the <option>-i</option> option or the <xref
117-
linkend="guc-tcpip-socket"> configuration parameter is
118-
enabled. <literal>host</literal> records match either
115+
<literal>host</literal> records match either
119116
<acronym>SSL</acronym> or non-<acronym>SSL</acronym> connection
120117
attempts.
121118
</para>
119+
<note>
120+
<para>
121+
Remote TCP/IP connections will not be possible unless
122+
the server is started with an appropriate value for the
123+
<xref linkend="guc-listen-addresses"> configuration parameter,
124+
since the default behavior is to listen for TCP/IP connections
125+
only on the local loopback address <literal>localhost</>.
126+
</para>
127+
</note>
122128
</listitem>
123129
</varlistentry>
124130

125131
<varlistentry>
126132
<term><literal>hostssl</literal></term>
127133
<listitem>
128134
<para>
129-
This record matches connection attempts made using TCP/IP. In
130-
addition, this record requires that the connection is made with
131-
<acronym>SSL</acronym>.
135+
This record matches connection attempts made using TCP/IP,
136+
but only when the connection is made with <acronym>SSL</acronym>
137+
encryption.
132138
</para>
133139

134140
<para>
135141
To make use of this option the server must be built with
136-
<acronym>SSL</acronym> support enabled. Furthermore,
137-
<acronym>SSL</acronym> must be enabled by setting the <xref
138-
linkend="guc-ssl"> configuration parameter (see <xref
139-
linkend="ssl-tcp"> for more information).
142+
<acronym>SSL</acronym> support. Furthermore,
143+
<acronym>SSL</acronym> must be enabled at server start time
144+
by setting the <xref linkend="guc-ssl"> configuration parameter (see
145+
<xref linkend="ssl-tcp"> for more information).
140146
</para>
141147
</listitem>
142148
</varlistentry>
@@ -146,8 +152,8 @@ hostnossl <replaceable>database</replaceable> <replaceable>user</replaceable>
146152
<listitem>
147153
<para>
148154
This record is similar to <literal>hostssl</> but with the
149-
opposite logic: it only matches connection attempts made over
150-
TCP/IP that do not use <acronym>SSL</acronym>.
155+
opposite logic: it only matches connection attempts made over
156+
TCP/IP that do not use <acronym>SSL</acronym>.
151157
</para>
152158
</listitem>
153159
</varlistentry>

doc/src/sgml/ref/postmaster.sgml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/postmaster.sgml,v 1.46 2004/03/09 16:57:47 neilc Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/postmaster.sgml,v 1.47 2004/03/23 01:23:48 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -165,11 +165,17 @@ PostgreSQL documentation
165165
<term><option>-h <replaceable class="parameter">hostname</replaceable></option></term>
166166
<listitem>
167167
<para>
168-
Specifies the IP host name or address on which the
169-
<command>postmaster</command> is to listen for
170-
connections from client applications. Defaults to
171-
listening on all configured addresses (including
172-
<systemitem class="systemname">localhost</systemitem>).
168+
Specifies the IP host name or address on which the
169+
<command>postmaster</command> is to listen for TCP/IP
170+
connections from client applications. The value can also be
171+
a space-separated list of addresses, or <literal>*</> to specify
172+
listening on all available interfaces. An empty value specifies
173+
not listening on any IP addresses, in which case only Unix-domain
174+
sockets can be used to connect to the <command>postmaster</command>.
175+
Defaults to listening only
176+
on <systemitem class="systemname">localhost</systemitem>.
177+
This option is equivalent to setting <literal>listen_addresses</> in
178+
<filename>postgresql.conf</>.
173179
</para>
174180
</listitem>
175181
</varlistentry>
@@ -178,14 +184,16 @@ PostgreSQL documentation
178184
<term><option>-i</option></term>
179185
<listitem>
180186
<para>
181-
Allows clients to connect via TCP/IP (Internet domain)
182-
connections. Without this option, only local Unix domain
183-
socket connections are accepted. This option corresponds
184-
to setting <literal>tcpip_socket=true</> in <filename>postgresql.conf</>.
187+
Allows remote clients to connect via TCP/IP (Internet domain)
188+
connections. Without this option, only local connections are
189+
accepted. This option is equivalent to setting
190+
<literal>listen_addresses</> to <literal>*</> in
191+
<filename>postgresql.conf</> or via <option>-h</>.
185192
</para>
186193
<para>
187-
<option>--tcpip-socket=false</option> has the opposite
188-
effect of this option.
194+
This option is deprecated since it does not allow access to the
195+
full functionality of <literal>listen_addresses</>. It's usually
196+
better to set <literal>listen_addresses</> directly.
189197
</para>
190198
</listitem>
191199
</varlistentry>
@@ -206,8 +214,7 @@ PostgreSQL documentation
206214
<term><option>-l</option></term>
207215
<listitem>
208216
<para>
209-
Enables secure connections using SSL. The <option>-i</option>
210-
option is also required. You must have compiled with SSL
217+
Enables secure connections using SSL. You must have compiled with SSL
211218
enabled to use this option.
212219
</para>
213220
</listitem>

doc/src/sgml/runtime.sgml

Lines changed: 36 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.251 2004/03/15 17:57:51 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.252 2004/03/23 01:23:48 tgl Exp $
33
-->
44

55
<Chapter Id="runtime">
@@ -186,11 +186,7 @@ $ <userinput>postmaster -D /usr/local/pgsql/data &gt;logfile 2&gt;&amp;1 &amp;</
186186
<para>
187187
The <command>postmaster</command> also takes a number of other
188188
command line options. For more information, see the reference page
189-
and <xref linkend="runtime-config"> below. In particular, in order
190-
for the server to accept
191-
TCP/IP<indexterm><primary>TCP/IP</primary></indexterm> connections
192-
(rather than just Unix-domain socket ones), you must specify the
193-
<option>-i</option> option.
189+
and <xref linkend="runtime-config"> below.
194190
</para>
195191

196192
<para>
@@ -333,7 +329,7 @@ FATAL: could not create TCP/IP listen socket
333329
be a different problem. For example, trying to start a <command>postmaster</command>
334330
on a reserved port number may draw something like:
335331
<screen>
336-
$ <userinput>postmaster -i -p 666</userinput>
332+
$ <userinput>postmaster -p 666</userinput>
337333
LOG: could not bind IPv4 socket: Permission denied
338334
HINT: Is another postmaster already running on port 666? If not, wait a few seconds and retry.
339335
FATAL: could not create TCP/IP listen socket
@@ -570,19 +566,38 @@ SET ENABLE_SEQSCAN TO OFF;
570566
<title>Connection Settings</title>
571567

572568
<variablelist>
573-
574-
<varlistentry id="guc-tcpip-socket" xreflabel="tcpip_socket">
575-
<term><varname>tcpip_socket</varname> (<type>boolean</type>)</term>
569+
570+
<varlistentry id="guc-listen-addresses" xreflabel="listen_addresses">
571+
<term><varname>listen_addresses</varname> (<type>string</type>)</term>
576572
<listitem>
577573
<para>
578-
If this is true, then the server will accept TCP/IP connections.<indexterm><primary>TCP/IP</></>
579-
Otherwise only local Unix domain socket connections are
580-
accepted. It is off by default. This option can only be set at
581-
server start.
574+
Specifies the TCP/IP address(es) on which the server is
575+
to listen for connections from client applications.
576+
The value takes the form of a space-separated list of host names
577+
and/or numeric IP addresses. The special entry <literal>*</>
578+
corresponds to all available IP interfaces.
579+
If the list is empty, the server does not listen on any IP interface
580+
at all, in which case only Unix-domain sockets can be used to connect
581+
to it.
582+
The default value is <systemitem class="systemname">localhost</>,
583+
which allows only local <quote>loopback</> connections to be made.
584+
This parameter can only be set at server start.
582585
</para>
583586
</listitem>
584587
</varlistentry>
585-
588+
589+
<varlistentry id="guc-port" xreflabel="port">
590+
<term><varname>port</varname> (<type>integer</type>)</term>
591+
<indexterm><primary>port</></>
592+
<listitem>
593+
<para>
594+
The TCP port the server listens on; 5432 by default. Note that the
595+
same port number is used for all IP addresses the server listens on.
596+
This parameter can only be set at server start.
597+
</para>
598+
</listitem>
599+
</varlistentry>
600+
586601
<varlistentry id="guc-max-connections" xreflabel="max_connections">
587602
<term><varname>max_connections</varname> (<type>integer</type>)</term>
588603
<listitem>
@@ -628,17 +643,6 @@ SET ENABLE_SEQSCAN TO OFF;
628643
</listitem>
629644
</varlistentry>
630645

631-
<varlistentry id="guc-port" xreflabel="port">
632-
<term><varname>port</varname> (<type>integer</type>)</term>
633-
<indexterm><primary>port</></>
634-
<listitem>
635-
<para>
636-
The TCP port the server listens on; 5432 by default. This
637-
option can only be set at server start.
638-
</para>
639-
</listitem>
640-
</varlistentry>
641-
642646

643647
<varlistentry id="guc-unix-socket-directory" xreflabel="unix_socket_directory">
644648
<term><varname>unix_socket_directory</varname> (<type>string</type>)</term>
@@ -648,6 +652,7 @@ SET ENABLE_SEQSCAN TO OFF;
648652
server is to listen for
649653
connections from client applications. The default is normally
650654
<filename>/tmp</filename>, but can be changed at build time.
655+
This parameter can only be set at server start.
651656
</para>
652657
</listitem>
653658
</varlistentry>
@@ -701,27 +706,15 @@ SET ENABLE_SEQSCAN TO OFF;
701706
</para>
702707
</listitem>
703708
</varlistentry>
704-
705-
<varlistentry id="guc-virtual-host" xreflabel="virtual_host">
706-
<term><varname>virtual_host</varname> (<type>string</type>)</term>
707-
<listitem>
708-
<para>
709-
Specifies the IP address(es) on which the server is
710-
to listen for connections from client applications. If specified,
711-
it takes the form of a space-separated list of host names and/or
712-
numeric IP addresses. If the list is empty, the server listens
713-
on all available addresses (including
714-
<systemitem class="systemname">localhost</>).
715-
</para>
716-
</listitem>
717-
</varlistentry>
718709

719710
<varlistentry id="guc-rendezvous-name" xreflabel="rendezvous_name">
720711
<term><varname>rendezvous_name</varname> (<type>string</type>)</term>
721712
<listitem>
722713
<para>
723714
Specifies the Rendezvous broadcast name. By default, the
724-
computer name is used, specified as ''.
715+
computer name is used, specified as an empty string ''.
716+
This option is only meaningful on platforms that support Rendezvous.
717+
This option can only be set at server start.
725718
</para>
726719
</listitem>
727720
</varlistentry>
@@ -3009,11 +3002,11 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
30093002
</row>
30103003
<row>
30113004
<entry><option>-h <replaceable>x</replaceable></option></entry>
3012-
<entry><literal>virtual_host = <replaceable>x</replaceable></></entry>
3005+
<entry><literal>listen_addresses = <replaceable>x</replaceable></></entry>
30133006
</row>
30143007
<row>
30153008
<entry><option>-i</option></entry>
3016-
<entry><literal>tcpip_socket = on</></entry>
3009+
<entry><literal>listen_addresses = '*'</></entry>
30173010
</row>
30183011
<row>
30193012
<entry><option>-k <replaceable>x</replaceable></option></entry>

0 commit comments

Comments
 (0)