1
1
<!--
2
- $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.45 2000/12/30 15:03:09 petere Exp $
2
+ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.46 2001/01/08 21:01:54 petere Exp $
3
3
-->
4
4
5
5
<Chapter Id="runtime">
@@ -1536,7 +1536,8 @@ options "SEMMNU=120"
1536
1536
1537
1537
1538
1538
<varlistentry>
1539
- <term>FreeBSD</>
1539
+ <term>FreeBSD</term>
1540
+ <term>OpenBSD</term>
1540
1541
<listitem>
1541
1542
<para>
1542
1543
The options <varname>SYSVSHM</> and <varname>SYSVSEM</> need
@@ -1545,14 +1546,14 @@ options "SEMMNU=120"
1545
1546
the option <varname>SHMMAXPGS</> (in pages). The following
1546
1547
shows an example of how to set the various parameters:
1547
1548
<programlisting>
1548
- options SYSVSHM
1549
- options SHMMAXPGS=4096
1550
- options SHMSEG=256
1551
-
1552
- options SYSVSEM
1553
- options SEMMNI=256
1554
- options SEMMNS=512
1555
- options SEMMNU=256
1549
+ options SYSVSHM
1550
+ options SHMMAXPGS=4096
1551
+ options SHMSEG=256
1552
+
1553
+ options SYSVSEM
1554
+ options SEMMNI=256
1555
+ options SEMMNS=512
1556
+ options SEMMNU=256
1556
1557
options SEMMAP=256
1557
1558
</programlisting>
1558
1559
</para>
@@ -1711,24 +1712,82 @@ set semsys:seminfo_semmsl=32
1711
1712
1712
1713
</variablelist>
1713
1714
1714
- <note>
1715
- <para>
1716
- If your platform is not listed here, please consider
1717
- contributing some information.
1718
- </para>
1719
- </note>
1720
1715
</para>
1721
1716
</sect2>
1722
1717
1723
- <!--
1724
- Other fun things to write about one day:
1725
- * number of processes per user and system-wide (soft/hard limit)
1726
- * open files/inodes per user and system-wide (soft/hard limit)
1727
- (Think about this both ways: Increasing it to allow Postgres to
1728
- open more files, and decreasing it to prevent Postgres from taking
1729
- up all file descriptors.)
1730
- * stack and data segment size, plain-old memory limit
1731
- -->
1718
+
1719
+ <sect2>
1720
+ <title>Resource Limits</title>
1721
+
1722
+ <para>
1723
+ Unix-like operating systems enforce various kinds of resource
1724
+ limits that might interfere with the operation of your
1725
+ <productname>Postgres</productname> server. Of importance are
1726
+ especially the limits on the number of processes per user, the
1727
+ number of open files per process, and the amount of memory
1728
+ available to a process. Each of these have a <quote>hard</quote>
1729
+ and a <quote>soft</quote> limit. The soft limit is what actually
1730
+ counts but it can be changed by the user up to the hard limit.
1731
+ The hard limit can only be changed by the root user. The system
1732
+ call <function>setrlimit</function> is responsible for setting
1733
+ these parameters. The shell the built-in command
1734
+ <command>ulimit</command> (Bourne shells) or
1735
+ <command>limit</command> (csh) is used to control the resource
1736
+ limits from the command line. On BSD-derived systems the file
1737
+ <filename>/etc/login.conf</filename> controls what values the
1738
+ various resource limits are set to upon login. See
1739
+ <citerefentry><refentrytitle>login.conf</refentrytitle>
1740
+ <manvolnum>5</manvolnum></citerefentry> for details. The relevant
1741
+ parameters are <varname>maxproc</varname>,
1742
+ <varname>openfiles</varname>, and <varname>datasize</varname>.
1743
+ For example:
1744
+ <programlisting>
1745
+ default:\
1746
+ ...
1747
+ :datasize-cur=256M:\
1748
+ :maxproc-cur=256:\
1749
+ :openfiles-cur=256:\
1750
+ ...
1751
+ </programlisting>
1752
+ (<literal>-cur</literal> is the soft limit. Append
1753
+ <literal>-max</literal> to set the hard limit.)
1754
+ </para>
1755
+
1756
+ <para>
1757
+ Kernels generally also have an implementation-dependent
1758
+ system-wide limit on some resources.
1759
+ <simplelist>
1760
+ <member>
1761
+ On <productname>Linux</productname>
1762
+ <filename>/proc/sys/fs/file-max</filename> determines the
1763
+ maximum number of files that the kernel will allocate. It can
1764
+ be changed by writing a different number into the file or by
1765
+ adding an assignment in <filename>/etc/sysctl.conf</filename>.
1766
+ The maximum limit of files per process is fixed at the time the
1767
+ kernel is compiled; see
1768
+ <filename>/usr/src/linux/Documentation/proc.txt</filename> for
1769
+ more information.
1770
+ </member>
1771
+ </simplelist>
1772
+ </para>
1773
+
1774
+ <para>
1775
+ The <productname>Postgres</productname> server uses one process
1776
+ per connection so you should provide for at least as many processes
1777
+ as allowed connections, in addition to what you need for the rest
1778
+ of your system. This is usually not a problem but if you run
1779
+ several servers on one machine things might get tight.
1780
+ </para>
1781
+
1782
+ <para>
1783
+ The factory default limit on open files is often set to
1784
+ <quote>socially friendly</quote> values that allow many users to
1785
+ coexist on a machine without using an inappropriate fraction of
1786
+ the system resources. If you run many servers on a machine this
1787
+ is perhaps what you want, but on dedicated servers you may want to
1788
+ raise this limit.
1789
+ </para>
1790
+ </sect2>
1732
1791
1733
1792
</sect1>
1734
1793
@@ -1819,19 +1878,18 @@ set semsys:seminfo_semmsl=32
1819
1878
can be started with the argument <option>-l</> (ell) to enable
1820
1879
SSL connections. When starting in SSL mode, the postmaster will look
1821
1880
for the files <filename>server.key</> and <filename>server.crt</> in
1822
- the data directory (pointed to by <envar>PGDATA</envar>).
1823
- These files should contain the server private key
1881
+ the data directory. These files should contain the server private key
1824
1882
and certificate respectively. These files must be set up correctly
1825
1883
before an SSL-enabled server can start. If the private key is protected
1826
1884
with a passphrase, the postmaster will prompt for the passphrase and will
1827
- not start until it has been provided .
1885
+ not start until it has been entered .
1828
1886
</para>
1829
1887
1830
1888
<para>
1831
1889
The postmaster will listen for both standard and SSL connections
1832
1890
on the same TCP/IP port, and will negotiate with any connecting
1833
1891
client whether or not to use SSL.
1834
- See <xref linkend="client-authentication">
1892
+ See <xref linkend="client-authentication">
1835
1893
about how to force on the server side the use of SSL for certain
1836
1894
connections.
1837
1895
</para>
@@ -1843,27 +1901,27 @@ set semsys:seminfo_semmsl=32
1843
1901
by a CA (either one of the global CAs or a local one) should be used in
1844
1902
production so the client can verify the servers identity. To create
1845
1903
a quick self-signed certificate, use the following OpenSSL command:
1846
- <programlisting>
1847
- openssl req -new -text -out cert.req
1848
- </programlisting>
1904
+ <programlisting>
1905
+ openssl req -new -text -out cert.req
1906
+ </programlisting>
1849
1907
Fill out the information that openssl asks for. Make sure that you enter
1850
1908
the local host name as Common Name; the challenge password can be
1851
- left blank. The script will generate a key that is passphrase protected;
1852
- it will not accept a pass phrase that is less than four characters long.
1853
- To remove the passphrase (as you must if you want automatic start-up of
1854
- the postmaster), run the commands
1855
- <programlisting>
1856
- mv privkey.pem cert.pem.pw
1857
- openssl rsa -in cert.pem.pw -out cert.pem
1858
- </programlisting>
1909
+ left blank. The script will generate a key that is passphrase protected;
1910
+ it will not accept a pass phrase that is less than four characters long.
1911
+ To remove the passphrase (as you must if you want automatic start-up of
1912
+ the postmaster), run the commands
1913
+ <programlisting>
1914
+ mv privkey.pem cert.pem.pw
1915
+ openssl rsa -in cert.pem.pw -out cert.pem
1916
+ </programlisting>
1859
1917
Enter the old passphrase to unlock the existing key. Now do
1860
- <programlisting>
1861
- openssl req -x509 -in cert.req -text -key cert.pem -out cert.cert
1862
- cp cert.pem $PGDATA/server.key
1863
- cp cert.cert $PGDATA/server.crt
1864
- </programlisting>
1918
+ <programlisting>
1919
+ openssl req -x509 -in cert.req -text -key cert.pem -out cert.cert
1920
+ cp cert.pem <replaceable> $PGDATA</replaceable> /server.key
1921
+ cp cert.cert <replaceable> $PGDATA</replaceable> /server.crt
1922
+ </programlisting>
1865
1923
to turn the certificate into a self-signed certificate and to copy the
1866
- key and certificate to where the postmaster will look for them.
1924
+ key and certificate to where the postmaster will look for them.
1867
1925
</para>
1868
1926
</sect1>
1869
1927
0 commit comments