{"id":13345,"date":"2020-02-03T07:00:02","date_gmt":"2020-02-03T06:00:02","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\/"},"modified":"2020-02-03T07:00:02","modified_gmt":"2020-02-03T06:00:02","slug":"setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\/","title":{"rendered":"Setup a two node Postgres HA Cluster using EDB Advanced Server and EFM"},"content":{"rendered":"<p>Some time ago I had a customer looking for a two node PostgreSQL Master\/Replica solution. As we need Oracle compatibility in a later step, we decided to go with the EnterpriseDB tools. This article should give you an introduction on how to setup the environment.<\/p>\n<h3>Prerequisites<\/h3>\n<p>There are just some few things, that you need to prepare.<br \/>\nYou need (at least) three servers with:<\/p>\n<ul>\n<li>EPEL repository available<\/li>\n<li>Subscription for EDB<\/li>\n<li>EDB repository available<\/li>\n<\/ul>\n<p>To make everything working with our DMK some folders and links are needed:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\nmkdir -p \/u01\/app\/postgres\/product\/as11\nmkdir -p \/u01as11\nmkdir -p \/usr\/edb\nmkdir -p \/u02\/pgdata\/11\/PG1\nln -s \/u02\/pgdata\/11\/PG1\/ \/u01as11\/data\nln -s \/u01\/app\/postgres\/product\/as11\/ \/usr\/edb\/as11\nyum install -y unzip xorg-x11-xauth screen<\/code>\n<\/pre>\n<h3>EDB Advanced Server<\/h3>\n<h4>Installation<\/h4>\n<p>Let&#8217;s start with the installation of the <a href=\"https:\/\/www.enterprisedb.com\/enterprise-postgres\/edb-postgres-advanced-server\" target=\"\u201d_blank\u201d\" rel=\"noopener noreferrer\"> EDB Advanced Server <\/a>  This is really straight forward:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ yum install edb-as11-server\n$ chown enterprisedb:enterprisedb \/u02\/pgdata\/11\/epg1\/\n$ chown -R enterprisedb:enterprisedb \/u01\/app\/\n$ rm -rf \/u01as11\/backups\/\n$ passwd enterprisedb\n<\/pre>\n<p>Now you can install and configure our <a href=\"https:\/\/www.dbi-services.com\/offering\/products\/dmk-management-kit\/\" target=\"_blank\" rel=\"noopener noreferrer\">DMK<\/a>. Make sure to adjust var::PGUSER::=::nooption::&#8221;enterprisedb&#8221; in the dmk.conf.<\/p>\n<p>As soon as the installation is done, you can initialize a new primary cluster. <\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\nenterprisedb@edb1:\/var\/lib\/edb\/ [PG1] cat \/etc\/pgtab\nPG1:\/u01\/app\/postgres\/product\/as11\/:\/u02\/pgdata\/11\/PG1\/:5444:Y\nenterprisedb@edb1:\/var\/lib\/edb\/ [PG1] dmk\nenterprisedb@edb1:\/var\/lib\/edb\/ [pg950] PG1\n\n********* dbi services Ltd. ****************\n\nSTATUS           : CLOSED\n\n********************************************\nenterprisedb@ad1:\/var\/lib\/edb\/ [PG1] sudo mkdir -p \/u02\/pgdata\/PG1\nenterprisedb@ad1:\/var\/lib\/edb\/ [PG1] sudo chown enterprisedb:enterprisedb \/u02\/pgdata\/PG1\nenterprisedb@ad1:\/var\/lib\/edb\/ [PG1] \/u01\/app\/postgres\/product\/as11\/bin\/initdb --pgdata=\/u02\/pgdata\/PG1\/ --pwprompt --data-checksums --auth=md5\nThe files belonging to this database system will be owned by user \"enterprisedb\".\nThis user must also own the server process.\n\nThe database cluster will be initialized with locale \"en_US.UTF-8\".\nThe default database encoding has accordingly been set to \"UTF8\".\nThe default text search configuration will be set to \"english\".\n\nData page checksums are enabled.\n\nEnter new superuser password:\nEnter it again:\n\nfixing permissions on existing directory \/u02\/pgdata\/PG1 ... ok\ncreating subdirectories ... ok\nselecting default max_connections ... 100\nselecting default shared_buffers ... 128MB\nselecting default timezone ... Europe\/Berlin\nselecting dynamic shared memory implementation ... posix\ncreating configuration files ... ok\nrunning bootstrap script ... ok\nperforming post-bootstrap initialization ... ok\ncreating edb sys ... ok\nloading edb contrib modules ...\nedb_redwood_bytea.sql ok\nedb_redwood_date.sql ok\ndbms_alert_public.sql ok\ndbms_alert.plb ok\ndbms_job_public.sql ok\ndbms_job.plb ok\ndbms_lob_public.sql ok\ndbms_lob.plb ok\ndbms_output_public.sql ok\ndbms_output.plb ok\ndbms_pipe_public.sql ok\ndbms_pipe.plb ok\ndbms_rls_public.sql ok\ndbms_rls.plb ok\ndbms_sql_public.sql ok\ndbms_sql.plb ok\ndbms_utility_public.sql ok\ndbms_utility.plb ok\ndbms_aqadm_public.sql ok\ndbms_aqadm.plb ok\ndbms_aq_public.sql ok\ndbms_aq.plb ok\ndbms_profiler_public.sql ok\ndbms_profiler.plb ok\ndbms_random_public.sql ok\ndbms_random.plb ok\ndbms_redact_public.sql ok\ndbms_redact.plb ok\ndbms_lock_public.sql ok\ndbms_lock.plb ok\ndbms_scheduler_public.sql ok\ndbms_scheduler.plb ok\ndbms_crypto_public.sql ok\ndbms_crypto.plb ok\ndbms_mview_public.sql ok\ndbms_mview.plb ok\ndbms_session_public.sql ok\ndbms_session.plb ok\nedb_bulkload.sql ok\nedb_gen.sql ok\nedb_objects.sql ok\nedb_redwood_casts.sql ok\nedb_redwood_strings.sql ok\nedb_redwood_views.sql ok\nutl_encode_public.sql ok\nutl_encode.plb ok\nutl_http_public.sql ok\nutl_http.plb ok\nutl_file.plb ok\nutl_tcp_public.sql ok\nutl_tcp.plb ok\nutl_smtp_public.sql ok\nutl_smtp.plb ok\nutl_mail_public.sql ok\nutl_mail.plb ok\nutl_url_public.sql ok\nutl_url.plb ok\nutl_raw_public.sql ok\nutl_raw.plb ok\ncommoncriteria.sql ok\nwaitstates.sql ok\ninstalling extension edb_dblink_libpq ... ok\ninstalling extension edb_dblink_oci ... ok\ninstalling extension pldbgapi ... ok\nsnap_tables.sql ok\nsnap_functions.sql ok\ndblink_ora.sql ok\nsys_stats.sql ok\nfinalizing initial databases ... ok\nsyncing data to disk ... ok\n\nSuccess. You can now start the database server using:\n\n    \/u01\/app\/postgres\/product\/as11\/bin\/pg_ctl -D \/u02\/pgdata\/PG1\/ -l logfile start\n\nenterprisedb@ad1:\/var\/lib\/edb\/ [PG1]\n<\/pre>\n<p>Than adjust wal_keep_segments and afterwards the edb-as service can be enabled and started.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ echo \"wal_keep_segments=100\" &gt;&gt; $PGDATA\/postgresql.auto.conf\n$ sudo systemctl enable edb-as-11.service\n$ sudo systemctl start edb-as-11\n<\/pre>\n<p>To be sure everything works as expected, reboot the server (if possible).<\/p>\n<p>All above steps should also be done on your additional nodes, but without the systemctl start. <\/p>\n<h4> Configuration <\/h4>\n<p>First, on Node 1 (Master) you need to create the replication role.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\npostgres=# create role replication with REPLICATioN PASSWORD 'replication' login;\nCREATE ROLE\n<\/pre>\n<p>Second, you need to add replication to pg_hba.conf.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\nlocal   replication    all             127.0.0.1\/32            trust\nhost    replication    all             192.168.22.53\/32        trust\nhost    replication    all             192.168.22.51\/32        trust\nhost    replication    all             192.168.22.52\/32        trust\nhost    replication    all             ::1\/128                 trust\n<\/pre>\n<p>And last but not least, your should exchange the ssh-key of all nodes:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\nenterprisedb@edb1:\/u01 [PG1] ssh-keygen\nenterprisedb@edb1:\/u01 [PG1] ssh-copy-id enterprisedb@edb1\nenterprisedb@edb1:\/u01 [PG1] ssh-copy-id enterprisedb@edb2\nenterprisedb@edb1:\/u01 [PG1] ssh-copy-id enterprisedb@edb3\n<\/pre>\n<h4> Create the replica <\/h4>\n<p>As already mentioned, you need almost all steps done on Node 2 as well, but without starting the service.<br \/>\nMake sure to have all hosts in pg_hba.conf of Master. <\/p>\n<p>To create the replication create a pg_basebackup into Node 2:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\nenterprisedb@edb2:\/u01 [PG1] pg_basebackup -h 192.168.22.51 -U replication -p 5432 -D $PGDATA -Fp -Xs -P -R\n49414\/49414 kB (100%), 1\/1 tablespace\n<\/pre>\n<p>Once finish, check if the recovery.conf is available and add the following lines:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\nenterprisedb@edb2:\/u01 [PG1] echo \"recovery_target_timeline = 'latest'\" &gt;&gt; \/u02\/pgdata\/11\/PG1\/recovery.conf\nenterprisedb@edb2:\/u01 [PG1] echo \"trigger_file='\/u02\/pgdata\/11\/PG1\/trigger_failover'\" &gt;&gt; \/u02\/pgdata\/11\/PG1\/recovery.conf\n<\/pre>\n<p>To test, if the recovery is working, start the cluster and check the recovery status.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\nenterprisedb@edb2:\/u01 [PG1] pgstart\nenterprisedb@edb2:\/u01 [PG1] psql -U enterprisedb -c \"select pg_is_in_recovery()\" postgres\n pg_is_in_recovery\n-------------------\n t\n(1 row)\n\nenterprisedb@edb2:\/u01 [PG1] sudo systemctl enable edb-as-11.service\nenterprisedb@edb2:\/u01 [PG1] pgstop\nenterprisedb@edb2:\/u01 [PG1] systemctl start edb-as-11\n<\/pre>\n<h3> EDB Postgres Failover Manager (EFM) <\/h3>\n<p>To make our two Node setup High Available, we need to install the <a href=\"https:\/\/www.enterprisedb.com\/enterprise-postgres\/edb-postgres-failover-manager\" target=\"\u201d_blank\u201d\" rel=\"noopener noreferrer\"> EDB Postgres Failover Manager <\/a> on three nodes. On the both installed with the Master \/ Replica and on a third one as a witness server.<\/p>\n<h4> Installation <\/h4>\n<p>Installation for EFM is straight forward as well, therefore your have to do the following steps on all three nodes. To use EFM toghether with our DMK, you need to create some links.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ sudo yum install edb-efm37\n$ sudo yum install java-1.8.0-openjdk\n$ sudo chown -R enterprisedb:enterprisedb \/etc\/edb\/efm-3.7\/\n$ cat \/etc\/edb\/efm-3.7\/efm.nodes\n$ sudo ln -s \/usr\/edb\/efm-3.7 \/usr\/edb\/efm\n$ sudo ln -s \/etc\/edb\/efm-3.7 \/etc\/edb\/efm\n<\/pre>\n<h4> Configuration <\/h4>\n<p>On the master you have to set a password for the enterprisedb user and encrypt the password using EFM.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ psql -U enterprisedb -c \"alter user enterprisedb with password '*******'\" postgres\n$ \/usr\/edb\/efm\/bin\/efm encrypt efm\n<\/pre>\n<p>The enrypted password generated by efm encrypt will be needed in the efm.properties files<\/p>\n<p>As next step we need an efm.properties file on Node 1 and 2 (parameters to adjust below).<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ cp \/u01\/app\/postgres\/local\/dmk\/templates\/postgres\/efm.properties.in \/etc\/edb\/efm-3.7\/efm.properties\n$ vi \/etc\/edb\/efm-3.7\/efm.properties\n  db.user=enterprisedb\n  db.password.encrypted=f17db6033ef1be48ec1955d38b4c9c46\n  db.port=5400\n  db.database=postgres\n  db.bin=\/u01\/app\/postgres\/product\/as11\/bin\n  db.recovery.dir=\/u02\/pgdata\/11\/EPAS\n  bind.address=192.168.22.51:7800\n  admin.port=7809\n  is.witness=false \n  virtualIp=192.168.22.55\n  virtualIp.interface=enp0s8\n  virtualIp.prefix=24\n  virtualIp.single=true\n$ sudo chown enterprisedb:enterprisedb \/etc\/edb\/efm\/efm.properties\n<\/pre>\n<p>We also need a efm.nodes file to have all nodes of the cluster.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ cat \/etc\/edb\/efm\/efm.nodes\n# List of node address:port combinations separated by whitespace.\n# The list should include at least the membership coordinator's address.\n192.168.22.51:7800 192.168.22.52:7800 192.168.22.53:7800\n$ chown efm:efm efm.nodes\n$ chmod 660 \/etc\/edb\/efm\/efm.nodes\n<\/pre>\n<p>To conclude, enable and start the efm-3.7.service.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\nsudo systemctl enable efm-3.7.service\nsudo systemctl start efm-3.7.service\n<\/pre>\n<p>On node 3 we need to create a efm.properties file as well, but we need the efm.properties_witness file of dmk as draft.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ cp \/u01\/app\/postgres\/local\/dmk\/templates\/postgres\/efm.properties_witness \/etc\/edb\/efm-3.7\/efm.properties\n<\/pre>\n<p>Adjust the parameters as shown in the step for node 1 and 2, but be careful to have: <\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\nis.witness=true\n<\/pre>\n<p>Afterwards start the efm-3.7 service on node 3 as well.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ sudo systemctl start efm-3.7.service\n<\/pre>\n<p>In the end, you can check if everything is running as expected using EFM.<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">\n$ efm cluster-status efm\nCluster Status: efm\n\n        Agent Type  Address              Agent  DB       VIP\n        -----------------------------------------------------------------------\n        Standby     192.168.22.51        UP     UP       192.168.22.55\n        Master      192.168.22.52        UP     UP       192.168.22.55*\n        Witness     192.168.22.53        UP     N\/A      192.168.22.55\n\nAllowed node host list:\n        192.168.22.52 192.168.22.51 192.168.22.53\n\nMembership coordinator: 192.168.22.52\n\nStandby priority host list:\n        192.168.22.51\n\nPromote Status:\n\n        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info\n        ---------------------------------------------------------------------------\n        Master      192.168.22.52                           0\/110007B8\n        Standby     192.168.22.51        0\/110007B8         0\/110007B8\n\n        Standby database(s) in sync with master. It is safe to promote.\n\n<\/pre>\n<p>That&#8217;s it, now you have a Master\/Replica system using EDB tools.<br \/>\nIn a next step we will have a look at the setup of the cluster monitoring using EDB Enterprise Manager.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some time ago I had a customer looking for a two node PostgreSQL Master\/Replica solution. As we need Oracle compatibility in a later step, we decided to go with the EnterpriseDB tools. This article should give you an introduction on how to setup the environment. Prerequisites There are just some few things, that you need&hellip;&nbsp;<\/p>\n","protected":false},"author":28,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","neve_meta_reading_time":"","_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[4133],"tags":[1537,713,84],"class_list":["post-13345","post","type-post","status-publish","format-standard","category-database","tag-edb-efm","tag-enterprisedb","tag-high-availability"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.8 (Yoast SEO v28.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Setup a two node Postgres HA Cluster using EDB Advanced Server and EFM - dbi services 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\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Setup a two node Postgres HA Cluster using EDB Advanced Server and EFM\" \/>\n<meta property=\"og:description\" content=\"Some time ago I had a customer looking for a two node PostgreSQL Master\/Replica solution. As we need Oracle compatibility in a later step, we decided to go with the EnterpriseDB tools. This article should give you an introduction on how to setup the environment. Prerequisites There are just some few things, that you need&hellip;&nbsp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi services Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/dbiservices\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-02-03T06:00:02+00:00\" \/>\n<meta name=\"author\" content=\"Open source Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:site\" content=\"@dbiservices\" \/>\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=\"8 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\\\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\\\/\"},\"author\":{\"name\":\"Open source Team\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/0b4548362cac3eeff8b3eaf329e3530a\"},\"headline\":\"Setup a two node Postgres HA Cluster using EDB Advanced Server and EFM\",\"datePublished\":\"2020-02-03T06:00:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\\\/\"},\"wordCount\":549,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"keywords\":[\"edb efm\",\"EnterpriseDB\",\"High Availability\"],\"articleSection\":[\"Database\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\\\/\",\"name\":\"Setup a two node Postgres HA Cluster using EDB Advanced Server and EFM - dbi services Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"datePublished\":\"2020-02-03T06:00:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Setup a two node Postgres HA Cluster using EDB Advanced Server and EFM\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi services Blog\",\"description\":\"#BeSharing\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"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\":\"Organization\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\",\"name\":\"dbi services\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"width\":512,\"height\":512,\"caption\":\"dbi services\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/dbiservices\\\/\",\"https:\\\/\\\/x.com\\\/dbiservices\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/dbi-services\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/dbiservices\"],\"description\":\"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.\",\"email\":\"info@dbi-services.com\",\"telephone\":\"+41 32 422 96 00\",\"legalName\":\"dbi services SA\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/0b4548362cac3eeff8b3eaf329e3530a\",\"name\":\"Open source Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/open-source-author.png\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/open-source-author.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/open-source-author.png\",\"caption\":\"Open source Team\"},\"description\":\"Posts published under the Open source Team account are collective contributions by the dbi services open infrastructure consultants. The practice covers open-source databases and platforms, PostgreSQL first of all, along with MySQL, MariaDB, and Linux, from architecture, replication, and high availability to performance tuning and operations under service level agreements, and contributes actively to the PostgreSQL community.\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/open-source-team\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Setup a two node Postgres HA Cluster using EDB Advanced Server and EFM - dbi services 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\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\/","og_locale":"en_US","og_type":"article","og_title":"Setup a two node Postgres HA Cluster using EDB Advanced Server and EFM","og_description":"Some time ago I had a customer looking for a two node PostgreSQL Master\/Replica solution. As we need Oracle compatibility in a later step, we decided to go with the EnterpriseDB tools. This article should give you an introduction on how to setup the environment. Prerequisites There are just some few things, that you need&hellip;&nbsp;","og_url":"https:\/\/www.dbi-services.com\/blog\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\/","og_site_name":"dbi services Blog","article_publisher":"https:\/\/www.facebook.com\/dbiservices\/","article_published_time":"2020-02-03T06:00:02+00:00","author":"Open source Team","twitter_card":"summary_large_image","twitter_creator":"@dbiservices","twitter_site":"@dbiservices","twitter_misc":{"Written by":"Open source Team","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\/"},"author":{"name":"Open source Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/0b4548362cac3eeff8b3eaf329e3530a"},"headline":"Setup a two node Postgres HA Cluster using EDB Advanced Server and EFM","datePublished":"2020-02-03T06:00:02+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\/"},"wordCount":549,"commentCount":0,"publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"keywords":["edb efm","EnterpriseDB","High Availability"],"articleSection":["Database"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\/","url":"https:\/\/www.dbi-services.com\/blog\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\/","name":"Setup a two node Postgres HA Cluster using EDB Advanced Server and EFM - dbi services Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2020-02-03T06:00:02+00:00","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/setup-a-two-node-postgres-ha-cluster-using-edb-advanced-server-and-efm\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Setup a two node Postgres HA Cluster using EDB Advanced Server and EFM"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi services Blog","description":"#BeSharing","publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"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":"Organization","@id":"https:\/\/www.dbi-services.com\/#organization","name":"dbi services","url":"https:\/\/www.dbi-services.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","width":512,"height":512,"caption":"dbi services"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/dbiservices\/","https:\/\/x.com\/dbiservices","https:\/\/www.linkedin.com\/company\/dbi-services\/","https:\/\/www.youtube.com\/user\/dbiservices"],"description":"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.","email":"info@dbi-services.com","telephone":"+41 32 422 96 00","legalName":"dbi services SA"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/0b4548362cac3eeff8b3eaf329e3530a","name":"Open source Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/05\/open-source-author.png","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/05\/open-source-author.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/05\/open-source-author.png","caption":"Open source Team"},"description":"Posts published under the Open source Team account are collective contributions by the dbi services open infrastructure consultants. The practice covers open-source databases and platforms, PostgreSQL first of all, along with MySQL, MariaDB, and Linux, from architecture, replication, and high availability to performance tuning and operations under service level agreements, and contributes actively to the PostgreSQL community.","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\/13345","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=13345"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/13345\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=13345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=13345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=13345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}