Quantcast
Channel: Postgres initialization of pg_basebackup - Database Administrators Stack Exchange
Viewing all articles
Browse latest Browse all 2

Postgres initialization of pg_basebackup

$
0
0

Hi Im running on a centos 7 machine, Im in the process of migrating an old postgres database to the new server, it has like 10TB of data so Im trying it with pg_basebackup. The new server has an independent disk with enough storage to handle the operation, but it's not the primary disk. I would like to set the PGDATA into this big data disk.

I have followed this steps:

  1. Install postgres-12 and postgres12-contrib

  2. Mount the data-disk into the new machine

  3. Create an empty pgdata directory in the data disk. All with user postgres.

  4. Use /usr/bin/pg_basebackup -h IP_OF_OLD_MACHINE -D /mnt/disks/data-disk/pgdata -P -U USERNAME --wal-method=stream

I think pg_basebackup ended successfully, data it took several hours but finished without prompting any error at all.

total 132K-rw-------. 1 postgres postgres  230 Mar 18 12:36 backup_labeldrwx------. 7 postgres postgres 4.0K Mar 18 12:43 base-rw-------. 1 postgres postgres   30 Mar 19 00:13 current_logfilesdrwx------. 2 postgres postgres 4.0K Mar 19 00:13 globaldrwx------. 2 postgres postgres 4.0K Mar 18 12:36 logdrwx------. 2 postgres postgres 4.0K Mar 18 12:36 pg_commit_tsdrwx------. 2 postgres postgres 4.0K Mar 18 12:36 pg_dynshmem-rw-------. 1 postgres postgres 4.8K Mar 18 12:36 pg_hba.conf-rw-------. 1 postgres postgres 4.7K Mar 18 12:36 pg_hba.conf~-rw-------. 1 postgres postgres 1.6K Mar 19 00:13 pg_ident.confdrwx------. 4 postgres postgres 4.0K Mar 18 12:36 pg_logicaldrwx------. 4 postgres postgres 4.0K Mar 18 12:36 pg_multixactdrwx------. 2 postgres postgres 4.0K Mar 18 12:36 pg_notifydrwx------. 2 postgres postgres 4.0K Mar 18 12:36 pg_replslotdrwx------. 2 postgres postgres 4.0K Mar 18 12:36 pg_serialdrwx------. 2 postgres postgres 4.0K Mar 18 12:36 pg_snapshotsdrwx------. 2 postgres postgres 4.0K Mar 18 12:36 pg_statdrwx------. 2 postgres postgres 4.0K Mar 18 12:36 pg_stat_tmpdrwx------. 2 postgres postgres 4.0K Mar 18 12:36 pg_subtransdrwx------. 2 postgres postgres 4.0K Mar 18 12:36 pg_tblspcdrwx------. 2 postgres postgres 4.0K Mar 18 12:36 pg_twophase-rw-------. 1 postgres postgres    3 Mar 19 08:27 PG_VERSIONdrwx------. 3 postgres postgres 4.0K Mar 18 12:36 pg_waldrwx------. 2 postgres postgres 4.0K Mar 18 12:36 pg_xact-rw-------. 1 postgres postgres   88 Mar 18 12:36 postgresql.auto.conf-rw-------. 1 postgres postgres  24K Mar 19 08:39 postgresql.conf

Ok, now im trying to initialize a postgres server with this data, the one i've just brought.

This are my attempts, looking the documentation:

/usr/pgsql-12/bin/postgresql-12-setup initdb -D /mnt/disks/data-disk/pgdatasystemctl: invalid option -- 'D'failed to find PGDATA setting in -D.service/usr/pgsql-12/bin/postgresql-12-setup initdb --pgdata=/mnt/disks/data-disk/pgdatasystemctl: unrecognized option '--pgdata=/mnt/disks/data-disk/pgdata.service'failed to find PGDATA setting in --pgdata=/mnt/disks/data-disk/pgdata.service

Is there some mistake in the process?

Update:As @pifor told me i added the PATH to the postgres bash_profile and then started to recognize PG_DATA. The problem now is that initdb aims to find an empty folder, and its not empty due to the pg_basebackup


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images