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 1t8LR0-003c3I-0S for pgsql-general@arkaria.postgresql.org; Tue, 05 Nov 2024 15:25:33 +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 1t8LQx-00Eshk-6N for pgsql-general@arkaria.postgresql.org; Tue, 05 Nov 2024 15:25:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t8LQw-00Eshc-NT for pgsql-general@lists.postgresql.org; Tue, 05 Nov 2024 15:25:31 +0000 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t8LQu-000Jzc-Dd for pgsql-general@postgresql.org; Tue, 05 Nov 2024 15:25:30 +0000 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2fb587d0436so58263181fa.2 for ; Tue, 05 Nov 2024 07:25:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730820327; x=1731425127; 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=ea8ra/p/3yqVg1+oY2UAMqr8U/wvZrbfsuNgZgAvAdA=; b=eAhlb8yaeTMITTTq83TOP+7+Xt/kcFUYNOPv/wM7UrxPdhP9UHz7vZCu0B/8AWOZsh 224/SbwWNkE5zC9PsDp8B8KiAOGrPC0wxRsNlhp9CGR/cwsTV2VIdUuaO2GV67GsXmv9 Do2Dp2Zq67ySyaIVBXnxaQHALWuS+/CGcWacdkQOvidff1CKmPoSY1UhEGg4CprgF2mC MMCWKCXSjqznos3cQca+Owepwsubvoqk9FgegitAWYCMe93c6N0Q001/AnBILUsTGCHA gH8nC4q+CwQ9GqSG7wlwPLjGmp3gRJLxTsyb1GcrQ0zktk0nBvcgal5W5HWg47FoviJU YWpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730820327; x=1731425127; 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=ea8ra/p/3yqVg1+oY2UAMqr8U/wvZrbfsuNgZgAvAdA=; b=OBogHrQaiKBqLCeExif5lOc74e2RRpn75Be5XpQhUCytC7R46oP286Q05zctoAasWo EeVvhj7XSxvg1yQc7zpzL14+W2iEZuvryid/4QLE4Zs9m28Xdwb4jOu3wvCPCofg5ZcD HMHfD6Oz0qJAHbni2s/fPCuhZ0evpEh/c+6CGNlLi1RLGdrbHTqXkcyQ7NvKfYeudeID lq4uAYanBsrrybY42zjEW18xiyaw7rqWfGtjFGqnd/gZDc+0RI/kmJQZcIqi0YvS0QFh stYhv0yf2+G0y5OUi4RibuQVxtMAfHmhHCZmvFRp4lA3fP+89T8SQ5YpDaLJH3Bytd6s PVJQ== X-Gm-Message-State: AOJu0YyliXOkT16hbrPgmUEuqAVN9c4hyV5le23pSYEpSBs6sy1bfvAT 7Se/ZgbiX2fN6mvuQFtfvoQrIri75utpK+HIt/1nP8H1bdhJkl94ZA6L+j24aeI8PeWexPELCvJ UeCohbaq4Mgc3jGW74DvBt7m6eic= X-Google-Smtp-Source: AGHT+IEOvt421KYY0n8rQmVT0aI8EAE94AVGPwRCfj8SAEs8XGXHnySfy2bGG0kRH/ETK2zAdYAwX94V6sjfwq1JCS8= X-Received: by 2002:a05:651c:1541:b0:2fb:5688:55a4 with SMTP id 38308e7fff4ca-2fedb7a2fe0mr82153751fa.17.1730820326265; Tue, 05 Nov 2024 07:25:26 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Saul Perdomo Date: Tue, 5 Nov 2024 10:25:10 -0500 Message-ID: Subject: Re: Postgres listens on random port To: Ron Johnson Cc: pgsql-general Content-Type: multipart/alternative; boundary="000000000000b79dad06262c021a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000b79dad06262c021a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Agreed - it sounds like OP found a *client *process and mistook it for a server process, which is why I wanted to know where exactly he saw this. On Tue, Nov 5, 2024 at 9:41=E2=80=AFAM Ron Johnson wrote: > On Tue, Nov 5, 2024 at 9:22=E2=80=AFAM Kal wrote= : > >> >> On Tue, 5 Nov 2024 at 7:42=E2=80=AFPM, Greg Sabino Mullane >> wrote: >> >>> Start by seeing where the port is actually being set by running this: >>> >>> select setting, source, sourcefile, sourceline from pg_settings where >>> name =3D 'port'; >>> Cheers, >>> Greg >>> >>> Hi Greg, >> >> The query output states the source as command line. Event the port value >> output from show port is same as given in pg_ctl command. >> >> But the database is listening on some other random port. >> > > *Client* applications use a random port on *their* host: In this case, > 10.176.242.216 is the client, and 10.109.165.4, and 10.176.252.201 are > the DB servers: > > $ netstat -an | grep :5432 > tcp 0 0 10.176.242.216:37086 10.109.165.4:5432 > ESTABLISHED > tcp 0 0 10.176.242.216:43256 10.176.252.201:5432 > TIME_WAIT > tcp 0 0 10.176.242.216:36172 10.143.170.55:5432 > TIME_WAIT > tcp 0 0 10.176.242.216:36142 10.143.170.55:5432 > TIME_WAIT > tcp 0 0 10.176.242.216:36156 10.143.170.55:5432 > TIME_WAIT > tcp 0 0 10.176.242.216:36174 10.143.170.55:5432 > TIME_WAIT > tcp 0 0 10.176.242.216:38998 10.109.165.4:5432 > TIME_WAIT > tcp 0 0 10.176.242.216:36186 10.143.170.55:5432 > TIME_WAIT > tcp 0 0 10.176.242.216:36188 10.143.170.55:5432 > ESTABLISHED > tcp 19 0 10.176.242.216:36196 10.143.170.55:5432 > ESTABLISHED > tcp 19 0 10.176.242.216:36208 10.143.170.55:5432 > ESTABLISHED > tcp 0 0 10.176.242.216:36210 10.143.170.55:5432 > ESTABLISHED > > -- > Death to , and butter sauce. > Don't boil me, I'm still alive. > crustacean! > --000000000000b79dad06262c021a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Agreed - it sounds like OP found a client process a= nd mistook it for a server process, which is why I wanted to know where exa= ctly he saw this.

