{"id":18416,"date":"2022-08-11T17:53:15","date_gmt":"2022-08-11T15:53:15","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/?p=18416"},"modified":"2024-11-08T15:39:42","modified_gmt":"2024-11-08T14:39:42","slug":"postgresql-cluster-using-repmgr","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/","title":{"rendered":"PostgreSQL Cluster using repmgr"},"content":{"rendered":"\n<p>With this blog I describe the installation of a PostgreSQL Cluster using repmgr instead of Patroni. Repmgr was originally developed by 2ndQuadrant which is now part of EDB and EDB decided for the 2ndQuadrant tools for the future, barman as backup solution from 2ndQ survives, Bart is canceled by EDB.<\/p>\n\n\n\n<p>At first I do a setup of three virtual machines using Rocky Linux 8.6 minimal installation including EPEL Repository for htop. Than I make sure that networking between these three VMs is working by adapting \/etc\/hosts. Without a functional network a cluster won&#8217;t work.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;root@repmgr-01 ~]# cat \/etc\/hosts\n127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4\n192.168.198.130 repmgr-01 repmgr-01.localdomain\n192.168.198.131\trepmgr-02 repmgr-02.localdomain\n192.168.198.132\trepmgr-03 repmgr-03.localdomain\n&#091;root@repmgr-01 ~]# ping repmgr-01\nPING repmgr-01 (192.168.198.130) 56(84) bytes of data.\n64 bytes from repmgr-01 (192.168.198.130): icmp_seq=1 ttl=64 time=0.032 ms\n64 bytes from repmgr-01 (192.168.198.130): icmp_seq=2 ttl=64 time=0.057 ms\n64 bytes from repmgr-01 (192.168.198.130): icmp_seq=3 ttl=64 time=0.183 ms\n--- repmgr-01 ping statistics ---\n3 packets transmitted, 3 received, 0% packet loss, time 2074ms\nrtt min\/avg\/max\/mdev = 0.032\/0.090\/0.183\/0.066 ms\n\n&#091;root@repmgr-01 ~]# ping repmgr-02\nPING repmgr-02 (192.168.198.131) 56(84) bytes of data.\n64 bytes from repmgr-02 (192.168.198.131): icmp_seq=1 ttl=64 time=0.550 ms\n64 bytes from repmgr-02 (192.168.198.131): icmp_seq=2 ttl=64 time=0.757 ms\n64 bytes from repmgr-02 (192.168.198.131): icmp_seq=3 ttl=64 time=0.838 ms\n--- repmgr-02 ping statistics ---\n3 packets transmitted, 3 received, 0% packet loss, time 2074ms\nrtt min\/avg\/max\/mdev = 0.550\/0.715\/0.838\/0.121 ms\n\n&#091;root@repmgr-01 ~]# ping repmgr-03\nPING repmgr-03 (192.168.198.132) 56(84) bytes of data.\n64 bytes from repmgr-03 (192.168.198.132): icmp_seq=1 ttl=64 time=0.541 ms\n64 bytes from repmgr-03 (192.168.198.132): icmp_seq=2 ttl=64 time=0.479 ms\n64 bytes from repmgr-03 (192.168.198.132): icmp_seq=3 ttl=64 time=0.439 ms\n--- repmgr-03 ping statistics ---\n3 packets transmitted, 3 received, 0% packet loss, time 2058ms\nrtt min\/avg\/max\/mdev = 0.439\/0.486\/0.541\/0.045 ms\n&#091;root@repmgr-01 ~]# <\/code><\/pre>\n\n\n\n<p>The PostgreSQL installation is following the steps I have described at my Article at heise.de:<\/p>\n\n\n\n<p>https:\/\/www.heise.de\/ratgeber\/PostgreSQL-installieren-mit-den-Community-Paketen-4877556.html<\/p>\n\n\n\n<p>But with different packages added like repmgr and barman and of course PostgreSQL 14 latest.<\/p>\n\n\n\n<p>The installation starts with adding the Postgresql.org repository and disabling the OS PostgreSQL modules on the two database nodes, the third machine is planned as witness for auto failover.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;root@repmgr-01 ~]# dnf install https:\/\/download.postgresql.org\/pub\/repos\/yum\/reporpms\/EL-8-x86_64\/pgdg-redhat-repo-latest.noarch.rpm\nLast metadata expiration check: 0:20:49 ago on Thu 11 Aug 2022 11:06:40 AM CEST.\npgdg-redhat-repo-latest.noarch.rpm                                                                                                                                                                                                                         62 kB\/s |  13 kB     00:00    \nDependencies resolved.\n==========================================================================================================================================================================================================================================================================================\n Package                                                                   Architecture                                                    Version                                                            Repository                                                             Size\n==========================================================================================================================================================================================================================================================================================\nInstalling:\n pgdg-redhat-repo                                                          noarch                                                          42.0-24                                                            @commandline                                                           13 k\n\nTransaction Summary\n==========================================================================================================================================================================================================================================================================================\nInstall  1 Package\n\nTotal size: 13 k\nInstalled size: 12 k\nIs this ok &#091;y\/N]: y\nDownloading Packages:\nRunning transaction check\nTransaction check succeeded.\nRunning transaction test\nTransaction test succeeded.\nRunning transaction\n  Preparing        :                                                                                                                                                                                                                                                                  1\/1 \n  Installing       : pgdg-redhat-repo-42.0-24.noarch                                                                                                                                                                                                                                  1\/1 \n  Verifying        : pgdg-redhat-repo-42.0-24.noarch                                                                                                                                                                                                                                  1\/1 \n\nInstalled:\n  pgdg-redhat-repo-42.0-24.noarch                                                                                                                                                                                                                                                         \n\nComplete!\n&#091;root@repmgr-01 ~]# dnf -qy module disable postgresql\nImporting GPG key 0x442DF0F8:\n Userid     : \"PostgreSQL RPM Building Project &lt;pgsql-pkg-yum@postgresql.org&gt;\"\n Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8\n From       : \/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-PGDG\nImporting GPG key 0x442DF0F8:\n Userid     : \"PostgreSQL RPM Building Project &lt;pgsql-pkg-yum@postgresql.org&gt;\"\n Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8\n From       : \/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-PGDG\nImporting GPG key 0x442DF0F8:\n Userid     : \"PostgreSQL RPM Building Project &lt;pgsql-pkg-yum@postgresql.org&gt;\"\n Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8\n From       : \/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-PGDG\nImporting GPG key 0x442DF0F8:\n Userid     : \"PostgreSQL RPM Building Project &lt;pgsql-pkg-yum@postgresql.org&gt;\"\n Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8\n From       : \/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-PGDG\nImporting GPG key 0x442DF0F8:\n Userid     : \"PostgreSQL RPM Building Project &lt;pgsql-pkg-yum@postgresql.org&gt;\"\n Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8\n From       : \/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-PGDG\nImporting GPG key 0x442DF0F8:\n Userid     : \"PostgreSQL RPM Building Project &lt;pgsql-pkg-yum@postgresql.org&gt;\"\n Fingerprint: 68C9 E2B9 1A37 D136 FE74 D176 1F16 D2E1 442D F0F8\n From       : \/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-PGDG\n&#091;root@repmgr-01 ~]# dnf install -y postgresql14 postgresql14-server postgresql14-contrib postgresql14-libs repmgr_14 barman<\/code><\/pre>\n\n\n\n<p>I personally disable all postgresql releases within the postgresql repo file that I don&#8217;t want to use before installation, this speed up the whole installation process.<\/p>\n\n\n\n<p>The next step is adapting the service file for a non standard PGDATA, for that I&#8217;m using systemctl edit to create a override.conf for the postgresql-14.service file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;root@repmgr-03 ~]# systemctl edit postgresql-14.service\n&#091;Service]\nEnvironment=PGDATA=\/pgdata\/14\/data<\/code><\/pre>\n\n\n\n<p>Initialization should be done on the planned Leader \/ Master node only, by crating the Replica node later pgbasebackup is used.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;root@repmgr-01 ~]# \/usr\/pgsql-14\/bin\/postgresql-14-setup initdb\nInitializing database ... OK<\/code><\/pre>\n\n\n\n<p>For recurring jobs I have a set of shell scripts, one for setup CPU and Memory parameters including SSL using server self created certificate and key, required is a directory \/pgdata\/ssl owned by postgres user.<\/p>\n\n\n\n<p>It configures PostgreSQL using alter system set commands within postgresql.auto.conf.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;postgres@repmgr-01 pgsql]$ cat config.sh \n##############################################\n# PostgreSQL configuration                   #\n# by Karsten Lenz dbi services sa 04.29.2022 #\n##############################################\n\n#!\/bin\/bash\n\necho \"PostgreSQL Configuration\"\necho \"\"\n\nfunction printHelp {\n  printf \"Usage:\\n\"\n  printf \"${progName} &#091;OPTION]\\n\\n\"\n  printf \"Options:\\n\"\n  printf \"\\t -c &lt;Count of CPU used&gt;\\t\\t\\tAmount of CPU used by this system (required)\\n\"\n  printf \"\\t -m &lt;Amount of Memory&gt;\\t\\t\\tAmount of Memory of this system (required)\\n\"\n  printf \"\\t -o &lt;Max Connections&gt;\\t\\t\\tAmount of Connections of this system (default = 100))\\n\"\n  printf \"\\t -v &lt;PostgreSQL Version&gt;\\t\\tMajor Release of Postgresql (default = 14)\\n\"\n  printf \"\\t -h &lt;Help&gt;\\t\\t\\t\\tprints this help\\n\"\n}\n\nwhile getopts c:m:o:v:h option 2&gt;\/dev\/null\ndo\n  case \"${option}\"\n  in\n  c) CPU=${OPTARG};;\n  m) RAM=${OPTARG};;\n  o) CONNECTIONS=${OPTARG:=100};;\n  v) VERSION=${OPTARG:=14};;\n  h) printHelp; exit 2;;\n  *) printf \"Unsupported option or parameter value missing '$*'\\n\";\n     printf \"Run ${printHelp} -h to print help\\n\"; exit 1;;\n  esac\ndone\n\n# create ssl certificate and ssl key\nopenssl req -new -newkey rsa:4096 -nodes -x509 -subj \"\/C=CH\/ST=DBAAS\/L=ZUERICH\/O=Dis\/CN=www.dbi-services.com\" -keyout \/pgdata\/ssl\/pgsql.key -out \/pgdata\/ssl\/pgsql.crt\n\n# define parameters\nrootdir=\/opt\/pgsql\/config\ncd ${rootdir}\n\n# connections\nmax_connections=($CONNECTIONS)\necho max_connections : $max_connections\n\n# memory\nlet shared_buffers=($RAM\/4)\necho shared_buffers : $shared_buffers\nlet effective_cache_size=($RAM-$shared_buffers)\necho effective_cache_size : $effective_cache_size\nlet work_mem=($RAM*256\/$CONNECTIONS)\necho work_mem : $work_mem\nlet maintenance_work_mem=($RAM*256\/8)\necho  maintenance_work_mem : $maintenance_work_mem\n\n# cpu\nlet max_worker_processes=($CPU)\necho max_worker_processes : $max_worker_processes\nlet max_parallel_workers=($CPU)\necho  max_parallel_workers : $max_parallel_workers\nlet max_parallel_workers_per_gather=($CPU\/2)\necho max_parallel_workers_per_gather : $max_parallel_workers_per_gather\nlet max_parallel_maintenance_workers=($CPU\/2)\necho max_parallel_maintenance_workers : $max_parallel_maintenance_workers\n\n# cpu and memory configuration\npsql -c \"alter system set listen_addresses = '*';\"\npsql -c \"alter system set max_connections = '$max_connections';\"\npsql -c \"alter system set effective_cache_size = '$effective_cache_size GB';\"\npsql -c \"alter system set shared_buffers = '$shared_buffers GB';\"\npsql -c \"alter system set work_mem = '$work_mem MB';\"\npsql -c \"alter system set maintenance_work_mem = '$maintenance_work_mem MB';\"\npsql -c \"alter system set max_worker_processes = '$max_worker_processes';\"\npsql -c \"alter system set max_parallel_workers = '$max_parallel_workers';\"\npsql -c \"alter system set max_parallel_workers_per_gather = '$max_parallel_workers_per_gather';\"\npsql -c \"alter system set max_parallel_maintenance_workers = '$max_parallel_maintenance_workers';\"\npsql -c \"alter system set ssl_cert_file = '\/pgdata\/ssl\/pgsql.crt';\"\npsql -c \"alter system set ssl_key_file = '\/pgdata\/ssl\/pgsql.key';\"\npsql -c \"alter system set ssl = on;\"\npsql -c \"alter system set ssl_ciphers = 'HIGH';\"\npsql -c \"alter system set ssl_min_protocol_version = 'TLSv1.2';\"\npsql -c \"alter system set shared_preload_libraries = pg_stat_statements;\"\nsudo service postgresql-$VERSION restart\nexit \n&#091;postgres@repmgr-01 pgsql]$ sh config.sh -h\nPostgreSQL Configuration\n\nUsage:\n &#091;OPTION]\n\nOptions:\n\t -c &lt;Count of CPU used&gt;\t\t\tAmount of CPU used by this system (required)\n\t -m &lt;Amount of Memory&gt;\t\t\tAmount of Memory of this system (required)\n\t -o &lt;Max Connections&gt;\t\t\tAmount of Connections of this system (default = 100))\n\t -v &lt;PostgreSQL Version&gt;\t\tMajor Release of Postgresql (default = 14)\n\t -h &lt;Help&gt;\t\t\t\tprints this help\n\n&#091;postgres@repmgr-01 pgsql]$ sh config.sh -c 2 -m 4 -o 100 -v 14\nPostgreSQL Configuration\n\nGenerating a RSA private key\n..........................................................++++\n.................................++++\nwriting new private key to '\/pgdata\/ssl\/pgsql.key'\n-----\nmax_connections : 100\nshared_buffers : 1\neffective_cache_size : 3\nwork_mem : 10\nmaintenance_work_mem : 128\nmax_worker_processes : 2\nmax_parallel_workers : 2\nmax_parallel_workers_per_gather : 1\nmax_parallel_maintenance_workers : 1\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\nRedirecting to \/bin\/systemctl restart postgresql-14.service\n\n&#091;postgres@repmgr-01 pgsql]$ cat \/pgdata\/14\/data\/postgresql.auto.conf \n# Do not edit this file manually!\n# It will be overwritten by the ALTER SYSTEM command.\nlisten_addresses = '*'\nmax_connections = '100'\neffective_cache_size = '3 GB'\nshared_buffers = '1 GB'\nwork_mem = '10 MB'\nmaintenance_work_mem = '128 MB'\nmax_worker_processes = '2'\nmax_parallel_workers = '2'\nmax_parallel_workers_per_gather = '1'\nmax_parallel_maintenance_workers = '1'\nssl_cert_file = '\/pgdata\/ssl\/pgsql.crt'\nssl_key_file = '\/pgdata\/ssl\/pgsql.key'\nssl = 'on'\nssl_ciphers = 'HIGH'\nssl_min_protocol_version = 'TLSv1.2'\nshared_preload_libraries = 'pg_stat_statements'\n&#091;postgres@repmgr-01 pgsql]$ <\/code><\/pre>\n\n\n\n<p>The system has 2 vCPU and 4GB RAM as visible within this configuration.<\/p>\n\n\n\n<p>For repmgr I would like to use password less authentication using pgpass, also for that I have written a small shell script, again with -h for help.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;postgres@repmgr-01 \/]$ cat \/opt\/pgsql\/config\/pgpass.sh \n#!\/bin\/sh\n\n########################################\n#                                      #\n#  pgpass setup script                 #\n#                                      #\n#  Author: Karsten Lenz \/ 2020.05.28   #\n#                                      #\n########################################\n\nprogName=$(basename $0)\n# postgresVersion=12\ndomain=localdomain\n# pgData=\/pgdata\/$postgresVersion\/data\n# postgresConf=\/pgdata\/$postgresVersion\/data\/postgresql.conf\npostgresHome=\/var\/lib\/pgsql\n# postgresBin=\/usr\/pgsql-$postgresVersion\/bin\npgpass=$postgresHome\/.pgpass\npassword=PutYourPasswordHere\n\nfunction printHelp() {\n  printf \"Usage:\\n\"\n  printf \"${progName} &#091;OPTION]\\n\\n\"\n  printf \"Options:\\n\"\n  printf \"\\t -p &lt;Primary Server&gt;\\t\\t\\tserver where the primary host is running on (required)\\n\"\n  printf \"\\t -s &lt;Secondary Server&gt;\\t\\t\\tserver where the secondary host is running on (required)\\n\"\n  printf \"\\t -h &lt;Help&gt;\\t\\t\\t\\tprints this help\\n\"\n}\n\nwhile getopts p:s:h option 2&gt;\/dev\/null\ndo\n  case \"${option}\"\n  in\n  p) primServer=${OPTARG};; \n  s) secdServer=${OPTARG};;\n  h) printHelp; exit 2;;\n  *) printf \"Unsupported option or parameter value missing '$*'\\n\"; \n     printf \"Run ${progName} -h to print help\\n\"; exit 1;;\n  esac\ndone\n\n############ Log function ############\n\nlogFile=\/tmp\/pgpass_install.log\n\nfunction log() {\n  echo \"$(date +%Y.%m.%d-%H:%M:%S) &#091;$$]$*\" | tee -a $logFile\n}\n\nif &#091; -f $logFile ]; then\n  continue\nelse\n  touch $logFile\n  chmod -R 774 $logFile\n  sleep 2\nfi\n\n#clean .pgpass\nrm -f $pgpass\n\n#set values in .pgpass\nlog \"INFO: #host:port:database:user:password in $pgpass\"\necho \"#host:port:database:user:password\" | tee -a $pgpass\nlog \"INFO: Setting localhost in $pgass\"\necho \"localhost:5432:*:repmgr:$password\" | tee -a $pgpass\nlog \"INFO: Setting 127.0.0.1 in $pgpass\"\necho \"127.0.0.1:5432:*:repmgr:$password\" | tee -a $pgpass\nlog \"INFO: Setting Primary $primServer in $pgpass\"\necho \"$primServer.$domain:5432:*:repmgr:$password\" | tee -a $pgpass\nlog \"INFO: Setting Primary $secdServer in $pgpass\"\necho \"$secdServer.$domain:5432:*:repmgr:$password\" | tee -a $pgpass\n\n#set .pgpass 0600\nchmod 0600 $pgpass\n\n#export PGPASSFILE\nexport PGPASSFILE='\/var\/lib\/pgsql\/.pgpass'\n&#091;postgres@repmgr-01 \/]$ \n\n&#091;postgres@repmgr-01 \/]$ sh \/opt\/pgsql\/config\/pgpass.sh -h\nUsage:\npgpass.sh &#091;OPTION]\n\nOptions:\n\t -p &lt;Primary Server&gt;\t\t\tserver where the primary host is running on (required)\n\t -s &lt;Secondary Server&gt;\t\t\tserver where the secondary host is running on (required)\n\t -h &lt;Help&gt;\t\t\t\tprints this help\n&#091;postgres@repmgr-01 \/]$ \n&#091;postgres@repmgr-01 \/]$ sh \/opt\/pgsql\/config\/pgpass.sh -p 192.168.198.130 -s 192.168.198.131\n2022.08.11-14:50:52 &#091;10902]INFO: #host:port:database:user:password in \/var\/lib\/pgsql\/.pgpass\n#host:port:database:user:password\n2022.08.11-14:50:52 &#091;10902]INFO: Setting localhost in \nlocalhost:5432:*:repmgr:PutYourPasswordHere\n2022.08.11-14:50:52 &#091;10902]INFO: Setting 127.0.0.1 in \/var\/lib\/pgsql\/.pgpass\n127.0.0.1:5432:*:repmgr:PutYourPasswordHere\n2022.08.11-14:50:52 &#091;10902]INFO: Setting Primary 192.168.198.130 in \/var\/lib\/pgsql\/.pgpass\n192.168.198.130.localdomain:5432:*:repmgr:PutYourPasswordHere\n2022.08.11-14:50:52 &#091;10902]INFO: Setting Primary 192.168.198.131 in \/var\/lib\/pgsql\/.pgpass\n192.168.198.131.localdomain:5432:*:repmgr:PutYourPasswordHere\n&#091;postgres@repmgr-01 \/]$ \n\n&#091;postgres@repmgr-01 \/]$ cat \/var\/lib\/pgsql\/.pgpass\n#host:port:database:user:password\nlocalhost:5432:*:repmgr:PutYourPasswordHere\n127.0.0.1:5432:*:repmgr:PutYourPasswordHere\n192.168.198.130.localdomain:5432:*:repmgr:PutYourPasswordHere\n192.168.198.131.localdomain:5432:*:repmgr:PutYourPasswordHere\n&#091;postgres@repmgr-01 \/]$ <\/code><\/pre>\n\n\n\n<p>Now the setup of repmgr itself, also for that I have written shell scripts for recurring operation, originally the scrpts where written for a customer project for a DBaaS environment within a private cloud. <\/p>\n\n\n\n<p>Setting up the Leader \/ Master node:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;postgres@repmgr-01 \/]$ cat \/opt\/pgsql\/config\/repMgrMasterSetup.sh \n#!\/bin\/sh\n\n########################################\n#  RepMgr setup script                 #\n#  Rework: Karsten Lenz \/ 2022.08.11   #\n########################################\n\nprogName=$(basename $0)\n# postgresVersion=14\ndomain=localdomain\n# repmgr_conf=\/etc\/repmgr\/$postgresVersion\/repmgr.conf\n# pgData=\/pgdata\/$postgresVersion\/data\n# postgresConf=\/pgdata\/$postgresVersion\/data\/postgresql.conf\n# postgresHome=\/var\/lib\/pgsql\/$postgresVersion\n# postgresBin=\/usr\/pgsql-$postgresVersion\/bin\npassword=PutYourPasswordHere\n\nfunction printHelp() {\n  printf \"Usage:\\n\"\n  printf \"${progName} &#091;OPTION]\\n\\n\"\n  printf \"Options:\\n\"\n  printf \"\\t -p &lt;Primary Server&gt;\\t\\t\\thost where the primary server is running on (required)\\n\"\n  printf \"\\t -s &lt;Standby Server&gt;\\t\\t\\thost where the standby server is running on (required)\\n\"\n  printf \"\\t -v &lt;PostgreSQL Major Release&gt;\\t\\tMajor Release Number default 14 (required)\\n\"\n  printf \"\\t -h &lt;Help&gt;\\t\\t\\t\\tprints this help\\n\"\n}\n\nwhile getopts c:p:s:v:h option 2&gt;\/dev\/null\ndo\n  case \"${option}\"\n  in\n  p) primServer=${OPTARG};;\n  s) secdServer=${OPTARG};;\n  v) postgresVersion=${OPTARG:=14};;\n  h) printHelp; exit 2;;\n  *) printf \"Unsupported option or parameter value missing '$*'\\n\"; \n     printf \"Run ${progName} -h to print help\\n\"; exit 1;;\n  esac\ndone\n\n### Building Variables according to inputs ###\nrepmgr_conf=\/etc\/repmgr\/$postgresVersion\/repmgr.conf\npgData=\/pgdata\/$postgresVersion\/data\npostgresConf=\/pgdata\/$postgresVersion\/data\/postgresql.conf\npostgresHome=\/var\/lib\/pgsql\/$postgresVersion\npostgresBin=\/usr\/pgsql-$postgresVersion\/bin\n\nrootDir=\/opt\/pgsql\n\n############ Log function ############\n\nlogFile=\/tmp\/repMaster_install.log\n\nfunction log() {\n  echo \"$(date +%Y.%m.%d-%H:%M:%S) &#091;$$]$*\" | tee -a $logFile\n}\n\nif &#091; -f $logFile ]; then\n  continue\nelse\n  touch $logFile\n  chmod -R 774 $logFile\n  sleep 2\nfi\n\n############ MAIN ############\npsql -c \"alter system set max_replication_slots = 10;\"\npsql -c \"alter system set archive_mode = 'on';\"\npsql -c \"alter system set archive_command = '\/bin\/true';\"\npsql -c \"alter system set wal_level = 'replica';\"\npsql -c \"alter system set max_wal_senders = 2;\"\npsql -c \"create user repmgr with superuser\"\nlog \"INFO: create user repmgr with superuser\"\npsql -c \"alter user repmgr with password '$password'\"\nlog \"INFO: alter user repmgr set password\"\n\n$postgresBin\/createdb repmgrdb -O repmgr\nlog \"INFO: Create database repmgrdb with owner repmgr\"\n\n$postgresBin\/pg_ctl reload -D $pgData -W -s\nif &#091; $? == 0 ]; then\n  log \"INFO: Reloading postgres returned $?\"\nelse\n  log \"ERROR: Reloading postgres returned $?\"\n  exit 8\nfi\n\n&gt; $repmgr_conf\n#log \"INFO: Setting cluster=$repCluster in $repmgr_conf\"\n#echo \"cluster=$repCluster\" | tee -a $repmgr_conf\nlog \"INFO: Setting node_id=1 in $repmgr_conf\"\necho \"node_id=1\" | tee -a $repmgr_conf\nlog \"INFO: Setting node_name=$primServer in $repmgr_conf\"\necho \"node_name=$primServer\" | tee -a $repmgr_conf\nlog \"INFO: Setting conninfo='host=$primServer.$domain user=repmgr dbname=repmgrdb' in $repmgr_conf\"\necho \"conninfo='host=$primServer.$domain user=repmgr dbname=repmgrdb'\" | tee -a $repmgr_conf\nlog \"INFO: Setting use_replication_slots=true\"\necho \"use_replication_slots=true\" | tee -a $repmgr_conf\nlog \"INFO: Setting data_directory='$pgData' in $repmgr_conf\"\necho \"data_directory='$pgData'\" | tee -a $repmgr_conf\n\n#\/usr\/psql-14\/bin repmgrdb repmgr &lt;&lt;EOF\n\npsql -c \"ALTER USER repmgr SET search_path TO repmgr, public;\"\nlog \"INFO: ALTER USER repmgr SET search_path TO repmgr, public;\"\n\n$postgresBin\/repmgr -f $repmgr_conf -F master register\nif &#091; $? == 0 ]; then\n  log \"INFO: Registering master returned $?\"\nelse\n  log \"ERROR: Registering master returned $?\"\n  exit 8\nfi\n\necho \"setup of primary successfully completed\"\n&#091;postgres@repmgr-01 \/]$ \n\npostgres@repmgr-01 \/]$ sh \/opt\/pgsql\/config\/repMgrMasterSetup.sh -p repmgr-01 -s repmgr-02 -v 14\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\nALTER SYSTEM\n2022.08.11-16:06:28 &#091;14145]INFO: create user repmgr with superuser\nALTER ROLE\n2022.08.11-16:06:28 &#091;14145]INFO: alter user repmgr set password\n2022.08.11-16:06:28 &#091;14145]INFO: Create database repmgrdb with owner repmgr\n2022.08.11-16:06:28 &#091;14145]INFO: Reloading postgres returned 0\n2022.08.11-16:06:28 &#091;14145]INFO: Setting node_id=1 in \/etc\/repmgr\/14\/repmgr.conf\nnode_id=1\n2022.08.11-16:06:28 &#091;14145]INFO: Setting node_name=repmgr-01 in \/etc\/repmgr\/14\/repmgr.conf\nnode_name=repmgr-01\n2022.08.11-16:06:28 &#091;14145]INFO: Setting conninfo='host=repmgr-01.localdomain user=repmgr dbname=repmgrdb' in \/etc\/repmgr\/14\/repmgr.conf\nconninfo='host=repmgr-01.localdomain user=repmgr dbname=repmgrdb'\n2022.08.11-16:06:28 &#091;14145]INFO: Setting use_replication_slots=true\nuse_replication_slots=true\n2022.08.11-16:06:28 &#091;14145]INFO: Setting data_directory='\/pgdata\/14\/data' in \/etc\/repmgr\/14\/repmgr.conf\ndata_directory='\/pgdata\/14\/data'\nALTER ROLE\n2022.08.11-16:06:28 &#091;14145]INFO: ALTER USER repmgr SET search_path TO repmgr, public;\nINFO: connecting to primary database...\nNOTICE: attempting to install extension \"repmgr\"\nNOTICE: \"repmgr\" extension successfully installed\nNOTICE: primary node record (ID: 1) registered\n2022.08.11-16:06:28 &#091;14145]INFO: Registering master returned 0\nsetup of primary successfully completed\npostgres@repmgr-01 \/]$<\/code><\/pre>\n\n\n\n<p>And now the master is running.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;postgres@repmgr-01 \/]$ \/usr\/pgsql-14\/bin\/repmgr cluster show\n ID | Name      | Role    | Status    | Upstream | Location | Priority | Timeline | Connection string                                     \n----+-----------+---------+-----------+----------+----------+----------+----------+--------------------------------------------------------\n 1  | repmgr-01 | primary | * running |          | default  | 100      | 1        | host=repmgr-01.localdomain user=repmgr dbname=repmgrdb\n&#091;postgres@repmgr-01 \/]$<\/code><\/pre>\n\n\n\n<p>For the replica we need to copy the psql.crt and psql.key using scp to \/pgdata\/ssl on the replica, after that we can use a repMgrSteupStandby.sh script to attach the replica to the leader.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;postgres@repmgr-02 \/]$ cat \/opt\/pgsql\/config\/repMgrStanbySetup.sh \n#!\/bin\/sh\n\n#################################################\n#  RepMgr Standby setup script                  #\n#  Author: Karsten Lenz dbi-services 2022.08.11 #\n#################################################\n\nprogName=$(basename $0)\n# postgresVersion=14\ndomain=localdomain\n# repmgr_conf=\/etc\/repmgr\/$postgresVersion\/repmgr.conf\n# pgData=\/pgdata\/$postgresVersion\/data\n# postgresConf=\/pgdata\/$postgresVersion\/data\/postgresql.conf\n# postgresHome=\/var\/lib\/pgsql\/$postgresVersion\n# postgresBin=\/usr\/pgsql-$postgresVersion\/bin\npassword=PutYourPasswordHere\n\nfunction printHelp() {\n  printf \"Usage:\\n\"\n  printf \"${progName} &#091;OPTION]\\n\\n\"\n  printf \"Options:\\n\"\n  printf \"\\t -c &lt;Container Name&gt;\\t\\t\\tname of the container\/cluster (required)\\n\"\n  printf \"\\t -p &lt;Primary Server&gt;\\t\\t\\thost where the primary server is running on (required)\\n\"\n  printf \"\\t -s &lt;Standby Server&gt;\\t\\t\\thost where the standby server is running on (required)\\n\"\n  printf \"\\t -v &lt;PostgreSQL Major Release&gt;\\t\\tMajor Release Number 14 default (required)\\n\"\n  printf \"\\t -h &lt;Help&gt;\\t\\t\\t\\tprints this help\\n\"\n}\n\nwhile getopts c:p:s:v:h option 2&gt;\/dev\/null\ndo\n  case \"${option}\"\n  in\n  c) container=${OPTARG};;\n  p) primServer=${OPTARG};;\n  s) secdServer=${OPTARG};;\n  v) postgresVersion=${OPTARG:=14};;\n  h) printHelp; exit 2;;\n  *) printf \"Unsupported option or parameter value missing '$*'\\n\"; \n     printf \"Run ${progName} -h to print help\\n\"; exit 1;;\n  esac\ndone\n\n### Building Definitions according to inputs ###\nrepmgr_conf=\/etc\/repmgr\/$postgresVersion\/repmgr.conf\npgData=\/pgdata\/$postgresVersion\/data\npostgresConf=\/pgdata\/$postgresVersion\/data\/postgresql.conf\npostgresHome=\/var\/lib\/pgsql\/$postgresVersion\npostgresBin=\/usr\/pgsql-$postgresVersion\/bin\n\nrootDir=\/opt\/pgsql\n\n############ Log function ############\n\nlogFile=\/tmp\/repSecondary_install.log\n\nfunction log() {\n  echo \"$(date +%Y.%m.%d-%H:%M:%S) &#091;$$]$*\" | tee -a $logFile\n}\n\nif &#091; -f $logFile ]; then\n  continue\nelse\n  touch $logFile\n  chmod -R 774 $logFile\n  sleep 2\nfi\n\n############ MAIN ############\n# change cert and key file via alter system set command\n# not necessary - will be copied with base dump??\n#psql -c \"alter system set ssl_cert_file = '\/pgdata\/security\/ssl\/${container}.pem'; \"\n#psql -c \"alter system set ssl_key_file = '\/pgdata\/security\/ssl\/${container}.key'; \"\n\n&gt;$repmgr_conf\n\nlog \"INFO: Setting node_id=2 in $repmgr_conf\"\necho \"node_id=2\" | tee -a $repmgr_conf\nlog \"INFO: Setting node_name=$secdServer in $repmgr_conf\"\necho \"node_name=$secdServer\" | tee -a $repmgr_conf\nlog \"INFO: Setting conninfo='host=$secdServer.$domain user=repmgr dbname=repmgrdb' in $repmgr_conf\"\necho \"conninfo='host=$secdServer.$domain user=repmgr dbname=repmgrdb'\" | tee -a $repmgr_conf\nlog \"Info: Setting 'use_replication_slots=true'  in $repmgr_conf\"\necho \"use_replication_slots=true\"  | tee -a $repmgr_conf\nlog \"INFO: Setting data_directory='$pgData' in $repmgr_conf\"\necho \"data_directory='$pgData'\" | tee -a $repmgr_conf\n\n#\/usr\/psql-14\/bin repmgrdb repmgr &lt;&lt;EOF\n\n$postgresBin\/repmgr -h $primServer.$domain -U repmgr -d repmgrdb -F standby clone \nif &#091; $? == 0 ]; then\n  log \"INFO: Registering standby returned $?\"\nelse\n  log \"ERROR: Registering standby returned $?\"\n  exit 8\nfi\n#start postgresql\nsudo systemctl start postgresql-${postgresVersion}.service\n\n## # set path\n## psql -c \"ALTER USER repmgr SET search_path TO repmgr, public;\"\n## log \"INFO: ALTER USER repmgr SET search_path TO repmgr, public;\"\n\n#register standby\n$postgresBin\/repmgr standby register\n\necho \"setup of standby successfully completed\"\n\n&#091;postgres@repmgr-02 \/]$ <\/code><\/pre>\n\n\n\n<p>The script has an help function -h to tell how it is used.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;postgres@repmgr-02 \/]$ sh \/opt\/pgsql\/config\/repMgrStanbySetup.sh -h\nUsage:\nrepMgrStanbySetup.sh &#091;OPTION]\n\nOptions:\n\t -c &lt;Container Name&gt;\t\t\tname of the container\/cluster (required)\n\t -p &lt;Primary Server&gt;\t\t\thost where the primary server is running on (required)\n\t -s &lt;Standby Server&gt;\t\t\thost where the standby server is running on (required)\n\t -v &lt;PostgreSQL Major Release&gt;\t\tMajor Release Number 14 default (required)\n\t -h &lt;Help&gt;\t\t\t\tprints this help\n&#091;postgres@repmgr-02 \/]$ <\/code><\/pre>\n\n\n\n<p>OK, let it run.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;postgres@repmgr-02 data]$ sh \/opt\/pgsql\/config\/repMgrStanbySetup.sh -c Cluster-01 -p repmgr-01 -s repmgr-02 -v 14\n2022.08.11-17:39:53 &#091;13124]INFO: Setting node_id=2 in \/etc\/repmgr\/14\/repmgr.conf\nnode_id=2\n2022.08.11-17:39:53 &#091;13124]INFO: Setting node_name=repmgr-02 in \/etc\/repmgr\/14\/repmgr.conf\nnode_name=repmgr-02\n2022.08.11-17:39:53 &#091;13124]INFO: Setting conninfo='host=repmgr-02.localdomain user=repmgr dbname=repmgrdb' in \/etc\/repmgr\/14\/repmgr.conf\nconninfo='host=repmgr-02.localdomain user=repmgr dbname=repmgrdb'\n2022.08.11-17:39:53 &#091;13124]Info: Setting 'use_replication_slots=true'  in \/etc\/repmgr\/14\/repmgr.conf\nuse_replication_slots=true\n2022.08.11-17:39:53 &#091;13124]INFO: Setting data_directory='\/pgdata\/14\/data' in \/etc\/repmgr\/14\/repmgr.conf\ndata_directory='\/pgdata\/14\/data'\nNOTICE: destination directory \"\/pgdata\/14\/data\" provided\nINFO: connecting to source node\nDETAIL: connection string is: host=repmgr-01.localdomain user=repmgr dbname=repmgrdb\nDETAIL: current installation size is 34 MB\nNOTICE: checking for available walsenders on the source node (2 required)\nNOTICE: checking replication connections can be made to the source server (2 required)\nWARNING: data checksums are not enabled and \"wal_log_hints\" is \"off\"\nDETAIL: pg_rewind requires \"wal_log_hints\" to be enabled\nWARNING: directory \"\/pgdata\/14\/data\" exists but is not empty\nNOTICE: -F\/--force provided - deleting existing data directory \"\/pgdata\/14\/data\"\nNOTICE: starting backup (using pg_basebackup)...\nHINT: this may take some time; consider using the -c\/--fast-checkpoint option\nINFO: executing:\n  pg_basebackup -l \"repmgr base backup\"  -D \/pgdata\/14\/data -h repmgr-01.localdomain -p 5432 -U repmgr -X stream -S repmgr_slot_2 \nNOTICE: standby clone (using pg_basebackup) complete\nNOTICE: you can now start your PostgreSQL server\nHINT: for example: pg_ctl -D \/pgdata\/14\/data start\nHINT: after starting the server, you need to register this standby with \"repmgr standby register\"\n2022.08.11-17:39:53 &#091;13124]INFO: Registering standby returned 0\nINFO: connecting to local node \"repmgr-02\" (ID: 2)\nINFO: connecting to primary database\nWARNING: --upstream-node-id not supplied, assuming upstream node is primary (node ID: 1)\nINFO: standby registration complete\nNOTICE: standby node \"repmgr-02\" (ID: 2) successfully registered\nsetup of standby successfully completed\n&#091;postgres@repmgr-02 data]$ <\/code><\/pre>\n\n\n\n<p>The Cluster is up and running now.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;postgres@repmgr-01 \/]$ \/usr\/pgsql-14\/bin\/repmgr cluster show\n ID | Name      | Role    | Status    | Upstream  | Location | Priority | Timeline | Connection string                                     \n----+-----------+---------+-----------+-----------+----------+----------+----------+--------------------------------------------------------\n 1  | repmgr-01 | primary | * running |           | default  | 100      | 1        | host=repmgr-01.localdomain user=repmgr dbname=repmgrdb\n 2  | repmgr-02 | standby |   running | repmgr-01 | default  | 100      | 1        | host=repmgr-02.localdomain user=repmgr dbname=repmgrdb\n&#091;postgres@repmgr-01 \/]$ <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>With this blog I describe the installation of a PostgreSQL Cluster using repmgr instead of Patroni. Repmgr was originally developed by 2ndQuadrant which is now part of EDB and EDB decided for the 2ndQuadrant tools for the future, barman as backup solution from 2ndQ survives, Bart is canceled by EDB. At first I do a [&hellip;]<\/p>\n","protected":false},"author":28,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[198,83],"tags":[2602],"type_dbi":[],"class_list":["post-18416","post","type-post","status-publish","format-standard","hentry","category-database-management","category-postgresql","tag-postgresql-2"],"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 Cluster using repmgr - dbi Blog<\/title>\n<meta name=\"description\" content=\"PostgreSQL Cluster repmgr\" \/>\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-cluster-using-repmgr\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PostgreSQL Cluster using repmgr\" \/>\n<meta property=\"og:description\" content=\"PostgreSQL Cluster repmgr\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-11T15:53:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-08T14:39:42+00:00\" \/>\n<meta name=\"author\" content=\"Open source 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=\"Open source Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 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-cluster-using-repmgr\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/\"},\"author\":{\"name\":\"Open source Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b\"},\"headline\":\"PostgreSQL Cluster using repmgr\",\"datePublished\":\"2022-08-11T15:53:15+00:00\",\"dateModified\":\"2024-11-08T14:39:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/\"},\"wordCount\":437,\"commentCount\":0,\"keywords\":[\"postgresql\"],\"articleSection\":[\"Database management\",\"PostgreSQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/\",\"name\":\"PostgreSQL Cluster using repmgr - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2022-08-11T15:53:15+00:00\",\"dateModified\":\"2024-11-08T14:39:42+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b\"},\"description\":\"PostgreSQL Cluster repmgr\",\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PostgreSQL Cluster using repmgr\"}]},{\"@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\/59554f0d99383431eb6ed427e338952b\",\"name\":\"Open source Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g\",\"caption\":\"Open source Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/open-source-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"PostgreSQL Cluster using repmgr - dbi Blog","description":"PostgreSQL Cluster repmgr","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-cluster-using-repmgr\/","og_locale":"en_US","og_type":"article","og_title":"PostgreSQL Cluster using repmgr","og_description":"PostgreSQL Cluster repmgr","og_url":"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/","og_site_name":"dbi Blog","article_published_time":"2022-08-11T15:53:15+00:00","article_modified_time":"2024-11-08T14:39:42+00:00","author":"Open source Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Open source Team","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/"},"author":{"name":"Open source Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b"},"headline":"PostgreSQL Cluster using repmgr","datePublished":"2022-08-11T15:53:15+00:00","dateModified":"2024-11-08T14:39:42+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/"},"wordCount":437,"commentCount":0,"keywords":["postgresql"],"articleSection":["Database management","PostgreSQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/","url":"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/","name":"PostgreSQL Cluster using repmgr - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2022-08-11T15:53:15+00:00","dateModified":"2024-11-08T14:39:42+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b"},"description":"PostgreSQL Cluster repmgr","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/postgresql-cluster-using-repmgr\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"PostgreSQL Cluster using repmgr"}]},{"@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\/59554f0d99383431eb6ed427e338952b","name":"Open source Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g","caption":"Open source Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/open-source-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/18416","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\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=18416"}],"version-history":[{"count":23,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/18416\/revisions"}],"predecessor-version":[{"id":21258,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/18416\/revisions\/21258"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=18416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=18416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=18416"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=18416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}