Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lCJhh-0004l2-RR for pgsql-general@arkaria.postgresql.org; Wed, 17 Feb 2021 10:05:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lCJhg-0008Sk-O2 for pgsql-general@arkaria.postgresql.org; Wed, 17 Feb 2021 10:05:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lCJhg-0008Sd-EK for pgsql-general@lists.postgresql.org; Wed, 17 Feb 2021 10:05:04 +0000 Received: from mail-qt1-x829.google.com ([2607:f8b0:4864:20::829]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lCJhZ-0001U0-Uq for pgsql-general@lists.postgresql.org; Wed, 17 Feb 2021 10:05:03 +0000 Received: by mail-qt1-x829.google.com with SMTP id e11so9090519qtg.6 for ; Wed, 17 Feb 2021 02:04:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:references:from:subject:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Lalxp/fmnpIkKhMm8bzb/qq30Noeqjt0cLboo/QIlJY=; b=SlGTp3C7NlaBMQq2Zy3N27mycp7/visnRTieQlH+n46LBzTE75RX3Zz9PDYQoB9ljI DIVOHV5qfAQlHCDyQcwDjzkAVxT1lgj3NhlVHX9JY9dyQ9GZWQQghQTMzckfM+dDCkkx VPDv639c55hYiVZJzzY4Y98WPQBKKhy8gPx/kdQtB9bLL6aV4BO5uD5HsITfcWFk1GeL vRR0rCmrKS0RHsXdA/jYoqqaUijXwcJ4g7UiZL9OdNAV7/wyiNqzssO8rha16e2gkVNZ W0KwxT8lgfzFRgKO8waJEKK39c1NqoEnPqVpn4ldvdu9ltwArC4OyBYd4euFRoLez4in l3QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Lalxp/fmnpIkKhMm8bzb/qq30Noeqjt0cLboo/QIlJY=; b=kvLLduPLuH6aZqWN41LosiiPSfd+JT1rU9/rpsB6Rpf36Xs9mAtqTvrmBpyRQZ7/FW D8hbO5ySNPhPSVV5RUGlelScGKk0NKbYCaTtpA2vb5qFIdBHnkfv5akFNUJGCreauWME JuVrNJJQkbJZuQnEFFriyUZnVrAyUxveP81ThTQ7btLgTk7mOVWhaIe1XdGvUptx633F 9cTblJUsMb5SAy6WN0buGvJxZk8DySF3r1gogTUsIHJQf32FOsPnTAyNSCRg+ISFuB/K 1Mgb8H78DpnFRqk6Iv4M5wb36Af6Zhxf7ITFl7tG1Iv98riAA4cI4ZBqyqJYqymrLvSs n7Kg== X-Gm-Message-State: AOAM5314Yk2TTwvt2J7j0T07EgxXfP10IRbYEc8RAxl/WARsuo5TPMwm rTtE9jaTkQPkhQlAwuk6BomkGx99hpHASQ== X-Google-Smtp-Source: ABdhPJwe0CjMWAI+TAa4VL5A3gS0JrgN63+zzNQsRWuUzfHAIVAYh47X8RcHrrFCQeHk5azmaOMKbA== X-Received: by 2002:a05:622a:47:: with SMTP id y7mr22663543qtw.391.1613556296148; Wed, 17 Feb 2021 02:04:56 -0800 (PST) Received: from [192.168.67.200] (dsl-66-36-157-191.mtl.aei.ca. [66.36.157.191]) by smtp.gmail.com with ESMTPSA id f8sm884936qtp.32.2021.02.17.02.04.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Feb 2021 02:04:55 -0800 (PST) To: Mutuku Ndeti Cc: pgsql-general@lists.postgresql.org References: <5269d50b-3d30-d36b-a7a6-f54f34eeff57@gmail.com> From: Thomas Guyot Subject: Re: PostgreSQL Replication Message-ID: Date: Wed, 17 Feb 2021 05:04:54 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2021-02-17 04:22, Mutuku Ndeti wrote: > Thank you.  > > I agree with you. Single master, with a standby replica, seems easier to > manage. Is there a way to automatically promote the standby, when the > active master fails? Is it feasible to have 2 instances of the > application, writing onto the same DB, reason for two instances of the > application is to allow for redundancy/load balancing.  > Again, not being PostgreSQL-specific, it is possible to have an active/standby master node with shared storage (ex fibrechannel, iscsi... it can only be mounted on only one node at any given time and it's the cluster's responsibility to ensure the other node has unmounted properly). This is ideal when dealing with fully redundant storage arrays, and fairly simple to setup on the cluster side. Attaching additional slaves to an active/standby cluster is also usually simpler since there is just one server/replication log. Another solution is to have a replication ring (ex. A replicates to B, B replicates to A). With such setup it is very important writes only ever happen on a single node, and is easiest to do so by using a floating IP that can only be reached from one node at any given time (again it's the cluster's responsibility to ensure the floating IP is never on both). This method may require a more complex configuration to ensure updates are consistent and to keep additional slaves synchronized to the cluster. Also since both servers have a permanent IP it is important to ensure no updates are made directly to them. The warm side can still be used for read-only access though (with a very small lag). In either case, there is likely some configuration needed. This page seems to list a few projects that may make your cluster setup much easier: https://wiki.postgresql.org/wiki/Replication,_Clustering,_and_Connection_Pooling Regards, -- Thomas