SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
The Magic of Hot
Streaming Replication
BRUCE MOMJIAN,
ENTERPRISEDB
October, 2010
Abstract
POSTGRESQL 9.0 offers new facilities for maintaining a current
standby server and for issuing read-only queries on the standby
server. This tutorial covers these new facilities.
Creative Commons Attribution License http://momjian.us/presentations
Introduction
 
How does WAL combined with a disk image enable standby servers?
(review)
 
How do you configure continuous archiving?
 
How do you configure a streaming, read-only server?
 
Multi-Server complexities
 
Primary/Standby synchronization complexities
The Magic of Hot Streaming Replication 2
Write-Ahead Logging (xlog)
fsync
fsync
Backend
Postgres
Backend
Postgres
Backend
Postgres
PostgreSQL Shared Buffer Cache Write−Ahead Log
Kernel Disk Buffer Cache
Disk Blocks
The Magic of Hot Streaming Replication 3
Pre-9.0 Continuous Archiving /
Point-In-Time Recovery (PITR)0200
1100
0900
1300
W
AL
W
ALWAL
ContinuousFile System−
Level Backup Archive (WAL)
The Magic of Hot Streaming Replication 4
PITR Backup Procedures
1. archive_command = ’cp -i %p /mnt/server/pgsql/%f < /dev/null’
2. SELECT pg_start_backup(’label’);
3. Perform file system-level backup (can be inconsistent)
4. SELECT pg_stop_backup();
The Magic of Hot Streaming Replication 5
PITR Recovery
W
AL
W
AL
1700
1730
1740
1755
WAL
ContinuousFile System−
Level Backup Archive (WAL)
The Magic of Hot Streaming Replication 6
PITR Recovery Procedures
1. Stop postmaster
2. Restore file system-level backup
3. Make adjustments as outlined in the documentation
4. Create recovery.conf
5. restore_command = ’cp /mnt/server/pgsql/%f %p’
6. Start the postmaster
The Magic of Hot Streaming Replication 7
Disadvantages
 
Only complete 16MB files can be shipped
 
archive_timeout can be used to force more frequent shipping (this
increases archive storage requirements)
 
No queries on the standby
The Magic of Hot Streaming Replication 8
9.0 Streaming Replication / Hot Standby
 
Changes are streamed to the standby, greatly reducing log shipping
delays
 
Standby can accept read-only queries
The Magic of Hot Streaming Replication 9
Streaming Replication Differs from PITR
 
File system backup is restored immediately on the standby server
 
WAL files are streamed to the slave
 
WAL files can also be archived if point-in-time recovery (PITR) is
desired
The Magic of Hot Streaming Replication 10
How Does Streaming Replication Work?
0200
1100
0900
1300
W
AL
W
ALWAL
File System−
Level Backup Server
Standby
The Magic of Hot Streaming Replication 11
Live Streaming Replication
archive
command
archive
command
Primary Standby
Network
/pg_xlog/pg_xlog
Archive
Directory
WAL
The Magic of Hot Streaming Replication 12
Enable Streaming to the Standby
Enable the proper WAL contents:
wal_level = hot_standby
Retain WAL files needed by the standby:
wal_keep_segments = 50
Enable the ability to stream WAL to the standby:
max_wal_senders = 1
The Magic of Hot Streaming Replication 13
Enable Standby Connection Permissions
Add permission for replication to pg_hba.conf:
host replication all 127.0.0.1/32 trust
Start the primary server:
pg_ctl -l /u/pg/data/server.log start
The Magic of Hot Streaming Replication 14
Perform a WAL-Supported File System Backup
Start psql and issue:
SELECT pg_start_backup(’testing’);
Copy the database /u/pg/data to a new directory, /u/pg/data2:
cp -p -R /u/pg/data /u/pg/data2
Dash-p preserves ownership. The copy is inconsistent, but that is okay
(WAL replay will correct that).
Signal the backup is complete from psql:
SELECT pg_stop_backup();
The Magic of Hot Streaming Replication 15
Configure the Standby
Remove /data2/postmaster.pid so the standby server does not see the
primary server’s pid as its own:
rm /u/pg/data2/postmaster.pid
(This is only necessary because we are testing with the primary and slave
on the same computer.)
Edit postgresql.conf on the standby and change the port to 5433
port = 5433
Enable hot standby in postgresql.conf:
hot_standby = on
The Magic of Hot Streaming Replication 16
Configure the Standby For Streaming Replication
Create recovery.conf:
cp /u/pg/share/recovery.conf.sample /u/pg/data2/recovery.conf
Enable streaming in recovery.conf:
standby_mode = ’on’
primary_conninfo = ’host=localhost port=5432’
Start the standby server:
PGDATA=/u/pg/data2 pg_ctl -l /u/pg/data2/server.log start
The Magic of Hot Streaming Replication 17
Test Streaming Replication and Hot Standby
$ psql -p 5432 -c ’CREATE TABLE streamtest(x int)’ postgres
$ psql -p 5433 -c ’d’ postgres
List of relations
Schema | Name | Type | Owner
--------+------------+-------+----------
public | streamtest | table | postgres
(1 row)
$ psql -p 5432 -c ’INSERT INTO streamtest VALUES (1)’ postgres
INSERT 0 1
$ psql -p 5433 -c ’INSERT INTO streamtest VALUES (1)’ postgres
ERROR: cannot execute INSERT in a read-only transaction
The Magic of Hot Streaming Replication 18
Additional Complexities
 
Multi-server permissions
 
Stream from /pg_xlog and the continuous archive directory if
archive_mode is enabled on the primary
The Magic of Hot Streaming Replication 19
Primary/Standby Synchronization Issues
The primary server can take actions that cause long-running queries on
the standby to be cancelled. Specifically, the cleanup of unnecessary
rows that are still of interest to long-running queries on the standby can
cause long-running queries to be cancelled on the standby. Standby
query cancellation can be minimized in two ways:
1. Delay cleanup of old records on the primary with
vacuum_defer_cleanup_age in postgresql.conf.
2. Delay application of WAL logs on the standby with max_standby_delay
in postgresql.conf. The default is 30 seconds; -1 causes application to
delay indefinitely to prevent query cancellation. This also delays
changes from appearing on the standby and can lengthen the time
required for failover to the slave.
The Magic of Hot Streaming Replication 20
Conclusion
http://momjian.us/presentations Manet, Bar at Folies Bergère
The Magic of Hot Streaming Replication 21

Más contenido relacionado

La actualidad más candente

Postgres-BDR with Google Cloud Platform
Postgres-BDR with Google Cloud PlatformPostgres-BDR with Google Cloud Platform
Postgres-BDR with Google Cloud PlatformSungJae Yun
 
MySQL replication & cluster
MySQL replication & clusterMySQL replication & cluster
MySQL replication & clusterelliando dias
 
Python, Keras, Hello world, Installation, Binary Classification
Python, Keras, Hello world, Installation, Binary ClassificationPython, Keras, Hello world, Installation, Binary Classification
Python, Keras, Hello world, Installation, Binary ClassificationHamed Shah-Hosseini
 
1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera cluster1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera clusterOlinData
 
Schema replication using oracle golden gate 12c
Schema replication using oracle golden gate 12cSchema replication using oracle golden gate 12c
Schema replication using oracle golden gate 12cuzzal basak
 
Training Slides: Basics 105: Backup, Recovery and Provisioning Within Tungste...
Training Slides: Basics 105: Backup, Recovery and Provisioning Within Tungste...Training Slides: Basics 105: Backup, Recovery and Provisioning Within Tungste...
Training Slides: Basics 105: Backup, Recovery and Provisioning Within Tungste...Continuent
 
Hmc installation .
Hmc installation . Hmc installation .
Hmc installation . Ksd Che
 
Out of the Box Replication in Postgres 9.4(pgconfsf)
Out of the Box Replication in Postgres 9.4(pgconfsf)Out of the Box Replication in Postgres 9.4(pgconfsf)
Out of the Box Replication in Postgres 9.4(pgconfsf)Denish Patel
 
TOROS: Python Framework for Recommender System
TOROS: Python Framework for Recommender SystemTOROS: Python Framework for Recommender System
TOROS: Python Framework for Recommender SystemKwangseob Kim
 
Kernel Recipes 2015: Introduction to Kernel Power Management
Kernel Recipes 2015: Introduction to Kernel Power ManagementKernel Recipes 2015: Introduction to Kernel Power Management
Kernel Recipes 2015: Introduction to Kernel Power ManagementAnne Nicolas
 
Troubleshooting PostgreSQL with pgCenter
Troubleshooting PostgreSQL with pgCenterTroubleshooting PostgreSQL with pgCenter
Troubleshooting PostgreSQL with pgCenterAlexey Lesovsky
 
How To Protect SSH Access with Fail2Ban on RHEL 7
How To Protect SSH Access with Fail2Ban on RHEL 7How To Protect SSH Access with Fail2Ban on RHEL 7
How To Protect SSH Access with Fail2Ban on RHEL 7VCP Muthukrishna
 
nouka inventry manager
nouka inventry managernouka inventry manager
nouka inventry managerToshiaki Baba
 
(PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application fo...
(PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application fo...(PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application fo...
(PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application fo...Amazon Web Services
 
How to Upgrade Openfire on CentOS 7
How to Upgrade Openfire on CentOS 7How to Upgrade Openfire on CentOS 7
How to Upgrade Openfire on CentOS 7VCP Muthukrishna
 
agri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertoragri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertorToshiaki Baba
 
Velocity 2017 Performance analysis superpowers with Linux eBPF
Velocity 2017 Performance analysis superpowers with Linux eBPFVelocity 2017 Performance analysis superpowers with Linux eBPF
Velocity 2017 Performance analysis superpowers with Linux eBPFBrendan Gregg
 
Running hadoop on ubuntu linux
Running hadoop on ubuntu linuxRunning hadoop on ubuntu linux
Running hadoop on ubuntu linuxTRCK
 

La actualidad más candente (20)

Postgres-BDR with Google Cloud Platform
Postgres-BDR with Google Cloud PlatformPostgres-BDR with Google Cloud Platform
Postgres-BDR with Google Cloud Platform
 
MySQL replication & cluster
MySQL replication & clusterMySQL replication & cluster
MySQL replication & cluster
 
Python, Keras, Hello world, Installation, Binary Classification
Python, Keras, Hello world, Installation, Binary ClassificationPython, Keras, Hello world, Installation, Binary Classification
Python, Keras, Hello world, Installation, Binary Classification
 
1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera cluster1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera cluster
 
Schema replication using oracle golden gate 12c
Schema replication using oracle golden gate 12cSchema replication using oracle golden gate 12c
Schema replication using oracle golden gate 12c
 
Training Slides: Basics 105: Backup, Recovery and Provisioning Within Tungste...
Training Slides: Basics 105: Backup, Recovery and Provisioning Within Tungste...Training Slides: Basics 105: Backup, Recovery and Provisioning Within Tungste...
Training Slides: Basics 105: Backup, Recovery and Provisioning Within Tungste...
 
Hmc installation .
Hmc installation . Hmc installation .
Hmc installation .
 
Dev ops
Dev opsDev ops
Dev ops
 
Out of the Box Replication in Postgres 9.4(pgconfsf)
Out of the Box Replication in Postgres 9.4(pgconfsf)Out of the Box Replication in Postgres 9.4(pgconfsf)
Out of the Box Replication in Postgres 9.4(pgconfsf)
 
TOROS: Python Framework for Recommender System
TOROS: Python Framework for Recommender SystemTOROS: Python Framework for Recommender System
TOROS: Python Framework for Recommender System
 
Kernel Recipes 2015: Introduction to Kernel Power Management
Kernel Recipes 2015: Introduction to Kernel Power ManagementKernel Recipes 2015: Introduction to Kernel Power Management
Kernel Recipes 2015: Introduction to Kernel Power Management
 
Troubleshooting PostgreSQL with pgCenter
Troubleshooting PostgreSQL with pgCenterTroubleshooting PostgreSQL with pgCenter
Troubleshooting PostgreSQL with pgCenter
 
How To Protect SSH Access with Fail2Ban on RHEL 7
How To Protect SSH Access with Fail2Ban on RHEL 7How To Protect SSH Access with Fail2Ban on RHEL 7
How To Protect SSH Access with Fail2Ban on RHEL 7
 
nouka inventry manager
nouka inventry managernouka inventry manager
nouka inventry manager
 
(PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application fo...
(PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application fo...(PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application fo...
(PFC303) Milliseconds Matter: Design, Deploy, and Operate Your Application fo...
 
How to Upgrade Openfire on CentOS 7
How to Upgrade Openfire on CentOS 7How to Upgrade Openfire on CentOS 7
How to Upgrade Openfire on CentOS 7
 
agri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertoragri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertor
 
PostgreSQL Replication with Bucardo
PostgreSQL Replication with BucardoPostgreSQL Replication with Bucardo
PostgreSQL Replication with Bucardo
 
Velocity 2017 Performance analysis superpowers with Linux eBPF
Velocity 2017 Performance analysis superpowers with Linux eBPFVelocity 2017 Performance analysis superpowers with Linux eBPF
Velocity 2017 Performance analysis superpowers with Linux eBPF
 
Running hadoop on ubuntu linux
Running hadoop on ubuntu linuxRunning hadoop on ubuntu linux
Running hadoop on ubuntu linux
 

Similar a The Magic of Hot Streaming Replication, Bruce Momjian

Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...Command Prompt., Inc
 
The Magic of Hot Streaming Replication (Bruce Momjian)
The Magic of Hot Streaming Replication (Bruce Momjian)The Magic of Hot Streaming Replication (Bruce Momjian)
The Magic of Hot Streaming Replication (Bruce Momjian)Ontico
 
Built-in-Physical-and-Logical-Replication-in-Postgresql-Firat-Gulec.pptx
Built-in-Physical-and-Logical-Replication-in-Postgresql-Firat-Gulec.pptxBuilt-in-Physical-and-Logical-Replication-in-Postgresql-Firat-Gulec.pptx
Built-in-Physical-and-Logical-Replication-in-Postgresql-Firat-Gulec.pptxnadirpervez2
 
Built in physical and logical replication in postgresql-Firat Gulec
Built in physical and logical replication in postgresql-Firat GulecBuilt in physical and logical replication in postgresql-Firat Gulec
Built in physical and logical replication in postgresql-Firat GulecFIRAT GULEC
 
Streaming replication in practice
Streaming replication in practiceStreaming replication in practice
Streaming replication in practiceAlexey Lesovsky
 
Out of the Box Replication in Postgres 9.4(PgConfUS)
Out of the Box Replication in Postgres 9.4(PgConfUS)Out of the Box Replication in Postgres 9.4(PgConfUS)
Out of the Box Replication in Postgres 9.4(PgConfUS)Denish Patel
 
Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)Denish Patel
 
Salesforce at Stacki Atlanta Meetup February 2016
Salesforce at Stacki Atlanta Meetup February 2016Salesforce at Stacki Atlanta Meetup February 2016
Salesforce at Stacki Atlanta Meetup February 2016StackIQ
 
How to Replicate PostgreSQL Database
How to Replicate PostgreSQL DatabaseHow to Replicate PostgreSQL Database
How to Replicate PostgreSQL DatabaseSangJin Kang
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Denish Patel
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Denish Patel
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Denish Patel
 
2011 384 hackworth_ppt
2011 384 hackworth_ppt2011 384 hackworth_ppt
2011 384 hackworth_pptmaclean liu
 
Adventures in Dataguard
Adventures in DataguardAdventures in Dataguard
Adventures in DataguardJason Arneil
 
Data Guard New Features
Data Guard New FeaturesData Guard New Features
Data Guard New Featuresxiangrong
 
Streaming Replication Made Easy in v9.3
Streaming Replication Made Easy in v9.3Streaming Replication Made Easy in v9.3
Streaming Replication Made Easy in v9.3Sameer Kumar
 

Similar a The Magic of Hot Streaming Replication, Bruce Momjian (20)

Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
 
The Magic of Hot Streaming Replication (Bruce Momjian)
The Magic of Hot Streaming Replication (Bruce Momjian)The Magic of Hot Streaming Replication (Bruce Momjian)
The Magic of Hot Streaming Replication (Bruce Momjian)
 
Built-in-Physical-and-Logical-Replication-in-Postgresql-Firat-Gulec.pptx
Built-in-Physical-and-Logical-Replication-in-Postgresql-Firat-Gulec.pptxBuilt-in-Physical-and-Logical-Replication-in-Postgresql-Firat-Gulec.pptx
Built-in-Physical-and-Logical-Replication-in-Postgresql-Firat-Gulec.pptx
 
Built in physical and logical replication in postgresql-Firat Gulec
Built in physical and logical replication in postgresql-Firat GulecBuilt in physical and logical replication in postgresql-Firat Gulec
Built in physical and logical replication in postgresql-Firat Gulec
 
Streaming replication in practice
Streaming replication in practiceStreaming replication in practice
Streaming replication in practice
 
Physical_Standby_Database_R12.2.4
Physical_Standby_Database_R12.2.4Physical_Standby_Database_R12.2.4
Physical_Standby_Database_R12.2.4
 
Out of the Box Replication in Postgres 9.4(PgConfUS)
Out of the Box Replication in Postgres 9.4(PgConfUS)Out of the Box Replication in Postgres 9.4(PgConfUS)
Out of the Box Replication in Postgres 9.4(PgConfUS)
 
Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)
 
Oracle Data Guard
Oracle Data GuardOracle Data Guard
Oracle Data Guard
 
Salesforce at Stacki Atlanta Meetup February 2016
Salesforce at Stacki Atlanta Meetup February 2016Salesforce at Stacki Atlanta Meetup February 2016
Salesforce at Stacki Atlanta Meetup February 2016
 
How to Replicate PostgreSQL Database
How to Replicate PostgreSQL DatabaseHow to Replicate PostgreSQL Database
How to Replicate PostgreSQL Database
 
PostgreSQL : Introduction
PostgreSQL : IntroductionPostgreSQL : Introduction
PostgreSQL : Introduction
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4
 
2011 384 hackworth_ppt
2011 384 hackworth_ppt2011 384 hackworth_ppt
2011 384 hackworth_ppt
 
Adventures in Dataguard
Adventures in DataguardAdventures in Dataguard
Adventures in Dataguard
 
Data Guard New Features
Data Guard New FeaturesData Guard New Features
Data Guard New Features
 
Streaming Replication Made Easy in v9.3
Streaming Replication Made Easy in v9.3Streaming Replication Made Easy in v9.3
Streaming Replication Made Easy in v9.3
 
Stacki - The1600+ Server Journey
Stacki - The1600+ Server JourneyStacki - The1600+ Server Journey
Stacki - The1600+ Server Journey
 

Más de Fuenteovejuna

Facebook, Robert Johnson
Facebook, Robert JohnsonFacebook, Robert Johnson
Facebook, Robert JohnsonFuenteovejuna
 
Интеграция открытых технологий и взаимодействие со сторонними проектами в усл...
Интеграция открытых технологий и взаимодействие со сторонними проектами в усл...Интеграция открытых технологий и взаимодействие со сторонними проектами в усл...
Интеграция открытых технологий и взаимодействие со сторонними проектами в усл...Fuenteovejuna
 
Shared Personalization Service - How To Scale to 15K RPS, Patrice Pelland
Shared Personalization Service - How To Scale to 15K RPS, Patrice PellandShared Personalization Service - How To Scale to 15K RPS, Patrice Pelland
Shared Personalization Service - How To Scale to 15K RPS, Patrice PellandFuenteovejuna
 
Оптимизация одного из топовых приложений для социальной сети ВКонтакте: 1000 ...
Оптимизация одного из топовых приложений для социальной сети ВКонтакте: 1000 ...Оптимизация одного из топовых приложений для социальной сети ВКонтакте: 1000 ...
Оптимизация одного из топовых приложений для социальной сети ВКонтакте: 1000 ...Fuenteovejuna
 
Практическое создание крупного масштабируемого web 20 c нуля, Дмитрий Бородин
Практическое создание крупного масштабируемого web 20 c нуля, Дмитрий БородинПрактическое создание крупного масштабируемого web 20 c нуля, Дмитрий Бородин
Практическое создание крупного масштабируемого web 20 c нуля, Дмитрий БородинFuenteovejuna
 
Social Monitoring Tool codename Looking Glass, Patrice Pelland
Social Monitoring Tool codename Looking Glass, Patrice PellandSocial Monitoring Tool codename Looking Glass, Patrice Pelland
Social Monitoring Tool codename Looking Glass, Patrice PellandFuenteovejuna
 
Профилирование памяти в приложениях на Python, Антон Грицай
Профилирование памяти в приложениях на Python, Антон ГрицайПрофилирование памяти в приложениях на Python, Антон Грицай
Профилирование памяти в приложениях на Python, Антон ГрицайFuenteovejuna
 
Компиляция скриптов PHP. Алексей Романенко
Компиляция скриптов PHP. Алексей РоманенкоКомпиляция скриптов PHP. Алексей Романенко
Компиляция скриптов PHP. Алексей РоманенкоFuenteovejuna
 
Сервер-агрегатор на python (аля Xscript FEST), Сумин Андрей, Сабуренков Михаи...
Сервер-агрегатор на python (аля Xscript FEST), Сумин Андрей, Сабуренков Михаи...Сервер-агрегатор на python (аля Xscript FEST), Сумин Андрей, Сабуренков Михаи...
Сервер-агрегатор на python (аля Xscript FEST), Сумин Андрей, Сабуренков Михаи...Fuenteovejuna
 
Использование 0MQ для построения low latency распределёных систем, Андрей Охл...
Использование 0MQ для построения low latency распределёных систем, Андрей Охл...Использование 0MQ для построения low latency распределёных систем, Андрей Охл...
Использование 0MQ для построения low latency распределёных систем, Андрей Охл...Fuenteovejuna
 
Некоторые аспекты влияния сходимости протокола BGP на доступность сетевых рес...
Некоторые аспекты влияния сходимости протокола BGP на доступность сетевых рес...Некоторые аспекты влияния сходимости протокола BGP на доступность сетевых рес...
Некоторые аспекты влияния сходимости протокола BGP на доступность сетевых рес...Fuenteovejuna
 
Тандемные DDoS-атаки. Проблематика уязвимостей в спецификации TCP IP (фундаме...
Тандемные DDoS-атаки. Проблематика уязвимостей в спецификации TCP IP (фундаме...Тандемные DDoS-атаки. Проблематика уязвимостей в спецификации TCP IP (фундаме...
Тандемные DDoS-атаки. Проблематика уязвимостей в спецификации TCP IP (фундаме...Fuenteovejuna
 
Динамика DDoS-атак в России, Александр Лямин
Динамика DDoS-атак в России, Александр ЛяминДинамика DDoS-атак в России, Александр Лямин
Динамика DDoS-атак в России, Александр ЛяминFuenteovejuna
 
Быстрое развёртывание шаблонов и статики в Mail.ru, Николай Кондратов
Быстрое развёртывание шаблонов и статики в Mail.ru, Николай КондратовБыстрое развёртывание шаблонов и статики в Mail.ru, Николай Кондратов
Быстрое развёртывание шаблонов и статики в Mail.ru, Николай КондратовFuenteovejuna
 
Extreme Cloud Storage on FreeBSD, Андрей Пантюхин
Extreme Cloud Storage on FreeBSD, Андрей ПантюхинExtreme Cloud Storage on FreeBSD, Андрей Пантюхин
Extreme Cloud Storage on FreeBSD, Андрей ПантюхинFuenteovejuna
 
Мониторинг XXI-век, Алиса Смирнова, Дима Никоненко
Мониторинг XXI-век, Алиса Смирнова, Дима НиконенкоМониторинг XXI-век, Алиса Смирнова, Дима Никоненко
Мониторинг XXI-век, Алиса Смирнова, Дима НиконенкоFuenteovejuna
 
Native Client, Евгений Эльцин
Native Client, Евгений ЭльцинNative Client, Евгений Эльцин
Native Client, Евгений ЭльцинFuenteovejuna
 
Tarantool Silverbox, Юрий Востриков
Tarantool Silverbox, Юрий ВостриковTarantool Silverbox, Юрий Востриков
Tarantool Silverbox, Юрий ВостриковFuenteovejuna
 
Real time indexes in Sphinx, Yaroslav Vorozhko
Real time indexes in Sphinx, Yaroslav VorozhkoReal time indexes in Sphinx, Yaroslav Vorozhko
Real time indexes in Sphinx, Yaroslav VorozhkoFuenteovejuna
 
Sphinx для высоко-нагруженных и масштабируемых проектов, Вячеслав Крюков
Sphinx для высоко-нагруженных и масштабируемых проектов, Вячеслав КрюковSphinx для высоко-нагруженных и масштабируемых проектов, Вячеслав Крюков
Sphinx для высоко-нагруженных и масштабируемых проектов, Вячеслав КрюковFuenteovejuna
 

Más de Fuenteovejuna (20)

Facebook, Robert Johnson
Facebook, Robert JohnsonFacebook, Robert Johnson
Facebook, Robert Johnson
 
Интеграция открытых технологий и взаимодействие со сторонними проектами в усл...
Интеграция открытых технологий и взаимодействие со сторонними проектами в усл...Интеграция открытых технологий и взаимодействие со сторонними проектами в усл...
Интеграция открытых технологий и взаимодействие со сторонними проектами в усл...
 
Shared Personalization Service - How To Scale to 15K RPS, Patrice Pelland
Shared Personalization Service - How To Scale to 15K RPS, Patrice PellandShared Personalization Service - How To Scale to 15K RPS, Patrice Pelland
Shared Personalization Service - How To Scale to 15K RPS, Patrice Pelland
 
Оптимизация одного из топовых приложений для социальной сети ВКонтакте: 1000 ...
Оптимизация одного из топовых приложений для социальной сети ВКонтакте: 1000 ...Оптимизация одного из топовых приложений для социальной сети ВКонтакте: 1000 ...
Оптимизация одного из топовых приложений для социальной сети ВКонтакте: 1000 ...
 
Практическое создание крупного масштабируемого web 20 c нуля, Дмитрий Бородин
Практическое создание крупного масштабируемого web 20 c нуля, Дмитрий БородинПрактическое создание крупного масштабируемого web 20 c нуля, Дмитрий Бородин
Практическое создание крупного масштабируемого web 20 c нуля, Дмитрий Бородин
 
Social Monitoring Tool codename Looking Glass, Patrice Pelland
Social Monitoring Tool codename Looking Glass, Patrice PellandSocial Monitoring Tool codename Looking Glass, Patrice Pelland
Social Monitoring Tool codename Looking Glass, Patrice Pelland
 
Профилирование памяти в приложениях на Python, Антон Грицай
Профилирование памяти в приложениях на Python, Антон ГрицайПрофилирование памяти в приложениях на Python, Антон Грицай
Профилирование памяти в приложениях на Python, Антон Грицай
 
Компиляция скриптов PHP. Алексей Романенко
Компиляция скриптов PHP. Алексей РоманенкоКомпиляция скриптов PHP. Алексей Романенко
Компиляция скриптов PHP. Алексей Романенко
 
Сервер-агрегатор на python (аля Xscript FEST), Сумин Андрей, Сабуренков Михаи...
Сервер-агрегатор на python (аля Xscript FEST), Сумин Андрей, Сабуренков Михаи...Сервер-агрегатор на python (аля Xscript FEST), Сумин Андрей, Сабуренков Михаи...
Сервер-агрегатор на python (аля Xscript FEST), Сумин Андрей, Сабуренков Михаи...
 
Использование 0MQ для построения low latency распределёных систем, Андрей Охл...
Использование 0MQ для построения low latency распределёных систем, Андрей Охл...Использование 0MQ для построения low latency распределёных систем, Андрей Охл...
Использование 0MQ для построения low latency распределёных систем, Андрей Охл...
 
Некоторые аспекты влияния сходимости протокола BGP на доступность сетевых рес...
Некоторые аспекты влияния сходимости протокола BGP на доступность сетевых рес...Некоторые аспекты влияния сходимости протокола BGP на доступность сетевых рес...
Некоторые аспекты влияния сходимости протокола BGP на доступность сетевых рес...
 
Тандемные DDoS-атаки. Проблематика уязвимостей в спецификации TCP IP (фундаме...
Тандемные DDoS-атаки. Проблематика уязвимостей в спецификации TCP IP (фундаме...Тандемные DDoS-атаки. Проблематика уязвимостей в спецификации TCP IP (фундаме...
Тандемные DDoS-атаки. Проблематика уязвимостей в спецификации TCP IP (фундаме...
 
Динамика DDoS-атак в России, Александр Лямин
Динамика DDoS-атак в России, Александр ЛяминДинамика DDoS-атак в России, Александр Лямин
Динамика DDoS-атак в России, Александр Лямин
 
Быстрое развёртывание шаблонов и статики в Mail.ru, Николай Кондратов
Быстрое развёртывание шаблонов и статики в Mail.ru, Николай КондратовБыстрое развёртывание шаблонов и статики в Mail.ru, Николай Кондратов
Быстрое развёртывание шаблонов и статики в Mail.ru, Николай Кондратов
 
Extreme Cloud Storage on FreeBSD, Андрей Пантюхин
Extreme Cloud Storage on FreeBSD, Андрей ПантюхинExtreme Cloud Storage on FreeBSD, Андрей Пантюхин
Extreme Cloud Storage on FreeBSD, Андрей Пантюхин
 
Мониторинг XXI-век, Алиса Смирнова, Дима Никоненко
Мониторинг XXI-век, Алиса Смирнова, Дима НиконенкоМониторинг XXI-век, Алиса Смирнова, Дима Никоненко
Мониторинг XXI-век, Алиса Смирнова, Дима Никоненко
 
Native Client, Евгений Эльцин
Native Client, Евгений ЭльцинNative Client, Евгений Эльцин
Native Client, Евгений Эльцин
 
Tarantool Silverbox, Юрий Востриков
Tarantool Silverbox, Юрий ВостриковTarantool Silverbox, Юрий Востриков
Tarantool Silverbox, Юрий Востриков
 
Real time indexes in Sphinx, Yaroslav Vorozhko
Real time indexes in Sphinx, Yaroslav VorozhkoReal time indexes in Sphinx, Yaroslav Vorozhko
Real time indexes in Sphinx, Yaroslav Vorozhko
 
Sphinx для высоко-нагруженных и масштабируемых проектов, Вячеслав Крюков
Sphinx для высоко-нагруженных и масштабируемых проектов, Вячеслав КрюковSphinx для высоко-нагруженных и масштабируемых проектов, Вячеслав Крюков
Sphinx для высоко-нагруженных и масштабируемых проектов, Вячеслав Крюков
 

Último

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Último (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

The Magic of Hot Streaming Replication, Bruce Momjian

  • 1. The Magic of Hot Streaming Replication BRUCE MOMJIAN, ENTERPRISEDB October, 2010 Abstract POSTGRESQL 9.0 offers new facilities for maintaining a current standby server and for issuing read-only queries on the standby server. This tutorial covers these new facilities. Creative Commons Attribution License http://momjian.us/presentations
  • 2. Introduction   How does WAL combined with a disk image enable standby servers? (review)   How do you configure continuous archiving?   How do you configure a streaming, read-only server?   Multi-Server complexities   Primary/Standby synchronization complexities The Magic of Hot Streaming Replication 2
  • 3. Write-Ahead Logging (xlog) fsync fsync Backend Postgres Backend Postgres Backend Postgres PostgreSQL Shared Buffer Cache Write−Ahead Log Kernel Disk Buffer Cache Disk Blocks The Magic of Hot Streaming Replication 3
  • 4. Pre-9.0 Continuous Archiving / Point-In-Time Recovery (PITR)0200 1100 0900 1300 W AL W ALWAL ContinuousFile System− Level Backup Archive (WAL) The Magic of Hot Streaming Replication 4
  • 5. PITR Backup Procedures 1. archive_command = ’cp -i %p /mnt/server/pgsql/%f < /dev/null’ 2. SELECT pg_start_backup(’label’); 3. Perform file system-level backup (can be inconsistent) 4. SELECT pg_stop_backup(); The Magic of Hot Streaming Replication 5
  • 6. PITR Recovery W AL W AL 1700 1730 1740 1755 WAL ContinuousFile System− Level Backup Archive (WAL) The Magic of Hot Streaming Replication 6
  • 7. PITR Recovery Procedures 1. Stop postmaster 2. Restore file system-level backup 3. Make adjustments as outlined in the documentation 4. Create recovery.conf 5. restore_command = ’cp /mnt/server/pgsql/%f %p’ 6. Start the postmaster The Magic of Hot Streaming Replication 7
  • 8. Disadvantages   Only complete 16MB files can be shipped   archive_timeout can be used to force more frequent shipping (this increases archive storage requirements)   No queries on the standby The Magic of Hot Streaming Replication 8
  • 9. 9.0 Streaming Replication / Hot Standby   Changes are streamed to the standby, greatly reducing log shipping delays   Standby can accept read-only queries The Magic of Hot Streaming Replication 9
  • 10. Streaming Replication Differs from PITR   File system backup is restored immediately on the standby server   WAL files are streamed to the slave   WAL files can also be archived if point-in-time recovery (PITR) is desired The Magic of Hot Streaming Replication 10
  • 11. How Does Streaming Replication Work? 0200 1100 0900 1300 W AL W ALWAL File System− Level Backup Server Standby The Magic of Hot Streaming Replication 11
  • 12. Live Streaming Replication archive command archive command Primary Standby Network /pg_xlog/pg_xlog Archive Directory WAL The Magic of Hot Streaming Replication 12
  • 13. Enable Streaming to the Standby Enable the proper WAL contents: wal_level = hot_standby Retain WAL files needed by the standby: wal_keep_segments = 50 Enable the ability to stream WAL to the standby: max_wal_senders = 1 The Magic of Hot Streaming Replication 13
  • 14. Enable Standby Connection Permissions Add permission for replication to pg_hba.conf: host replication all 127.0.0.1/32 trust Start the primary server: pg_ctl -l /u/pg/data/server.log start The Magic of Hot Streaming Replication 14
  • 15. Perform a WAL-Supported File System Backup Start psql and issue: SELECT pg_start_backup(’testing’); Copy the database /u/pg/data to a new directory, /u/pg/data2: cp -p -R /u/pg/data /u/pg/data2 Dash-p preserves ownership. The copy is inconsistent, but that is okay (WAL replay will correct that). Signal the backup is complete from psql: SELECT pg_stop_backup(); The Magic of Hot Streaming Replication 15
  • 16. Configure the Standby Remove /data2/postmaster.pid so the standby server does not see the primary server’s pid as its own: rm /u/pg/data2/postmaster.pid (This is only necessary because we are testing with the primary and slave on the same computer.) Edit postgresql.conf on the standby and change the port to 5433 port = 5433 Enable hot standby in postgresql.conf: hot_standby = on The Magic of Hot Streaming Replication 16
  • 17. Configure the Standby For Streaming Replication Create recovery.conf: cp /u/pg/share/recovery.conf.sample /u/pg/data2/recovery.conf Enable streaming in recovery.conf: standby_mode = ’on’ primary_conninfo = ’host=localhost port=5432’ Start the standby server: PGDATA=/u/pg/data2 pg_ctl -l /u/pg/data2/server.log start The Magic of Hot Streaming Replication 17
  • 18. Test Streaming Replication and Hot Standby $ psql -p 5432 -c ’CREATE TABLE streamtest(x int)’ postgres $ psql -p 5433 -c ’d’ postgres List of relations Schema | Name | Type | Owner --------+------------+-------+---------- public | streamtest | table | postgres (1 row) $ psql -p 5432 -c ’INSERT INTO streamtest VALUES (1)’ postgres INSERT 0 1 $ psql -p 5433 -c ’INSERT INTO streamtest VALUES (1)’ postgres ERROR: cannot execute INSERT in a read-only transaction The Magic of Hot Streaming Replication 18
  • 19. Additional Complexities   Multi-server permissions   Stream from /pg_xlog and the continuous archive directory if archive_mode is enabled on the primary The Magic of Hot Streaming Replication 19
  • 20. Primary/Standby Synchronization Issues The primary server can take actions that cause long-running queries on the standby to be cancelled. Specifically, the cleanup of unnecessary rows that are still of interest to long-running queries on the standby can cause long-running queries to be cancelled on the standby. Standby query cancellation can be minimized in two ways: 1. Delay cleanup of old records on the primary with vacuum_defer_cleanup_age in postgresql.conf. 2. Delay application of WAL logs on the standby with max_standby_delay in postgresql.conf. The default is 30 seconds; -1 causes application to delay indefinitely to prevent query cancellation. This also delays changes from appearing on the standby and can lengthen the time required for failover to the slave. The Magic of Hot Streaming Replication 20
  • 21. Conclusion http://momjian.us/presentations Manet, Bar at Folies Bergère The Magic of Hot Streaming Replication 21