pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedReplicating an existing (huge) database
3+ messages / 3 participants
[nested] [flat]
* Replicating an existing (huge) database
@ 2022-11-28 10:17 Srinivasa T N <seenutn@gmail.com>
0 siblings, 2 replies; 3+ messages in thread
From: Srinivasa T N @ 2022-11-28 10:17 UTC (permalink / raw)
To: PostgreSQL General <pgsql-general@lists.postgresql.org>
Hi All,
I am using postgresql 12. As part of streaming replication setup, I run
pg_basebackup on the slave which copies the database from master to slave.
But the database is huge and it takes around 2 to 3 days for the
pg_basebackup to finish. When pg_basebackup is running, a huge number of
wal files are generated on the master which occupies a lot of space (even
though it is for 2-3 days, disk space is low). Is there any other way to
start replication without using pg_baseback?
Regards,
Seenu.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Replicating an existing (huge) database
@ 2022-11-28 10:24 Laurenz Albe <laurenz.albe@cybertec.at>
parent: Srinivasa T N <seenutn@gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: Laurenz Albe @ 2022-11-28 10:24 UTC (permalink / raw)
To: Srinivasa T N <seenutn@gmail.com>; PostgreSQL General <pgsql-general@lists.postgresql.org>
On Mon, 2022-11-28 at 15:47 +0530, Srinivasa T N wrote:
> I am using postgresql 12. As part of streaming replication setup, I run pg_basebackup
> on the slave which copies the database from master to slave. But the database is huge
> and it takes around 2 to 3 days for the pg_basebackup to finish. When pg_basebackup
> is running, a huge number of wal files are generated on the master which occupies a lot
> of space (even though it is for 2-3 days, disk space is low).
> Is there any other way to start replication without using pg_baseback?
There is the "low level backup API" (pg_start_backup() and pg_stop_backup()) that
allows you to copy the data yourself, for example with storage snapshots, which
can be much faster. The essential process is like with pg_basebackup, but you
can use more efficient methods to copy the data.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Replicating an existing (huge) database
@ 2022-11-28 10:28 Torsten Förtsch <tfoertsch123@gmail.com>
parent: Srinivasa T N <seenutn@gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: Torsten Förtsch @ 2022-11-28 10:28 UTC (permalink / raw)
To: Srinivasa T N <seenutn@gmail.com>; +Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>
You can set up wal archiving and set restore_command before you start the
replica. Then you can use pg_basebackup with `-Xnone --no-slot`.
Alternatively or in combination, use a quicker backup as Laurenz explained.
On Mon, Nov 28, 2022 at 11:17 AM Srinivasa T N <seenutn@gmail.com> wrote:
> Hi All,
> I am using postgresql 12. As part of streaming replication setup, I
> run pg_basebackup on the slave which copies the database from master to
> slave. But the database is huge and it takes around 2 to 3 days for the
> pg_basebackup to finish. When pg_basebackup is running, a huge number of
> wal files are generated on the master which occupies a lot of space (even
> though it is for 2-3 days, disk space is low). Is there any other way to
> start replication without using pg_baseback?
>
> Regards,
> Seenu.
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2022-11-28 10:28 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-11-28 10:17 Replicating an existing (huge) database Srinivasa T N <seenutn@gmail.com>
2022-11-28 10:24 ` Laurenz Albe <laurenz.albe@cybertec.at>
2022-11-28 10:28 ` Torsten Förtsch <tfoertsch123@gmail.com>
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