Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tAO0L-00FRjb-RC for pgsql-admin@arkaria.postgresql.org; Mon, 11 Nov 2024 06:34:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tAO0I-00Bqyj-Sm for pgsql-admin@arkaria.postgresql.org; Mon, 11 Nov 2024 06:34:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tAO0I-00Bqws-Ey for pgsql-admin@lists.postgresql.org; Mon, 11 Nov 2024 06:34:27 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tAO0F-001JdN-1G for pgsql-admin@postgresql.org; Mon, 11 Nov 2024 06:34:26 +0000 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5ceccffadfdso5763537a12.2 for ; Sun, 10 Nov 2024 22:34:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731306863; x=1731911663; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=g4faKKe8oMDKqrv6tu9BOU/21iDCPAK5/cFQ9sdESKU=; b=ZC7Z81QwnzdOIskTGyDLG+++SIJMzTDiqukAI4xs4pZIHI/aLm4qBD+zLC1FTVBPS6 SVdrvpqfJc/tBxaOSeBv8ct8V+a/RofF5432BNtY+jpHOt/EdKd7jWzVLsGIEvF6x0Du 27X9Z/hgRKHLB8Ko972uyQBZySw5sf1mc6gHlCEchayLQ0JzAG2j6y5I95cEyDBHbLgV f1+vFHVbmJfnULwa1X7lyW2TnV2g76SoN0wIJCZu76I9bljKzk2u91o53BwU+8flKs/V bSvQAtQ2G3Fw/ldbfOeO1575JzpHbN4Misfdt4uSOgPMcB25Fdwthw69zVkctXS7b3Zb EXcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731306863; x=1731911663; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=g4faKKe8oMDKqrv6tu9BOU/21iDCPAK5/cFQ9sdESKU=; b=Z8WyJUTTCOvZORchCAjj5/whzMHmWWClp/lxvemRf46wfzK3KoTYCcw0txEm3A5aLL nFKjRLvE50uoCjj1xatnNmzxJNHZ83Q9H0apTgDq5p5BGE9C80Qtb7S4qweHYiCoKfYG ucSCCevN/TDse8l+/eCi5yLDY470+McUrok2LBkYzQr2YG41ncyqWQSZR/HWw3LCClYf xvnIZBDFzBygIZx7HNiVeboFWMlI7y+kGfvLATbMZhTjgOJxGCTBlvrqgEQY8Uv41+Kb OBPdIMDfI7QPO1UxIf/ctAA9zXJNJFDgDDoDeNvK/2yRksUyZpqMdLUOZe4wOsaXScPM O8Yg== X-Gm-Message-State: AOJu0YwL41Ahn6NWtOgTRAKR7HIXLABcer03rBvVxlXR+mXs6zlJQ8+G aidkXHORKdzGRY/dif8zl1Kr7rrw/LfnZDFuoxfVrGP1UD2IzL5Xdn58clTCi/3H4OalQS1cfaS aBV62hyyvOwoNc7h2tFhAaBpW/CM= X-Google-Smtp-Source: AGHT+IFHgNOju4256xWYYd5fL6Bc2IQG5JaJvMY3teHp5GEkeQNXSV0yar6kBtOgisCqpYQZjS+UzCttBU806CJ+n4Y= X-Received: by 2002:a05:6402:d05:b0:5ce:e067:27aa with SMTP id 4fb4d7f45d1cf-5cf0a45e713mr8104076a12.32.1731306862789; Sun, 10 Nov 2024 22:34:22 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Zaid Shabbir Date: Mon, 11 Nov 2024 11:34:11 +0500 Message-ID: Subject: Re: Inquiry on Setting Up Automatic Failover with Stream Replication To: p sn Cc: pgsql-admin@postgresql.org Content-Type: multipart/alternative; boundary="0000000000008dcc1806269d4a2c" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000008dcc1806269d4a2c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, *Authentication Options*: You may use any authentication method you prefer, such as scram-sha-256, md5 or cert for certificate-based authentication, to ensure secure connections. *Replication User Configuration*: For the replication user make sure both nodes replication users set in pg_hba.conf like - On *Node 1* (192.168.1.1): host replication replicator 192.168.1.2/32 scram-sha-256 - On *Node 2* (192.168.1.2): host replication replicator 192.168.1.1/32 scram-sha-256 Ensure pg_hba.conf on each node allows connections from the other node=E2= =80=99s IP, and postgresql.conf has listen_addresses set to accept connections from the other node=E2=80=99s IP (or '*' to allow all IPs). *Apply Configuration*: After making these changes, restart both servers to apply them. *Failover: *By default failover is not available but a couple of reliable open source products available like 1. repmgr [Link] 2. petroni [Link] 3. pg_auto_failover [Link] Hope this helps you configure your environment. On Mon, Nov 11, 2024 at 11:03=E2=80=AFAM p sn wrote: > Hello, I am currently setting up PostgreSQL Stream Replication for a > replication configuration. > > I am using PostgreSQL version 14.12 on a RedHat 8.9 environment, > and my setup consists of a Primary-Standby replication configuration with > two nodes. > Due to certain constraints, I cannot add more nodes or use external > nodes. > > Questions: > 1-1. How should I configure postgresql.conf and pg_hba.conf for this > setup? I would like to implement automatic failover with only these two > nodes. > 1-2. Is it possible to achieve this setup? If so, could you advise on > the specific configuration steps needed? I would greatly appreciate any > guidance from those with experience in this area. Thank you. > > > Best regards, > --0000000000008dcc1806269d4a2c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

