Загрузка...

Day 10: PostgreSQL 18 PITR Explained | Point-in-Time Recovery #postgresql #pitr #day10

## What is PITR in PostgreSQL?

Point-in-Time Recovery (PITR) is a PostgreSQL backup and recovery technique that allows you to restore a database to an exact moment in time.

Example:

* Database crashed at 10:35 AM
* Someone accidentally deleted data at 10:20 AM
* With PITR, you can restore the database to:

* 10:19 AM → before deletion
* 10:34 AM → before crash

PITR combines:

1. Base Backup
2. WAL (Write Ahead Log) Archiving

# Core Concept of PITR

PostgreSQL continuously writes every database change into:

## WAL = Write Ahead Log

Think of WAL as:

➡️ "Database transaction history"

PITR works like this:
1. Take a full backup (Base Backup)
2. Continuously archive WAL files
3. Restore backup
4. Replay WAL files until target time

# PITR Architecture

+----------------------+
| PostgreSQL Server |
+----------------------+
|
Generates WAL
|
v
+----------------------+
| WAL Archive Location |
+----------------------+

Base Backup ----------------------------+
|
v
+------------------+
| Recovery Process |
+------------------+
|
Replay WAL until
target time

# Why PITR is Important

PITR protects against:

* Accidental DELETE
* DROP TABLE
* Data corruption
* Server crashes
* Human mistakes
* Failed deployments
* Ransomware recovery scenarios

# PITR Components

## 1. Base Backup

A full copy of the database cluster.

Created using:

pg_basebackup

## 2. WAL Archiving

PostgreSQL stores transaction logs continuously.

Enable using:

archive_mode = on
archive_command = 'cp %p /wal_archive/%f'

## 3. Recovery Process

Restore:

* Base backup
* WAL files

Then replay changes until:

* specific timestamp
* transaction ID
* named restore point

Here is the Point-in-Time Recovery (PITR) guide using Physical backup and WAL archiving in PostgreSQL 18 across two servers:
✅ Environment Setup

Role IP Address Description
----------------------------------------------------------------------
Primary 192.168.50.128 Active PostgreSQL Server before crash
Recovery 192.168.50.129 Server used to perform PITR

PostgreSQL 18
User: root
PostgreSQL user: postgres
Password: admin@123

✅ Summary
Operation Server
-----------------------------------------------
WAL Archive + Backup 192.168.50.128
PITR + Restore 192.168.50.129
--------------------------------------------------------------------
######## ⚠️ Disclaimer / अस्वीकरण ########
This video is created for educational & informational purposes only under Fair Use (Section 107, Copyright Act 1976). All trademarks and logos belong to their respective owners. No copyright infringement intended.
📩 For copyright concerns: chiragmahto@gmail.com

🌐 Follow & Support:
🎥 YouTube: https://www.youtube.com/@ChiragMahtoOfficial
📷 Instagram: https://www.instagram.com/chirag_._mahto
💼 LinkedIn: https://linkedin.com/in/chittrmahto
📘 Facebook: https://www.facebook.com/chittrmahto
💬 WhatsApp Channel: https://whatsapp.com/channel/0029VbBgm16002T93KB16U12
💬 Telegram Channel: https://t.me/+GAATbmOU4z1mMDY9

📘 Follow the process exactly as shown in the video.
💬 Questions? Drop them in the comments!

🔔 LIKE • SHARE • COMMENT • SUBSCRIBE @ChiragMahtoOfficial ❤️

💫 Chitt Ranjan Mahto (“CHIRAG”) 💫
🌍 https://chiragmahto.blogspot.com
🌍 https://chiragmahto.wordpress.com

#chiragmahtooffcial #chiragtutorial #chirag #chittranjanmahto #chiragmahto #postgresql #postgresql18 #pitr #pointintimerecovery #databasebackup #walarchiving #postgresqltutorial #postgresqladmin #sqltutorial #day10

Видео Day 10: PostgreSQL 18 PITR Explained | Point-in-Time Recovery #postgresql #pitr #day10 канала Chirag Mahto
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять