pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedinitdb when data/ folder has mount points
9+ messages / 5 participants
[nested] [flat]
* initdb when data/ folder has mount points
@ 2018-02-21 22:38 Ron Johnson <ron.l.johnson@cox.net>
2018-02-21 23:17 ` Re: initdb when data/ folder has mount points Rich Shepard <rshepard@appl-ecosys.com>
2018-02-22 00:01 ` Re: initdb when data/ folder has mount points Tom Lane <tgl@sss.pgh.pa.us>
2018-02-22 00:18 ` Re: initdb when data/ folder has mount points Ron Johnson <ron.l.johnson@cox.net>
0 siblings, 3 replies; 9+ messages in thread
From: Ron Johnson @ 2018-02-21 22:38 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Hi,
v9.6.6
Apparently, initdb assumes that data/ is one big mount point. However, we
have four mount points:
/var/lib/pgsql/9.6/data/backup
/var/lib/pgsql/9.6/data/base
/var/lib/pgsql/9.6/data/pg_log
/var/lib/pgsql/9.6/data/pg_xlog
They are all empty. How do I convince it to ignore the fact that the
directories exist?
Thanks
--
Money Angular momentum makes the world go 'round.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: initdb when data/ folder has mount points
2018-02-21 22:38 initdb when data/ folder has mount points Ron Johnson <ron.l.johnson@cox.net>
@ 2018-02-21 23:17 ` Rich Shepard <rshepard@appl-ecosys.com>
2 siblings, 0 replies; 9+ messages in thread
From: Rich Shepard @ 2018-02-21 23:17 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
On Wed, 21 Feb 2018, Ron Johnson wrote:
> Apparently, initdb assumes that data/ is one big mount point. However, we
> have four mount points:
> /var/lib/pgsql/9.6/data/backup
> /var/lib/pgsql/9.6/data/base
> /var/lib/pgsql/9.6/data/pg_log
> /var/lib/pgsql/9.6/data/pg_xlog
Ron,
What command do you use? Here, on Slackware-14.2, /var/lib/psql/10.2/data/
contains:
PG_VERSION pg_ident.conf pg_snapshots pg_wal
base pg_logical pg_stat pg_xact
global pg_multixact pg_stat_tmp postgresql.auto.conf
pg_commit_ts pg_notify pg_subtrans postgresql.conf
pg_dynshmem pg_replslot pg_tblspc postmaster.opts
pg_hba.conf pg_serial pg_twophase postmaster.pid
The 9.6 version was the same.
The command I use (as user postgres) is:
initdb -D /var/lib/pgsql/10.2/data &
HTH,
Rich
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: initdb when data/ folder has mount points
2018-02-21 22:38 initdb when data/ folder has mount points Ron Johnson <ron.l.johnson@cox.net>
@ 2018-02-22 00:01 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-02-22 00:56 ` Re: initdb when data/ folder has mount points David Steele <david@pgmasters.net>
2 siblings, 1 reply; 9+ messages in thread
From: Tom Lane @ 2018-02-22 00:01 UTC (permalink / raw)
To: Ron Johnson <ron.l.johnson@cox.net>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Ron Johnson <ron.l.johnson@cox.net> writes:
> Apparently, initdb assumes that data/ is one big mount point. However, we
> have four mount points:
> /var/lib/pgsql/9.6/data/backup
> /var/lib/pgsql/9.6/data/base
> /var/lib/pgsql/9.6/data/pg_log
> /var/lib/pgsql/9.6/data/pg_xlog
Don't do that.
There's no reason for backup storage to be under the data directory (and
lots of good reasons for it not to be). Just put it somewhere else.
The supported way to put pg_xlog on a separate volume is to put that
mount point somewhere else, and make $PGDATA/pg_xlog be a symlink to
it. IIRC, there's an initdb option to help with that, though you can
also make it so manually after initdb.
For pg_log, just put it somewhere else and set the appropriate
configuration option to say where to write the postmaster log files.
Or you could use a symlink, like the solution for pg_xlog, but
I don't see any advantage there.
I don't see any point in making base/ be its own mount point. Once
you get rid of those other subdirectories there's not going to be
enough "global" storage left to justify its own volume.
regards, tom lane
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: initdb when data/ folder has mount points
2018-02-21 22:38 initdb when data/ folder has mount points Ron Johnson <ron.l.johnson@cox.net>
2018-02-22 00:01 ` Re: initdb when data/ folder has mount points Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-02-22 00:56 ` David Steele <david@pgmasters.net>
2018-02-22 06:16 ` Re: initdb when data/ folder has mount points Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 9+ messages in thread
From: David Steele @ 2018-02-22 00:56 UTC (permalink / raw)
To: Ron Johnson <ron.l.johnson@cox.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
On 2/21/18 7:01 PM, Tom Lane wrote:
> Ron Johnson <ron.l.johnson@cox.net> writes:
>> Apparently, initdb assumes that data/ is one big mount point. However, we
>> have four mount points:
>> /var/lib/pgsql/9.6/data/backup
>> /var/lib/pgsql/9.6/data/base
>> /var/lib/pgsql/9.6/data/pg_log
>> /var/lib/pgsql/9.6/data/pg_xlog
>
> Don't do that.
Agreed.
> There's no reason for backup storage to be under the data directory (and
> lots of good reasons for it not to be). Just put it somewhere else.
Yes -- in this configuration your backups would be backed up with every
backup. It's pretty obvious where that would go.
> The supported way to put pg_xlog on a separate volume is to put that
> mount point somewhere else, and make $PGDATA/pg_xlog be a symlink to
> it. IIRC, there's an initdb option to help with that, though you can
> also make it so manually after initdb.
initdb supports linking pg_xlog/pg_wal with the --xlogdir/--waldir option.
> For pg_log, just put it somewhere else and set the appropriate
> configuration option to say where to write the postmaster log files.
> Or you could use a symlink, like the solution for pg_xlog, but
> I don't see any advantage there.
Symlinking pg_log is not ideal because the logs end up in the backup.
It gets pretty weird when those logs get restored to a standby and
somebody starts reading them.
> I don't see any point in making base/ be its own mount point. Once
> you get rid of those other subdirectories there's not going to be
> enough "global" storage left to justify its own volume.
Agreed.
--
-David
david@pgmasters.net
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: initdb when data/ folder has mount points
2018-02-21 22:38 initdb when data/ folder has mount points Ron Johnson <ron.l.johnson@cox.net>
2018-02-22 00:01 ` Re: initdb when data/ folder has mount points Tom Lane <tgl@sss.pgh.pa.us>
2018-02-22 00:56 ` Re: initdb when data/ folder has mount points David Steele <david@pgmasters.net>
@ 2018-02-22 06:16 ` Michael Paquier <michael@paquier.xyz>
2018-02-22 13:22 ` Re: initdb when data/ folder has mount points David Steele <david@pgmasters.net>
2018-02-22 14:21 ` Re: initdb when data/ folder has mount points Ron Johnson <ron.l.johnson@cox.net>
0 siblings, 2 replies; 9+ messages in thread
From: Michael Paquier @ 2018-02-22 06:16 UTC (permalink / raw)
To: David Steele <david@pgmasters.net>; +Cc: Ron Johnson <ron.l.johnson@cox.net>; Tom Lane <tgl@sss.pgh.pa.us>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
On Wed, Feb 21, 2018 at 07:56:38PM -0500, David Steele wrote:
> On 2/21/18 7:01 PM, Tom Lane wrote:
>> For pg_log, just put it somewhere else and set the appropriate
>> configuration option to say where to write the postmaster log files.
>> Or you could use a symlink, like the solution for pg_xlog, but
>> I don't see any advantage there.
>
> Symlinking pg_log is not ideal because the logs end up in the backup. It
> gets pretty weird when those logs get restored to a standby and somebody
> starts reading them.
log_directory in postgresql.conf san be set up with an absolute
directory value. So there is no actual need for a symlink with pg_log.
This also reduces the amount of data transfered as part of base
backups without actually needing them.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: initdb when data/ folder has mount points
2018-02-21 22:38 initdb when data/ folder has mount points Ron Johnson <ron.l.johnson@cox.net>
2018-02-22 00:01 ` Re: initdb when data/ folder has mount points Tom Lane <tgl@sss.pgh.pa.us>
2018-02-22 00:56 ` Re: initdb when data/ folder has mount points David Steele <david@pgmasters.net>
2018-02-22 06:16 ` Re: initdb when data/ folder has mount points Michael Paquier <michael@paquier.xyz>
@ 2018-02-22 13:22 ` David Steele <david@pgmasters.net>
1 sibling, 0 replies; 9+ messages in thread
From: David Steele @ 2018-02-22 13:22 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: Ron Johnson <ron.l.johnson@cox.net>; Tom Lane <tgl@sss.pgh.pa.us>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
On 2/22/18 1:16 AM, Michael Paquier wrote:
> On Wed, Feb 21, 2018 at 07:56:38PM -0500, David Steele wrote:
>> On 2/21/18 7:01 PM, Tom Lane wrote:
>>> For pg_log, just put it somewhere else and set the appropriate
>>> configuration option to say where to write the postmaster log files.
>>> Or you could use a symlink, like the solution for pg_xlog, but
>>> I don't see any advantage there.
>>
>> Symlinking pg_log is not ideal because the logs end up in the backup. It
>> gets pretty weird when those logs get restored to a standby and somebody
>> starts reading them.
>
> log_directory in postgresql.conf san be set up with an absolute
> directory value. So there is no actual need for a symlink with pg_log.
> This also reduces the amount of data transfered as part of base
> backups without actually needing them.
Yes, I really should have said having pg_log in the data directory at
all is not ideal, symlinked or no.
--
-David
david@pgmasters.net
Attachments:
signature.asc (application/pgp-signature, 873B) download
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: initdb when data/ folder has mount points
2018-02-21 22:38 initdb when data/ folder has mount points Ron Johnson <ron.l.johnson@cox.net>
2018-02-22 00:01 ` Re: initdb when data/ folder has mount points Tom Lane <tgl@sss.pgh.pa.us>
2018-02-22 00:56 ` Re: initdb when data/ folder has mount points David Steele <david@pgmasters.net>
2018-02-22 06:16 ` Re: initdb when data/ folder has mount points Michael Paquier <michael@paquier.xyz>
@ 2018-02-22 14:21 ` Ron Johnson <ron.l.johnson@cox.net>
1 sibling, 0 replies; 9+ messages in thread
From: Ron Johnson @ 2018-02-22 14:21 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 02/22/2018 07:22 AM, David Steele wrote:
> On 2/22/18 1:16 AM, Michael Paquier wrote:
>> On Wed, Feb 21, 2018 at 07:56:38PM -0500, David Steele wrote:
>>> On 2/21/18 7:01 PM, Tom Lane wrote:
>>>> For pg_log, just put it somewhere else and set the appropriate
>>>> configuration option to say where to write the postmaster log files.
>>>> Or you could use a symlink, like the solution for pg_xlog, but
>>>> I don't see any advantage there.
>>> Symlinking pg_log is not ideal because the logs end up in the backup. It
>>> gets pretty weird when those logs get restored to a standby and somebody
>>> starts reading them.
>> log_directory in postgresql.conf san be set up with an absolute
>> directory value. So there is no actual need for a symlink with pg_log.
>> This also reduces the amount of data transfered as part of base
>> backups without actually needing them.
> Yes, I really should have said having pg_log in the data directory at
> all is not ideal, symlinked or no.
Is there a Best Practices wiki?
(https://wiki.postgresql.org/wiki/Detailed_installation_guides is pretty old
and thin.)
--
Money Angular momentum makes the world go 'round.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: initdb when data/ folder has mount points
2018-02-21 22:38 initdb when data/ folder has mount points Ron Johnson <ron.l.johnson@cox.net>
@ 2018-02-22 00:18 ` Ron Johnson <ron.l.johnson@cox.net>
2018-02-22 00:47 ` Re: initdb when data/ folder has mount points Tom Lane <tgl@sss.pgh.pa.us>
2 siblings, 1 reply; 9+ messages in thread
From: Ron Johnson @ 2018-02-22 00:18 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 02/21/2018 06:01 PM, Tom Lane wrote:
> Ron Johnson <ron.l.johnson@cox.net> writes:
>> Apparently, initdb assumes that data/ is one big mount point. However, we
>> have four mount points:
>> /var/lib/pgsql/9.6/data/backup
>> /var/lib/pgsql/9.6/data/base
>> /var/lib/pgsql/9.6/data/pg_log
>> /var/lib/pgsql/9.6/data/pg_xlog
> Don't do that.
>
> There's no reason for backup storage to be under the data directory (and
> lots of good reasons for it not to be). Just put it somewhere else.
>
> The supported way to put pg_xlog on a separate volume is to put that
> mount point somewhere else, and make $PGDATA/pg_xlog be a symlink to
> it. IIRC, there's an initdb option to help with that, though you can
> also make it so manually after initdb.
>
> For pg_log, just put it somewhere else and set the appropriate
> configuration option to say where to write the postmaster log files.
> Or you could use a symlink, like the solution for pg_xlog, but
> I don't see any advantage there.
>
> I don't see any point in making base/ be its own mount point. Once
> you get rid of those other subdirectories there's not going to be
> enough "global" storage left to justify its own volume.
I'm replicating the structure in our existing systems. Is there an (up to
date) Best Practices document for these kinds of issues?
--
Money Angular momentum makes the world go 'round.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: initdb when data/ folder has mount points
2018-02-21 22:38 initdb when data/ folder has mount points Ron Johnson <ron.l.johnson@cox.net>
2018-02-22 00:18 ` Re: initdb when data/ folder has mount points Ron Johnson <ron.l.johnson@cox.net>
@ 2018-02-22 00:47 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 9+ messages in thread
From: Tom Lane @ 2018-02-22 00:47 UTC (permalink / raw)
To: Ron Johnson <ron.l.johnson@cox.net>; +Cc: pgsql-general@lists.postgresql.org
Ron Johnson <ron.l.johnson@cox.net> writes:
> On 02/21/2018 06:01 PM, Tom Lane wrote:
>> Ron Johnson <ron.l.johnson@cox.net> writes:
>>> Apparently, initdb assumes that data/ is one big mount point. However, we
>>> have four mount points:
>>> /var/lib/pgsql/9.6/data/backup
>>> /var/lib/pgsql/9.6/data/base
>>> /var/lib/pgsql/9.6/data/pg_log
>>> /var/lib/pgsql/9.6/data/pg_xlog
>> Don't do that.
> I'm replicating the structure in our existing systems. Is there an (up to
> date) Best Practices document for these kinds of issues?
Well, initdb has never allowed a non-empty target (at least not in this
century). So your existing setup must have been achieved by manual
hacking post-initdb, which you could certainly do again if you're dead
set on that layout. I remain of the opinion that it's not a good
design, though.
regards, tom lane
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2018-02-22 14:21 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-02-21 22:38 initdb when data/ folder has mount points Ron Johnson <ron.l.johnson@cox.net>
2018-02-21 23:17 ` Rich Shepard <rshepard@appl-ecosys.com>
2018-02-22 00:01 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-02-22 00:56 ` David Steele <david@pgmasters.net>
2018-02-22 06:16 ` Michael Paquier <michael@paquier.xyz>
2018-02-22 13:22 ` David Steele <david@pgmasters.net>
2018-02-22 14:21 ` Ron Johnson <ron.l.johnson@cox.net>
2018-02-22 00:18 ` Ron Johnson <ron.l.johnson@cox.net>
2018-02-22 00:47 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox