{"id":13016,"date":"2019-11-16T17:29:20","date_gmt":"2019-11-16T16:29:20","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/"},"modified":"2023-06-15T16:41:28","modified_gmt":"2023-06-15T14:41:28","slug":"postgresql-12-setting-up-streaming-replication","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/","title":{"rendered":"PostgreSQL 12 : Setting Up Streaming Replication"},"content":{"rendered":"<p><strong>By Mouhamadou Diaw<\/strong><\/p>\n<p>PostgreSQL 12 was released a few month ago. When actually setting up a replication, there is no longer recovery.conf file in the PGDATA. Indeed all parameters of the recovery.conf should be now in the postgresql.conf file. And in the cluster data directory of the standby server, therre should be a file named standby.signal to trigger the standby mode.<br \/>\nIn this blog I am just building a streaming replication between 2 servers to show these changes. The configuration we are using is<br \/>\nPrimary server dbi-pg-essentials : 192.168.56.101<br \/>\nStandby server dbi-pg-essentials-2 : 192.168.56.102<\/p>\n<p>The primary server is up and running on dbi-pg-essentials server.<\/p>\n<div>\n<div id=\"highlighter_465921\" class=\"syntaxhighlighter  bash\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<div class=\"line number5 index4 alt2\">5<\/div>\n<div class=\"line number6 index5 alt1\">6<\/div>\n<div class=\"line number7 index6 alt2\">7<\/div>\n<div class=\"line number8 index7 alt1\">8<\/div>\n<div class=\"line number9 index8 alt2\">9<\/div>\n<div class=\"line number10 index9 alt1\">10<\/div>\n<div class=\"line number11 index10 alt2\">11<\/div>\n<div class=\"line number12 index11 alt1\">12<\/div>\n<div class=\"line number13 index12 alt2\">13<\/div>\n<div class=\"line number14 index13 alt1\">14<\/div>\n<div class=\"line number15 index14 alt2\">15<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"bash plain\">postgres@dbi-pg-essentials:<\/code><code class=\"bash plain\">\/u02\/pgdata\/12\/PG1\/<\/code> <code class=\"bash plain\">[PG12] pg12<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"bash plain\">********* dbi services Ltd. *********<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">STATUS\u00a0 : OPEN<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">ARCHIVE_COMMAND\u00a0 : <\/code><code class=\"bash functions\">test<\/code> <code class=\"bash plain\">! -f <\/code><code class=\"bash plain\">\/u99\/pgdata\/12\/archived_wal\/<\/code><code class=\"bash plain\">%f &amp;&amp; <\/code><code class=\"bash functions\">cp<\/code> <code class=\"bash plain\">%p <\/code><code class=\"bash plain\">\/u99\/pgdata\/12\/archived_wal\/<\/code><code class=\"bash plain\">%f<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">ARCHIVE_MODE\u00a0 : on<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">EFFECTIVE_CACHE_SIZE\u00a0 : 4096MB<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">FSYNC\u00a0 : on<\/code><\/div>\n<div class=\"line number9 index8 alt2\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">SHARED_BUFFERS\u00a0 : 128MB<\/code><\/div>\n<div class=\"line number10 index9 alt1\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">SYNCHRONOUS_COMMIT\u00a0 : on<\/code><\/div>\n<div class=\"line number11 index10 alt2\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">WORK_MEM\u00a0 : 4MB<\/code><\/div>\n<div class=\"line number12 index11 alt1\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">IS_STANDBY\u00a0 : <\/code><code class=\"bash functions\">false<\/code><\/div>\n<div class=\"line number13 index12 alt2\"><code class=\"bash plain\">*************************************<\/code><\/div>\n<div class=\"line number14 index13 alt1\"><\/div>\n<div class=\"line number15 index14 alt2\"><code class=\"bash plain\">postgres@dbi-pg-essentials:<\/code><code class=\"bash plain\">\/u02\/pgdata\/12\/PG1\/<\/code> <code class=\"bash plain\">[PG12]<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>step 1 : Prepare the user for the replication on the primay server<\/strong><br \/>\nFor streaming replication, we need a user to read the WAL stream, we can do it with a superuser but it is not required. We will create a user with REPLICATION and LOGIN privileges. Contrary to the SUPERUSER privilege, the REPLICATION privilege gives very high permissions but does not allow to modifiy any data.<br \/>\nHere we will create a user named repliuser<\/p>\n<div>\n<div id=\"highlighter_811944\" class=\"syntaxhighlighter  bash\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"bash plain\">postgres=<\/code><code class=\"bash comments\"># create user repliuser with password 'postgres'\u00a0 replication ;<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"bash plain\">CREATE ROLE<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"bash plain\">postgres=<\/code><code class=\"bash comments\">#<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>Step 2 : Prepare the authentication on the primary server<\/strong><br \/>\nThe user used for the replication should be allowed to connect for replication. We need then to adjust the pg_hba.conf file for the two servers.<\/p>\n<div>\n<div id=\"highlighter_966811\" class=\"syntaxhighlighter  bash\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"bash plain\">postgres@dbi-pg-essentials:<\/code><code class=\"bash plain\">\/u02\/pgdata\/12\/PG1\/<\/code> <code class=\"bash plain\">[PG12] <\/code><code class=\"bash functions\">grep<\/code> <code class=\"bash plain\">repliuser pg_hba.conf<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"bash plain\">host\u00a0\u00a0\u00a0 replication\u00a0\u00a0\u00a0\u00a0 repliuser\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 192.168.56.101<\/code><code class=\"bash plain\">\/32<\/code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <code class=\"bash plain\">md5<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"bash plain\">host\u00a0\u00a0\u00a0 replication\u00a0\u00a0\u00a0\u00a0 repliuser\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 192.168.56.102<\/code><code class=\"bash plain\">\/32<\/code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <code class=\"bash plain\">md5<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"bash plain\">postgres@dbi-pg-essentials:<\/code><code class=\"bash plain\">\/u02\/pgdata\/12\/PG1\/<\/code> <code class=\"bash plain\">[PG12]<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>Step 3 : Create a replication slot on the primary server<\/strong><br \/>\nReplication slots provide an automated way to ensure that the master does not remove WAL segments until they have been received by all standbys, and that the master does not remove rows which could cause a recovery conflict even when the standby is disconnected.<\/p>\n<div>\n<div id=\"highlighter_815841\" class=\"syntaxhighlighter  sql\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<div class=\"line number5 index4 alt2\">5<\/div>\n<div class=\"line number6 index5 alt1\">6<\/div>\n<div class=\"line number7 index6 alt2\">7<\/div>\n<div class=\"line number8 index7 alt1\">8<\/div>\n<div class=\"line number9 index8 alt2\">9<\/div>\n<div class=\"line number10 index9 alt1\">10<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"sql plain\">psql (12.1 dbi services build)<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"sql plain\">Type <\/code><code class=\"sql string\">\"help\"<\/code> <code class=\"sql keyword\">for<\/code> <code class=\"sql plain\">help.<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"sql plain\">postgres=# <\/code><code class=\"sql keyword\">SELECT<\/code> <code class=\"sql plain\">* <\/code><code class=\"sql keyword\">FROM<\/code> <code class=\"sql plain\">pg_create_physical_replication_slot(<\/code><code class=\"sql string\">'pg_slot_1'<\/code><code class=\"sql plain\">);<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"sql spaces\">\u00a0<\/code><code class=\"sql plain\">slot_name | lsn<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"sql comments\">-----------+-----<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"sql spaces\">\u00a0<\/code><code class=\"sql plain\">pg_slot_1 |<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"sql plain\">(1 row)<\/code><\/div>\n<div class=\"line number9 index8 alt2\"><\/div>\n<div class=\"line number10 index9 alt1\"><code class=\"sql plain\">postgres=#<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>Step 4 : Do a backup of the primary database and restore it on the standby<\/strong><br \/>\nFrom the standby server launch the following command<\/p>\n<div>\n<div id=\"highlighter_555946\" class=\"syntaxhighlighter  bash\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"bash plain\">postgres@dbi-pg-essentials-2:<\/code><code class=\"bash plain\">\/u02\/pgdata\/12\/PG1\/<\/code> <code class=\"bash plain\">[PG12] pg_basebackup -h 192.168.56.101 -D <\/code><code class=\"bash plain\">\/u02\/pgdata\/12\/PG1<\/code> <code class=\"bash plain\">--wal-method=fetch -U repliuser<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong> Step 5 : set the primary connection info for the streaming on standby side <\/strong><br \/>\nThe host name and port number of the primary, connection user name, and password are specified in the primary_conninfo. Here there is a little change as there is no longer a recovery.conf parameter. The primary_conninfo should now be specified in the postgresql.conf<\/p>\n<div>\n<div id=\"highlighter_120264\" class=\"syntaxhighlighter  bash\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"bash plain\">postgres@dbi-pg-essentials-2:<\/code><code class=\"bash plain\">\/u02\/pgdata\/12\/PG1\/<\/code> <code class=\"bash plain\">[PG12] <\/code><code class=\"bash functions\">grep<\/code> <code class=\"bash plain\">primary postgresql.conf<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"bash plain\">primary_conninfo = <\/code><code class=\"bash string\">'host=192.168.56.101 port=5432 user=repliuser password=postgres'<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"bash plain\">primary_slot_name = <\/code><code class=\"bash string\">'pg_slot_1'<\/code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <code class=\"bash comments\"># replication slot on sending server<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>Step 6 : Create the standby.signal file on standby server<\/strong><br \/>\nIn the cluster data directory of the standby, create a file standby.signal<\/p>\n<div>\n<div id=\"highlighter_99747\" class=\"syntaxhighlighter  bash\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"bash plain\">postgres@dbi-pg-essentials-2:<\/code><code class=\"bash plain\">\/u02\/pgdata\/12\/PG1\/<\/code> <code class=\"bash plain\">[PG12] <\/code><code class=\"bash functions\">pwd<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"bash plain\">\/u02\/pgdata\/12\/PG1<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"bash plain\">postgres@dbi-pg-essentials-2:<\/code><code class=\"bash plain\">\/u02\/pgdata\/12\/PG1\/<\/code> <code class=\"bash plain\">[PG12] <\/code><code class=\"bash functions\">touch<\/code> <code class=\"bash plain\">standby.signal<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>Step 7 : Then start the standby cluster<\/strong><\/p>\n<div>\n<div id=\"highlighter_586512\" class=\"syntaxhighlighter  bash\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"bash plain\">postgres@dbi-pg-essentials-2:<\/code><code class=\"bash plain\">\/u02\/pgdata\/12\/PG1\/<\/code> <code class=\"bash plain\">[PG12] pg_ctl start<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>If everything is fine, you should fine in the alert log<\/p>\n<div>\n<div id=\"highlighter_61867\" class=\"syntaxhighlighter  bash\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"bash plain\">2019-11-16 17:41:21.552 CET [1590] LOG:\u00a0 database system is ready to accept <\/code><code class=\"bash functions\">read<\/code> <code class=\"bash plain\">only connections<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"bash plain\">2019-11-16 17:41:21.612 CET [1596] LOG:\u00a0 started streaming WAL from primary at 0<\/code><code class=\"bash plain\">\/5000000<\/code> <code class=\"bash plain\">on timeline 1<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>As confirmed by dbi dmk tool, the master is now streaming to the standby server<\/p>\n<div>\n<div id=\"highlighter_503851\" class=\"syntaxhighlighter  bash\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<div class=\"line number5 index4 alt2\">5<\/div>\n<div class=\"line number6 index5 alt1\">6<\/div>\n<div class=\"line number7 index6 alt2\">7<\/div>\n<div class=\"line number8 index7 alt1\">8<\/div>\n<div class=\"line number9 index8 alt2\">9<\/div>\n<div class=\"line number10 index9 alt1\">10<\/div>\n<div class=\"line number11 index10 alt2 highlighted\">11<\/div>\n<div class=\"line number12 index11 alt1\">12<\/div>\n<div class=\"line number13 index12 alt2\">13<\/div>\n<div class=\"line number14 index13 alt1\">14<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"bash plain\">********* dbi services Ltd. *********<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">STATUS\u00a0 : OPEN<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">ARCHIVE_COMMAND\u00a0 : <\/code><code class=\"bash functions\">test<\/code> <code class=\"bash plain\">! -f <\/code><code class=\"bash plain\">\/u99\/pgdata\/12\/archived_wal\/<\/code><code class=\"bash plain\">%f &amp;&amp; <\/code><code class=\"bash functions\">cp<\/code> <code class=\"bash plain\">%p <\/code><code class=\"bash plain\">\/u99\/pgdata\/12\/archived_wal\/<\/code><code class=\"bash plain\">%f<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">ARCHIVE_MODE\u00a0 : on<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">EFFECTIVE_CACHE_SIZE\u00a0 : 4096MB<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">FSYNC\u00a0 : on<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">SHARED_BUFFERS\u00a0 : 128MB<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">SYNCHRONOUS_COMMIT\u00a0 : on<\/code><\/div>\n<div class=\"line number9 index8 alt2\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">WORK_MEM\u00a0 : 4MB<\/code><\/div>\n<div class=\"line number10 index9 alt1\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">IS_STANDBY\u00a0 : <\/code><code class=\"bash functions\">false<\/code><\/div>\n<div class=\"line number11 index10 alt2 highlighted\"><code class=\"bash spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"bash plain\">IS_MASTER\u00a0 : YES, streaming to 192.168.56.102<\/code><code class=\"bash plain\">\/32<\/code><\/div>\n<div class=\"line number12 index11 alt1\"><code class=\"bash plain\">*************************************<\/code><\/div>\n<div class=\"line number13 index12 alt2\"><\/div>\n<div class=\"line number14 index13 alt1\"><code class=\"bash plain\">postgres@dbi-pg-essentials:<\/code><code class=\"bash plain\">\/u02\/pgdata\/12\/PG1\/<\/code> <code class=\"bash plain\">[PG12]<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>By Mouhamadou Diaw PostgreSQL 12 was released a few month ago. When actually setting up a replication, there is no longer recovery.conf file in the PGDATA. Indeed all parameters of the recovery.conf should be now in the postgresql.conf file. And in the cluster data directory of the standby server, therre should be a file named [&hellip;]<\/p>\n","protected":false},"author":27,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229,83],"tags":[1744,1481,1745,1738],"type_dbi":[],"class_list":["post-13016","post","type-post","status-publish","format-standard","hentry","category-database-administration-monitoring","category-postgresql","tag-hot-standby","tag-postgresql-12","tag-standby-signal","tag-streaming-replication"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>PostgreSQL 12 : Setting Up Streaming Replication - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PostgreSQL 12 : Setting Up Streaming Replication\" \/>\n<meta property=\"og:description\" content=\"By Mouhamadou Diaw PostgreSQL 12 was released a few month ago. When actually setting up a replication, there is no longer recovery.conf file in the PGDATA. Indeed all parameters of the recovery.conf should be now in the postgresql.conf file. And in the cluster data directory of the standby server, therre should be a file named [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-16T16:29:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-15T14:41:28+00:00\" \/>\n<meta name=\"author\" content=\"Oracle Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oracle Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/\"},\"author\":{\"name\":\"Oracle Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"headline\":\"PostgreSQL 12 : Setting Up Streaming Replication\",\"datePublished\":\"2019-11-16T16:29:20+00:00\",\"dateModified\":\"2023-06-15T14:41:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/\"},\"wordCount\":402,\"commentCount\":0,\"keywords\":[\"hot standby\",\"postgresql 12\",\"standby.signal\",\"Streaming replication\"],\"articleSection\":[\"Database Administration &amp; Monitoring\",\"PostgreSQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/\",\"name\":\"PostgreSQL 12 : Setting Up Streaming Replication - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2019-11-16T16:29:20+00:00\",\"dateModified\":\"2023-06-15T14:41:28+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PostgreSQL 12 : Setting Up Streaming Replication\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\",\"name\":\"Oracle Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"caption\":\"Oracle Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"PostgreSQL 12 : Setting Up Streaming Replication - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/","og_locale":"en_US","og_type":"article","og_title":"PostgreSQL 12 : Setting Up Streaming Replication","og_description":"By Mouhamadou Diaw PostgreSQL 12 was released a few month ago. When actually setting up a replication, there is no longer recovery.conf file in the PGDATA. Indeed all parameters of the recovery.conf should be now in the postgresql.conf file. And in the cluster data directory of the standby server, therre should be a file named [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/","og_site_name":"dbi Blog","article_published_time":"2019-11-16T16:29:20+00:00","article_modified_time":"2023-06-15T14:41:28+00:00","author":"Oracle Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Oracle Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/"},"author":{"name":"Oracle Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"headline":"PostgreSQL 12 : Setting Up Streaming Replication","datePublished":"2019-11-16T16:29:20+00:00","dateModified":"2023-06-15T14:41:28+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/"},"wordCount":402,"commentCount":0,"keywords":["hot standby","postgresql 12","standby.signal","Streaming replication"],"articleSection":["Database Administration &amp; Monitoring","PostgreSQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/","url":"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/","name":"PostgreSQL 12 : Setting Up Streaming Replication - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2019-11-16T16:29:20+00:00","dateModified":"2023-06-15T14:41:28+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/postgresql-12-setting-up-streaming-replication\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"PostgreSQL 12 : Setting Up Streaming Replication"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee","name":"Oracle Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","caption":"Oracle Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/13016","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=13016"}],"version-history":[{"count":1,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/13016\/revisions"}],"predecessor-version":[{"id":25959,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/13016\/revisions\/25959"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=13016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=13016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=13016"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=13016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}