codekingpro/portable-devtools
114k
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>20.2. File Locations</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="config-setting.html" title="20.1. Setting Parameters" /><link rel="next" href="runtime-config-connection.html" title="20.3. Connections and Authentication" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">20.2. File Locations</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="config-setting.html" title="20.1. Setting Parameters">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="runtime-config.html" title="Chapter 20. Server Configuration">Up</a></td><th width="60%" align="center">Chapter 20. Server Configuration</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="runtime-config-connection.html" title="20.3. Connections and Authentication">Next</a></td></tr></table><hr /></div><div class="sect1" id="RUNTIME-CONFIG-FILE-LOCATIONS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">20.2. File Locations <a href="#RUNTIME-CONFIG-FILE-LOCATIONS" class="id_link">#</a></h2></div></div></div><p>3 In addition to the <code class="filename">postgresql.conf</code> file4 already mentioned, <span class="productname">PostgreSQL</span> uses5 two other manually-edited configuration files, which control6 client authentication (their use is discussed in <a class="xref" href="client-authentication.html" title="Chapter 21. Client Authentication">Chapter 21</a>). By default, all three7 configuration files are stored in the database cluster's data8 directory. The parameters described in this section allow the9 configuration files to be placed elsewhere. (Doing so can ease10 administration. In particular it is often easier to ensure that11 the configuration files are properly backed-up when they are12 kept separate.)13 </p><div class="variablelist"><dl class="variablelist"><dt id="GUC-DATA-DIRECTORY"><span class="term"><code class="varname">data_directory</code> (<code class="type">string</code>)14 <a id="id-1.6.7.5.3.1.1.3" class="indexterm"></a>15 </span> <a href="#GUC-DATA-DIRECTORY" class="id_link">#</a></dt><dd><p>16 Specifies the directory to use for data storage.17 This parameter can only be set at server start.18 </p></dd><dt id="GUC-CONFIG-FILE"><span class="term"><code class="varname">config_file</code> (<code class="type">string</code>)19 <a id="id-1.6.7.5.3.2.1.3" class="indexterm"></a>20 </span> <a href="#GUC-CONFIG-FILE" class="id_link">#</a></dt><dd><p>21 Specifies the main server configuration file22 (customarily called <code class="filename">postgresql.conf</code>).23 This parameter can only be set on the <code class="command">postgres</code> command line.24 </p></dd><dt id="GUC-HBA-FILE"><span class="term"><code class="varname">hba_file</code> (<code class="type">string</code>)25 <a id="id-1.6.7.5.3.3.1.3" class="indexterm"></a>26 </span> <a href="#GUC-HBA-FILE" class="id_link">#</a></dt><dd><p>27 Specifies the configuration file for host-based authentication28 (customarily called <code class="filename">pg_hba.conf</code>).29 This parameter can only be set at server start.30 </p></dd><dt id="GUC-IDENT-FILE"><span class="term"><code class="varname">ident_file</code> (<code class="type">string</code>)31 <a id="id-1.6.7.5.3.4.1.3" class="indexterm"></a>32 </span> <a href="#GUC-IDENT-FILE" class="id_link">#</a></dt><dd><p>33 Specifies the configuration file for user name mapping34 (customarily called <code class="filename">pg_ident.conf</code>).35 This parameter can only be set at server start.36 See also <a class="xref" href="auth-username-maps.html" title="21.2. User Name Maps">Section 21.2</a>.37 </p></dd><dt id="GUC-EXTERNAL-PID-FILE"><span class="term"><code class="varname">external_pid_file</code> (<code class="type">string</code>)38 <a id="id-1.6.7.5.3.5.1.3" class="indexterm"></a>39 </span> <a href="#GUC-EXTERNAL-PID-FILE" class="id_link">#</a></dt><dd><p>40 Specifies the name of an additional process-ID (PID) file that the41 server should create for use by server administration programs.42 This parameter can only be set at server start.43 </p></dd></dl></div><p>44 In a default installation, none of the above parameters are set45 explicitly. Instead, the46 data directory is specified by the <code class="option">-D</code> command-line47 option or the <code class="envar">PGDATA</code> environment variable, and the48 configuration files are all found within the data directory.49 </p><p>50 If you wish to keep the configuration files elsewhere than the51 data directory, the <code class="command">postgres</code> <code class="option">-D</code>52 command-line option or <code class="envar">PGDATA</code> environment variable53 must point to the directory containing the configuration files,54 and the <code class="varname">data_directory</code> parameter must be set in55 <code class="filename">postgresql.conf</code> (or on the command line) to show56 where the data directory is actually located. Notice that57 <code class="varname">data_directory</code> overrides <code class="option">-D</code> and58 <code class="envar">PGDATA</code> for the location59 of the data directory, but not for the location of the configuration60 files.61 </p><p>62 If you wish, you can specify the configuration file names and locations63 individually using the parameters <code class="varname">config_file</code>,64 <code class="varname">hba_file</code> and/or <code class="varname">ident_file</code>.65 <code class="varname">config_file</code> can only be specified on the66 <code class="command">postgres</code> command line, but the others can be67 set within the main configuration file. If all three parameters plus68 <code class="varname">data_directory</code> are explicitly set, then it is not necessary69 to specify <code class="option">-D</code> or <code class="envar">PGDATA</code>.70 </p><p>71 When setting any of these parameters, a relative path will be interpreted72 with respect to the directory in which <code class="command">postgres</code>73 is started.74 </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="config-setting.html" title="20.1. Setting Parameters">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="runtime-config.html" title="Chapter 20. Server Configuration">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="runtime-config-connection.html" title="20.3. Connections and Authentication">Next</a></td></tr><tr><td width="40%" align="left" valign="top">20.1. Setting Parameters </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 20.3. Connections and Authentication</td></tr></table></div></body></html>