PostgreSQL Streaming Replication

  Рет қаралды 64,891

Scaling Postgres

Scaling Postgres

Күн бұрын

To get the commands used in this tutorial, visit: www.scalingpostgres.com/tutor....
Learn how to setup a replica of your PostgreSQL database. This replica will stream changes from the primary database cluster and supports read-only queries. This replica can also be promoted to be the new primary database. We show you each of these features in this tutorial.
Want to learn more about Postgres performance?
Join my FREE mini-course called the PostgreSQL Performance Starter Kit here: www.scalingpostgres.com/cours...

Пікірлер: 43
@ronsearch
@ronsearch 4 жыл бұрын
Your explanations are clear and pragmatic. Thanks so much for sharing your knowledge.
@terryburton0
@terryburton0 4 жыл бұрын
Small correction. At 15:30 you mention that standby_mode allows read-only connections to a host that is in recovery, which is in fact the purview of the separate, global hot_standby setting. What standby_mode really does is to cause the replica to continue to replicate changes on the master once it has caught up - essentially to be an ongoing replica rather than perform a one-shot catch up.
@ghostpup4323
@ghostpup4323 3 жыл бұрын
Hi, some small comments. in the primary_conninfo line between "host" and "/ var / run / postgresql" there must be a "=" sign (The error is in the documentation, which is in the description). A small note for lamers (like me) who want to apply this instruction to version 12 of postgres. The recovery.conf file is no longer available in version 12. Settings from it are transferred to replica`s postgresql.conf (everything except standby_mode). And also you need to check for an empty (before starting replication) file "/var/lib/postgresql/12/replica/standby.signal" The rest of the guide is cool
@jermainemaragh
@jermainemaragh 5 жыл бұрын
Thanks very much!
@kakarnyori5457
@kakarnyori5457 6 жыл бұрын
Hi! I was just looking for a nice tutorial on PostgreSQL replication, and this video was very informative, and so I subscribed! Thank you! Could you also please make a video tutorial on replication between separate servers (master on different server and slave on another) and logical streaming replication, please. And please keep up the good work.
@Murga_Mutton
@Murga_Mutton 4 жыл бұрын
Yes that would be indeed helpful. I'm looking for a way to make my UAT server a slave of the production database.
@nikkipandey5491
@nikkipandey5491 2 жыл бұрын
Hey Kakar, did you get how data will be replicate on different server?…if you know..please help me now. It’s urgent.
@frikabg
@frikabg 2 жыл бұрын
5:51 if you follow the instructions that you have posted on the link in your description the commands: sudo -H -u postgres mkdir /var/lib/postgresql/pg_log_archive/main -p are without -p at the end which makes them invalid (at least for me). I hope this helps someone. Also notice that in the vid the example given is with replica while in the link it is REPLICA1.
@vimsen2221
@vimsen2221 4 жыл бұрын
Please Ignore my earlier comment. I set the password. This is an excellent tutorial.
@gulledhaydar
@gulledhaydar 2 жыл бұрын
I have spent a couple of hours troubleshooting the recovery.conf file you used in your example. I did not know that it had been replaced with the recovery.signal file from v12 of postgresql.
@swadeshmondal6662
@swadeshmondal6662 4 жыл бұрын
thank you very much
@suend
@suend 5 жыл бұрын
When using pg_basebackup to copy to replica folder, it gave me error saying /data2/space2 folder exists but not empty. This folder is used for a tablespace in the main database. If I drop the tablespace and the command will have no issue. How can I create replica if I have tablespaces defined in the main instance? Thanks!
@jaspindersingh6154
@jaspindersingh6154 3 жыл бұрын
Is there a way to automatically delete archives on Master Server as it keeps on storing data and filling up my HD?
@papachoudhary5482
@papachoudhary5482 5 жыл бұрын
Thanks
@coolheart999
@coolheart999 6 жыл бұрын
can u demo streaming replication using barman tool ?
@chjanardhanreddy2124
@chjanardhanreddy2124 4 жыл бұрын
Hi Creston, That was clear and crystal. I am just looking for Cluster set up for Postgresql like an oracle . When Master went down Slave become active and act as Master, Like Same when Master comes up does the Transaction will come back to the Main Master node or Transactions will go to Slave(Acting like Master) node only please confirm. Thanks in Advance.
@gotmb851
@gotmb851 4 жыл бұрын
This tutorial, is it using streaming replication + log shipping?
@1487atul
@1487atul Жыл бұрын
how archive file are getting copied in "/pg_log_archive/replica/" directory because in postgresql.conf file for main cluster I can't see the archive command for this path ? please tell me.
@andersonmillroad3426
@andersonmillroad3426 3 жыл бұрын
Hi, Great Tutorial. I have a slight different requirements. I want to streaming backup server but only for specific databases. Is that possible?
@professortrog7742
@professortrog7742 2 жыл бұрын
Yes, with logical replication.
@jamesyu7007
@jamesyu7007 4 жыл бұрын
I wanted to try this with my Postgres v11. But I couldn't find the pg_lsclusters command under the bin folder. Am I missing some package to install? What RPM installs those pg cluster commands?
@Mladenac
@Mladenac 3 жыл бұрын
It is ubuntu specific, he said it in the presentation
@malymohsem285
@malymohsem285 2 жыл бұрын
Is streaming replication active/active replication?
@Mladenac
@Mladenac 3 жыл бұрын
pg_lsclusters works on Debian 10 with pg 13 installed
@markshay4886
@markshay4886 4 жыл бұрын
This video has been great but running into a slight issue.. When I bring up the replica Node I am get the following error in the log 2020-04-27 00:12:26.278 EDT [3084] LOG: archive command failed with exit code 1 2020-04-27 00:12:26.278 EDT [3084] DETAIL: The failed archive command was: test ! -f /var/lib/postgresql/pg_log_archive/main/00000001000000000000000C && cp pg_wal/00000001000000000000000C /var/lib/postgresql/pg_log_archive/replica/00000001000000000000000C ## The achive command is set to below: archive_command = 'test ! -f /var/lib/postgresql/pg_log_archive/main/%f && cp %p /var/lib/postgresql/pg_log_archive/replica/%f' Please advise
@markshay4886
@markshay4886 4 жыл бұрын
This turned out be a very simple solution. I had recovery.conf in the wrong directory. Doh! I had the file in /etc/postgresql/10/main/recovery.conf when it should have been in the data directory: /var/lib/postgresql/10/main
@vimsen2221
@vimsen2221 4 жыл бұрын
When I tried to start the replica ( Line 75 ) the system is asking for the password of postgres. I have not set a password when I installed postgres. It does not accept my Ubuntu sudo password.
@isaacmendes8878
@isaacmendes8878 4 жыл бұрын
Same problem
@zefanyarichen1493
@zefanyarichen1493 3 жыл бұрын
my streaming replication was running for once, but now isn't work, after i check the log, it show FATAL: could not receive data from WAL stream: ERROR: requested WAL segment 000000010000029700000076 has already been removed any advice what should i do?
@ScalingPostgres
@ScalingPostgres 3 жыл бұрын
You need to extend the amount of wal segments retained or use a replication slot so that the primary does not remove needed wal segments
@Bigheadbear666
@Bigheadbear666 4 жыл бұрын
How do you set the primary_conninfo in this tutorial? 16:49 I stuck here, it is not written in the code example and cannot be viewed in this video either.
@ScalingPostgres
@ScalingPostgres 4 жыл бұрын
Hi Hsin. In the video, I scroll over to the right to show the full line. You can pause the video there. Also, I did update the text part of the tutorial to include all lines at scalingpostgres.com.
@Bigheadbear666
@Bigheadbear666 4 жыл бұрын
@@ScalingPostgres Thanks I've got it. Now I have another problem. When I tried to restart the replica1 cluster with this commnad "pg_ctlcluster 12 replica1 start" . It gave me this error: pg_ctl: could not start server Examine the log output.FATAL: using recovery command file "recovery.conf" is not supported How do I fix this ? I am running PostgreSQL 12 on Ubuntu 18.04
@ScalingPostgres
@ScalingPostgres 4 жыл бұрын
@@Bigheadbear666 This tutorial won't work for PG 12 and higher. Most of the recovery.conf settings have been moved into the main postgresql.conf file and then you have to use signal files instead. I would consult another tutorial or the Postgres documentation until I am able to publish an updated one.
@Bigheadbear666
@Bigheadbear666 4 жыл бұрын
@@ScalingPostgres Thanks a lot, looking forward to it.
@sanketrajurkar594
@sanketrajurkar594 5 жыл бұрын
Hello christine, can we make slave server to accept data from multiple master serveres
@sanketrajurkar594
@sanketrajurkar594 5 жыл бұрын
I am using postgresql 9.6
@Yoga-mit-Waltraud-2b
@Yoga-mit-Waltraud-2b 3 жыл бұрын
You lost me at line 63. More graphics and explaination may have helped. At least I now know how to pronouce "ubuntu" - Thanks. P.S. The command list was great.
@Zeid_Al-Seryani
@Zeid_Al-Seryani 3 жыл бұрын
can you explain the meaning of %f and %p , should i replace those with something else ? i have seen lots of videos and resources, they do not explain the meaning of %f or %p or if those should be replaced with something else . Your Video is very good. Thank you for your time
@ScalingPostgres
@ScalingPostgres 3 жыл бұрын
This is explained in the postgres docs for the archive command: "In archive_command, %p is replaced by the path name of the file to archive, while %f is replaced by only the file name." Link: www.postgresql.org/docs/13/continuous-archiving.html
@Zeid_Al-Seryani
@Zeid_Al-Seryani 3 жыл бұрын
@@ScalingPostgres Thank you very much. I already understood that and applied the streaming replication between two windows machines ( primary and secondary ) Thanks again.
@argonwheatbelly637
@argonwheatbelly637 5 жыл бұрын
Thanks! Great video! Just one thing. Please pronounce Ubuntu as "oo-BOON-too", not "you-BUNT-oo".
@jurabekhkaytboev197
@jurabekhkaytboev197 Жыл бұрын
I run this command: sudo pg_ctlcluster 14 replica start result : Job for postgresql@14-replica.service failed because the service did not take the steps required by its unit configuration. See "systemctl status postgresql@14-replica.service" and "journalctl -xe" for details. please help me.
PostgreSQL Replication Slots
9:31
Scaling Postgres
Рет қаралды 11 М.
PostgreSQL Replication Monitoring
13:42
Scaling Postgres
Рет қаралды 7 М.
Inside Out Babies (Inside Out Animation)
00:21
FASH
Рет қаралды 23 МЛН
Smart Sigma Kid #funny #sigma #memes
00:26
CRAZY GREAPA
Рет қаралды 7 МЛН
PostgreSQL Backup & Point-In-Time Recovery
19:31
Scaling Postgres
Рет қаралды 64 М.
The Future of MySQL is Postgres? | Scaling Postgres 313
15:34
Scaling Postgres
Рет қаралды 7 М.
PostgreSQL Streaming Replication Tutorial
15:54
High-Performance Programming
Рет қаралды 61 М.
PostgreSQL Replication Failback with pg_rewind
13:13
Scaling Postgres
Рет қаралды 8 М.
PostgreSQL Replication with Easy Failback
11:48
Scaling Postgres
Рет қаралды 12 М.
PostgreSQL Logical Replication Guide
25:06
High-Performance Programming
Рет қаралды 37 М.
PostgreSQL HA High Availability Tutorial
19:04
High-Performance Programming
Рет қаралды 45 М.
PostgreSQL replication by example
30:45
PostgresConf South Africa
Рет қаралды 23 М.
PostgreSQL High Availability Options
16:34
Yugabyte
Рет қаралды 5 М.
Inside Out Babies (Inside Out Animation)
00:21
FASH
Рет қаралды 23 МЛН