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 1ox8g4-00083G-7y for pgsql-admin@arkaria.postgresql.org; Mon, 21 Nov 2022 15:25:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ox8g2-0002UZ-Pe for pgsql-admin@arkaria.postgresql.org; Mon, 21 Nov 2022 15:25:42 +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 1ox8g2-0002UP-FJ for pgsql-admin@lists.postgresql.org; Mon, 21 Nov 2022 15:25:42 +0000 Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ox8fw-00057C-1s for pgsql-admin@lists.postgresql.org; Mon, 21 Nov 2022 15:25:41 +0000 Received: by mail-qt1-x82c.google.com with SMTP id h21so7439248qtu.2 for ; Mon, 21 Nov 2022 07:25:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=Hs8UZSRKVBVS8XGWjoqRcDYOhmCU+Gww6e2NsLfBGug=; b=C6BhZk1SKC4awTVoQT1slB7ADwF58Phm6Y1Bkqio0P6wK/zTIySETz/feeef8b9sCz h9tGINVnoxqPTJOSIG3dX48wiVhEoGQZTiQu5y+puhA+WMp2xyWqHz6DANAm0I65/ZJT 1m81PTgszOg45jGmL87H5zAVLdoSCntMHLiw6gpO9R+IWminSD99mXzLfL2ZVV+j9zuD P69cw/rPF4jbc8gCYvnTdxA6MKL5ZheEdb2XEjyXJpd6dm0HG6whgfa2wY8RStA1dQcI m1qZaXZTlTY6NWAWcfeWlJBl8KA9C7CUJ0iMEvQTBl8riCcn729k4oCB6FEMep+QAFeQ 6A/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=Hs8UZSRKVBVS8XGWjoqRcDYOhmCU+Gww6e2NsLfBGug=; b=iJchUpVvedp02VF01Fywnf5oavCECL+x/n4PZkKAs42aLefQt3eDU+B2zLB5BDs3ne e0lgUetGftz/17CINjghXB8AeDgX5eOshFAKA4Uxxz28krP463lwT3gW3PYD+PEgCTrO pZyfez3FirJaAlo488OfQp33h6mmCV0hXAkFnBdUxwH5YkBi8+OvHQz3Kn4TXTWznG/n tITvh1vKpXND/fuayfq2ehl/gcXjKbiAGWeiNbGxgm4Sc/URGJLFtWV58MNfpHH7P05H eqt82Anry2hxeGXdAoKke6gz1ie/l2vd1rXc5g/IpMr/Dprz+I+8En6Mtol1KCI1ILKU Eb6w== X-Gm-Message-State: ANoB5pmZyrWGBukYRgwrdl+yW3zGxVKv1VgXrkeYZubJNSm1iBKYI1HO Xuzip30rPhxZtX8rEL5MXMqwR5+qnic= X-Google-Smtp-Source: AA0mqf5kQm3w6YqPRQh6SKI1m0puJ6reyq7WPaG6k10rUVxg/YhZOxaTnM1iavuNpdziS4PnnkgCnA== X-Received: by 2002:a05:622a:5a15:b0:3a5:3388:4089 with SMTP id fy21-20020a05622a5a1500b003a533884089mr17427814qtb.601.1669044334677; Mon, 21 Nov 2022 07:25:34 -0800 (PST) Received: from ?IPV6:2600:1700:bd2c:b810::43? ([2600:1700:bd2c:b810::43]) by smtp.googlemail.com with ESMTPSA id cm5-20020a05622a250500b0039853b7b771sm6883227qtb.80.2022.11.21.07.25.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Nov 2022 07:25:34 -0800 (PST) Content-Type: multipart/alternative; boundary="------------JBwV0Zt5crRt0dQXQN0yLh6q" Message-ID: <3b72f6be-3d45-d857-bcb7-86c031d7a6bf@gmail.com> Date: Mon, 21 Nov 2022 09:25:33 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: Client IP in Patroni Content-Language: en-US To: pgsql-admin@lists.postgresql.org References: From: Ron In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------JBwV0Zt5crRt0dQXQN0yLh6q Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 11/21/22 09:14, Anjul Tyagi wrote: > Team, > > We have setup in Postgres HA Cluster using Patroni. Also we have used the > HAProxy for load balancing... > > On Postgres side, we are getting HaProxy IP instead of Client IP, while > checking in pg_stat_activity tables. Can you please suggest the changes > needs to be done on HAProxy or Postgres side? Postgresql does not know that HAProxy is a proxy.  It just knows that an IP address (which just happens to come from an HAProxy server) has connected and "doing stuff". -- Angular momentum makes the world go 'round. --------------JBwV0Zt5crRt0dQXQN0yLh6q Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit On 11/21/22 09:14, Anjul Tyagi wrote:
Team,

We have setup in Postgres HA Cluster using Patroni. Also we have used the HAProxy for load balancing...

On Postgres side, we are getting HaProxy IP instead of Client IP, while checking in pg_stat_activity tables. Can you please suggest the changes needs to be done on HAProxy or Postgres side?

Postgresql does not know that HAProxy is a proxy.  It just knows that an IP address (which just happens to come from an HAProxy server) has connected and "doing stuff".

--
Angular momentum makes the world go 'round.
--------------JBwV0Zt5crRt0dQXQN0yLh6q--