Authentication Options:=C2=A0You may use any authentication me= thod you prefer, such as scram-sha-256, md5 or cert for certificate-based a= uthentication, to ensure secure connections.

Replication User Configuration:=C2=A0For = the replication user make sure both nodes replication users set in pg_hba.c= onf like

  • On=C2=A0Node 1=C2=A0(192.168.1.1):
    host replication replica= tor 192.168.1.2/32 scram-sha-256
  • On=C2=A0Node 2=C2=A0(= 192.168.1.2):
    host replication replicator 192.168.1.1/32 scram-sha-256
Ensure pg_hba.conf on each node allows connecti= ons from the other node=E2=80=99s IP, and postgresql.conf has listen_addres= ses set to accept connections from the other node=E2=80=99s IP (or '*&#= 39; to allow all IPs).


Apply Configuration:=C2=A0After making these changes, restart= both servers to apply them.

Failover:=C2=A0By default failover is not avai= lable but a couple of reliable open source products available like
=C2=A0=C2=A01. r= epmgr [Link]
=C2=A0 2. pet= roni [Link]
=
=C2=A0 3. pg_auto_failover=C2=A0[Link]

Hope this helps you configure your environment.



On Mon, Nov 11, 2024 at 11:03=E2=80=AFAM p sn= <tkdsud01@gmail.com> wrote= :
=C2=A0 Hello, I am currently setting up PostgreSQL Stream Replication for a = replication configuration.=C2=A0

=C2=A0I am using<= /span> PostgreSQL version 14.12 on a RedHat=C2=A0= 8.9 environment,=C2=A0
and my setup consists = of a Primary-Standby replication configuration with two nodes.
=C2=A0Due to certain constraints, I ca= nnot add more nodes or use external nodes.=C2=A0
=C2=A0 Questions:=C2=A0
=C2=A0 =C2=A0 1-1. How= should I configure postgresql.conf and pg_hba.conf for<= /span> this setup? I would like to implement automatic failover with only these two nodes.=C2=A0
=C2=A0 =C2=A0 1-2= . Is it possible to achieve this setup? If= so, could you advise on the specific configuration steps need= ed? I would greatly appreciate any guidance from those w= ith experience in this area. Thank you.=C2=A0


=C2=A0Best regards,=C2=A0=C2=A0
<= /div>
--0000000000008dcc1806269d4a2c--