public inbox for [email protected]
help / color / mirror / Atom feedHowto tell pg_ctl to use a non-default directory for config files
7+ messages / 4 participants
[nested] [flat]
* Howto tell pg_ctl to use a non-default directory for config files
@ 2026-06-04 19:54 Michael Grimm <[email protected]>
2026-06-04 20:02 ` Re: Howto tell pg_ctl to use a non-default directory for config files Tom Lane <[email protected]>
0 siblings, 1 reply; 7+ messages in thread
From: Michael Grimm @ 2026-06-04 19:54 UTC (permalink / raw)
To: [email protected]
Hi,
FYI: I am pretty new to PostgreSQL, and I am intending to migrate from an MariaDB/Galera cluster to PostgreSQL with either Patroni or pg_auto_failover. And, I have successfully tested a stand-alone database with my client of interest [1], both running inside a FreeBSD jail.
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]
Thanks and regards,
Michael
[1] https://dbmail.org
[2] As an intermediate solution I am using soft links from $PGDATA to /usr/local/etc/postgres
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Howto tell pg_ctl to use a non-default directory for config files
2026-06-04 19:54 Howto tell pg_ctl to use a non-default directory for config files Michael Grimm <[email protected]>
@ 2026-06-04 20:02 ` Tom Lane <[email protected]>
2026-06-04 20:08 ` Re: Howto tell pg_ctl to use a non-default directory for config files Michael Grimm <[email protected]>
2026-06-04 20:09 ` Re: Howto tell pg_ctl to use a non-default directory for config files Ron Johnson <[email protected]>
2026-06-04 20:20 ` Re: Howto tell pg_ctl to use a non-default directory for config files arif rahman <[email protected]>
0 siblings, 3 replies; 7+ messages in thread
From: Tom Lane @ 2026-06-04 20:02 UTC (permalink / raw)
To: Michael Grimm <[email protected]>; +Cc: [email protected]
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
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Howto tell pg_ctl to use a non-default directory for config files
2026-06-04 19:54 Howto tell pg_ctl to use a non-default directory for config files Michael Grimm <[email protected]>
2026-06-04 20:02 ` Re: Howto tell pg_ctl to use a non-default directory for config files Tom Lane <[email protected]>
@ 2026-06-04 20:08 ` Michael Grimm <[email protected]>
2 siblings, 0 replies; 7+ messages in thread
From: Michael Grimm @ 2026-06-04 20:08 UTC (permalink / raw)
To: [email protected]
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
Ah! That's what I failed to find in the documentation :-(
Thanks and regards,
Michael
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Howto tell pg_ctl to use a non-default directory for config files
2026-06-04 19:54 Howto tell pg_ctl to use a non-default directory for config files Michael Grimm <[email protected]>
2026-06-04 20:02 ` Re: Howto tell pg_ctl to use a non-default directory for config files Tom Lane <[email protected]>
@ 2026-06-04 20:09 ` Ron Johnson <[email protected]>
2026-06-04 20:15 ` Re: Howto tell pg_ctl to use a non-default directory for config files Tom Lane <[email protected]>
2 siblings, 1 reply; 7+ messages in thread
From: Ron Johnson @ 2026-06-04 20:09 UTC (permalink / raw)
To: Pgsql-admin <[email protected]>
On Thu, Jun 4, 2026 at 4: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.
>
Is it standard to point PGDATA to an etc directory instead of to the "data"
directory?
--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Howto tell pg_ctl to use a non-default directory for config files
2026-06-04 19:54 Howto tell pg_ctl to use a non-default directory for config files Michael Grimm <[email protected]>
2026-06-04 20:02 ` Re: Howto tell pg_ctl to use a non-default directory for config files Tom Lane <[email protected]>
2026-06-04 20:09 ` Re: Howto tell pg_ctl to use a non-default directory for config files Ron Johnson <[email protected]>
@ 2026-06-04 20:15 ` Tom Lane <[email protected]>
0 siblings, 0 replies; 7+ messages in thread
From: Tom Lane @ 2026-06-04 20:15 UTC (permalink / raw)
To: Ron Johnson <[email protected]>; +Cc: Pgsql-admin <[email protected]>
Ron Johnson <[email protected]> writes:
> On Thu, Jun 4, 2026 at 4:02 PM Tom Lane <[email protected]> wrote:
>> 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.
> Is it standard to point PGDATA to an etc directory instead of to the "data"
> directory?
It is if you want the server's configuration files to be separate from
the data.
regards, tom lane
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Howto tell pg_ctl to use a non-default directory for config files
2026-06-04 19:54 Howto tell pg_ctl to use a non-default directory for config files Michael Grimm <[email protected]>
2026-06-04 20:02 ` Re: Howto tell pg_ctl to use a non-default directory for config files Tom Lane <[email protected]>
@ 2026-06-04 20:20 ` arif rahman <[email protected]>
2026-06-12 20:59 ` Re: Howto tell pg_ctl to use a non-default directory for config files Michael Grimm <[email protected]>
2 siblings, 1 reply; 7+ messages in thread
From: arif rahman @ 2026-06-04 20:20 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Michael Grimm <[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
>
>
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Howto tell pg_ctl to use a non-default directory for config files
2026-06-04 19:54 Howto tell pg_ctl to use a non-default directory for config files Michael Grimm <[email protected]>
2026-06-04 20:02 ` Re: Howto tell pg_ctl to use a non-default directory for config files Tom Lane <[email protected]>
2026-06-04 20:20 ` Re: Howto tell pg_ctl to use a non-default directory for config files arif rahman <[email protected]>
@ 2026-06-12 20:59 ` Michael Grimm <[email protected]>
0 siblings, 0 replies; 7+ messages in thread
From: Michael Grimm @ 2026-06-12 20:59 UTC (permalink / raw)
To: [email protected]
arif rahman <[email protected]> wrote:
> 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’
>
> Then start
> postgres -D /var/db/postgres/data \
> -c config_file=/usr/local/etc/postgres/postgresql.conf
JFTR: that worked perfectly well.
But, I moved on to use pg_auto_failover which is very picky w.r.t. to the location of config files. Thus I will have to become used to keep config files where ever expected by the given service … shrug.
Thanks for your working setup and regards,
Michael
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2026-06-12 20:59 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-06-04 19:54 Howto tell pg_ctl to use a non-default directory for config files Michael Grimm <[email protected]>
2026-06-04 20:02 ` Tom Lane <[email protected]>
2026-06-04 20:08 ` Michael Grimm <[email protected]>
2026-06-04 20:09 ` Ron Johnson <[email protected]>
2026-06-04 20:15 ` Tom Lane <[email protected]>
2026-06-04 20:20 ` arif rahman <[email protected]>
2026-06-12 20:59 ` Michael Grimm <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox