A
A
A3a2013-05-22 08:22:08
PostgreSQL
A3a, 2013-05-22 08:22:08

What is streaming replication?

I'm not a database administrator, but yesterday I came across the term streaming replication . What is replication, I know. But what meaning is added to it by the word streaming . On the Internet, I did not find anything more or less intelligible.
I would also like to know how the concepts of "asynchronous replication" and "streaming replication" relate to each other.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
pasha_golub, 2013-05-22
@pasha_golub

wiki.postgresql.org/wiki/Streaming_Replication

T
tsabir, 2013-05-24
@tsabir

I'm no expert either, but I'll try to explain.
Streaming replication is so named as opposed to non-streaming replication. Postgres keeps a log of changes in the database (as in many other DBMS) - Write Ahead Log (WAL). WAL is needed for the D in the ACID acronym.
So this log can be used for replication. Now the question is how to implement it? It is possible to copy log files to a neighboring host, and play them there, waiting for postgres to fill and close the file (usually 16Mb) and rotate the current log file. Thus we get non-streaming replication.
But if, when writing data to the log, we simultaneously send them to a neighboring host, we will get streaming replication. It is clear that this is already happening inside the database. You can't do this at the file system level (except for DRBD, etc.)
Now let's imagine the situation: you want to close a transaction, send a SQL COMMIT command, and in response, wait for Postgres to confirm that the COMMIT was successful. If Postgres waited for the data to get into the log + also waited for the data of the current transaction to be replicated to the replica, then this is already synchronous streaming replication.
Synchronicity / asynchrony of replication of the current transaction can be specified before the start of the transaction, as far as I know, but these are already subtleties.

A
Andrey, 2013-05-22
@RedOctoberCZ

habrahabr.ru/post/173623/ :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question