How to take pg_basebackup in PostgreSQL - Examples
How to take pg_baseback ?
1) Created directory in /backup location
2) Changed the ownership of the directory
3) Took the backup in that particular /backup location
[root@rac7 ~]# cd /backup
[root@rac7 backup]# mkdir postgre_backup
[root@rac7 backup]# chown postgres:postgres postgre_backup/
[root@rac7 backup]# su - postgres
Last login: Mon Jan 22 18:53:13 IST 2024 from 192.168.1.102 on pts/6
-bash-4.2$
-bash-4.2$
-bash-4.2$ cd /backup
-bash-4.2$ cd 15_cluster_db1_bkp/
-bash-4.2$ pwd
/backup/postgre_backup/15_cluster_db1_bkp
Run the below command to take base backup :=
-bash-4.2$
-bash-4.2$ /usr/pgsql-15/bin/pg_basebackup -p 5455 -D /backup/postgre_backup/15_cluster_db1_bkp
Below files we are created in the backup location:-
-bash-4.2$ cd /backup/postgre_backup/15_cluster_db1_bkp
-bash-4.2$ ls -lrt
total 272
drwx------ 2 postgres postgres 4096 Jan 22 19:14 pg_stat_tmp
drwx------ 2 postgres postgres 4096 Jan 22 19:14 pg_snapshots
drwx------ 2 postgres postgres 4096 Jan 22 19:14 pg_dynshmem
drwx------ 2 postgres postgres 4096 Jan 22 19:14 log
-rw------- 1 postgres postgres 225 Jan 22 19:14 backup_label
drwx------ 3 postgres postgres 4096 Jan 22 19:14 pg_wal
-rw------- 1 postgres postgres 261 Jan 22 19:14 postgresql.auto.conf
-rw------- 1 postgres postgres 3 Jan 22 19:14 PG_VERSION
drwx------ 2 postgres postgres 4096 Jan 22 19:14 pg_tblspc
drwx------ 2 postgres postgres 4096 Jan 22 19:14 pg_serial
-rw------- 1 postgres postgres 1636 Jan 22 19:14 pg_ident.conf
-rw------- 1 postgres postgres 4789 Jan 22 19:14 pg_hba.conf
-rw------- 1 postgres postgres 374 Jan 22 19:14 logfile
drwx------ 5 postgres postgres 4096 Jan 22 19:14 base
drwx------ 2 postgres postgres 4096 Jan 22 19:14 pg_xact
drwx------ 2 postgres postgres 4096 Jan 22 19:14 pg_twophase
drwx------ 2 postgres postgres 4096 Jan 22 19:14 pg_replslot
drwx------ 2 postgres postgres 4096 Jan 22 19:14 pg_subtrans
drwx------ 2 postgres postgres 4096 Jan 22 19:14 pg_stat
drwx------ 2 postgres postgres 4096 Jan 22 19:14 pg_notify
drwx------ 4 postgres postgres 4096 Jan 22 19:14 pg_logical
drwx------ 2 postgres postgres 4096 Jan 22 19:14 pg_commit_ts
drwx------ 4 postgres postgres 4096 Jan 22 19:14 pg_multixact
-rw------- 1 postgres postgres 29457 Jan 22 19:14 postgresql.conf
drwx------ 2 postgres postgres 4096 Jan 22 19:14 global
-rw------- 1 postgres postgres 30 Jan 22 19:14 current_logfiles
-rw------- 1 postgres postgres 137625 Jan 22 19:14 backup_manifest
-bash-4.2$
No comments:
Post a Comment