On Tue, Nov 5, 2024 at 9:41=E2=80=AFAM Ron Johnson <ronljohnsonjr@gmail.com> wro= te:
On Tue, Nov 5, 2024 at 9:22=E2=80=AFAM Kal <kalel.code11@gmail.co= m> wrote:

=
On Tue, 5 Nov 2024 at 7:42=E2=80=AFPM= , Greg Sabino Mullane <htamfids@gmail.com> wrote:
Start by seeing where the port is= actually being set by running this:

select setting, sou= rce, sourcefile, sourceline from pg_settings where name =3D 'port';=
Cheers,
Greg

Hi Greg,
=
The query output states the source as command l= ine. Event the port value output from show port is same as given in pg_ctl = command.

But the databas= e is listening on some other random port.
=C2=A0
Client applications use a random port on their=C2=A0ho= st:=C2=A0 In this case,=C2=A010.176.2= 42.216=C2=A0is the client, and=C2=A010.109.165.4,=C2=A0and=C2=A010.176.252.201=C2=A0are the DB servers:

$ netstat -an | grep :5432
tcp =C2=A0 =C2=A0 = =C2=A0 =C2=A00 =C2=A0 =C2=A0 =C2=A00 10.176.242.216:37086 =C2=A0 =C2=A010.109.165.4:5432 =C2=A0 =C2=A0 = =C2=A0 ESTABLISHED
tcp =C2=A0 =C2=A0 =C2=A0 =C2=A00 =C2=A0 =C2=A0 =C2=A0= 0 10.176.242.216:= 43256 =C2=A0 =C2=A010.176.252.201:5432 =C2=A0 =C2=A0 TIME_WAIT =C2=A0
tcp =C2=A0 = =C2=A0 =C2=A0 =C2=A00 =C2=A0 =C2=A0 =C2=A00 10.176.242.216:36172 =C2=A0 =C2=A010.143.170.55:5432 =C2=A0= =C2=A0 =C2=A0TIME_WAIT =C2=A0
tcp =C2=A0 =C2=A0 =C2=A0 =C2=A00 =C2=A0 = =C2=A0 =C2=A00 10= .176.242.216:36142 =C2=A0 =C2=A010.143.170.55:5432 =C2=A0 =C2=A0 =C2=A0TIME_WAIT =C2= =A0
tcp =C2=A0 =C2=A0 =C2=A0 =C2=A00 =C2=A0 =C2=A0 =C2=A00 10.176.242.216:36156 =C2= =A0 =C2=A010.143.17= 0.55:5432 =C2=A0 =C2=A0 =C2=A0TIME_WAIT =C2=A0
tcp =C2=A0 =C2=A0 =C2= =A0 =C2=A00 =C2=A0 =C2=A0 =C2=A00 10.176.242.216:36174 =C2=A0 =C2=A010.143.170.55:5432 =C2=A0 =C2=A0 = =C2=A0TIME_WAIT =C2=A0
tcp =C2=A0 =C2=A0 =C2=A0 =C2=A00 =C2=A0 =C2=A0 = =C2=A00 10.176.24= 2.216:38998 =C2=A0 =C2=A010.109.165.4:5432 =C2=A0 =C2=A0 =C2=A0 TIME_WAIT =C2=A0
tcp= =C2=A0 =C2=A0 =C2=A0 =C2=A00 =C2=A0 =C2=A0 =C2=A00 10.176.242.216:36186 =C2=A0 =C2=A010.143.170.55:5432 =C2=A0 =C2=A0 =C2=A0TIME_WAIT =C2=A0
tcp =C2=A0 =C2=A0 =C2=A0 =C2=A00 = =C2=A0 =C2=A0 =C2=A00 10.176.242.216:36188 =C2=A0 =C2=A010.143.170.55:5432 =C2=A0 =C2=A0 =C2=A0ESTABLIS= HED
tcp =C2=A0 =C2=A0 =C2=A0 19 =C2=A0 =C2=A0 =C2=A00 10.176.242.216:36196 =C2=A0 =C2= =A010.143.170.55:54= 32 =C2=A0 =C2=A0 =C2=A0ESTABLISHED
tcp =C2=A0 =C2=A0 =C2=A0 19 =C2= =A0 =C2=A0 =C2=A00 10.176.242.216:36208 =C2=A0 =C2=A010.143.170.55:5432 =C2=A0 =C2=A0 =C2=A0ESTABLISHED=
tcp =C2=A0 =C2=A0 =C2=A0 =C2=A00 =C2=A0 =C2=A0 =C2=A00 10.176.242.216:36210 =C2=A0 = =C2=A010.143.170.55= :5432 =C2=A0 =C2=A0 =C2=A0ESTABLISHED

--

Death to <Redacted>, and butter sauce.
Don't boi= l me, I'm still alive.
<Redacted> crustacean!
<= /div>
--000000000000b79dad06262c021a--