public inbox for [email protected]  
help / color / mirror / Atom feed
From: arif rahman <[email protected]>
To: Tom Lane <[email protected]>
Cc: Michael Grimm <[email protected]>
Cc: [email protected]
Subject: Re: Howto tell pg_ctl to use a non-default directory for config files
Date: Thu, 4 Jun 2026 13:20:15 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>

In PostgreSQL, the configuration files do not have to live inside the data directory. You can place them elsewhere and tell PostgreSQL where to find them.

# Set postgresql.conf outside the data directory
hba_file = '/usr/local/etc/postgres/pg_hba.conf’

# pg_hba.conf
For Patroni or pg_auto_failover
Use scram-sha-256

local   all             all                     peer
host    all             all     127.0.0.1/32   scram-sha-256
host    all             all     ::1/128        scram-sha-256


Then start 
postgres -D /var/db/postgres/data \
  -c config_file=/usr/local/etc/postgres/postgresql.conf


> On Jun 4, 2026, at 1:02 PM, Tom Lane <[email protected]> wrote:
> 
> Michael Grimm <[email protected]> writes:
>> Question: 
>> Is there a way to tell PostgreSQL to look for config files in e.g. /usr/local/etc/postgres, where normally all config files reside in FreeBSD? [2]
> 
> Typically you would say "pg_ctl -D /usr/local/etc/postgres" to point
> it at the config file.  Then you would need the config file to include
> data_directory and perhaps other settings pointing to wherever the
> actual data files are.  See
> 
> https://www.postgresql.org/docs/current/runtime-config-file-locations.html
> 
> 			regards, tom lane
> 
> 







view thread (7+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Howto tell pg_ctl to use a non-default directory for config files
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox