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 1t8Kjx-003X37-59 for pgsql-general@arkaria.postgresql.org; Tue, 05 Nov 2024 14:41:04 +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 1t8Kju-00EGDe-KE for pgsql-general@arkaria.postgresql.org; Tue, 05 Nov 2024 14:41:03 +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 1t8Kju-00EGDW-52 for pgsql-general@lists.postgresql.org; Tue, 05 Nov 2024 14:41:02 +0000 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t8Kjr-000Jdf-UY for pgsql-general@postgresql.org; Tue, 05 Nov 2024 14:41:01 +0000 Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3e60f6ea262so2617695b6e.1 for ; Tue, 05 Nov 2024 06:40:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730817659; x=1731422459; darn=postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=TALHqGhYuPSqi/GAAWiVyIT/HTdHkmY9ZwLoBfp597c=; b=Afi4bXzDxqdQqkjZ/SO3RtpsIaB1wNqYbqL/o6D7wzt0IRvf8vT2bPUNOYRWI74Aac cgpzPK+4EnQD3n2owagR0ddkCKZwBuhLOLU6j73iatzaY5rI42VX5vrakYI6gr+PWG9Y C80iFlnBPklFm5Jvj2+Ha9OxdV9DaF20TPQ2l9hduFyAcw5Kr/76ftaMwfg0qb3+J8OH ZPH2RUUUcAftz1VqCf3waubJ5cn9SKpqRPv6ZNe4XP4zx4WbNIpUzXzYmycn5uNoDjCl bEFDNYSLEmbCuy0LbreqBnh4xFtdhyJM47H5dScywZjg/z5ArsVu/ItDMM4gG+5QeanV 254w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730817659; x=1731422459; h=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=TALHqGhYuPSqi/GAAWiVyIT/HTdHkmY9ZwLoBfp597c=; b=lHUvttwVg6jEEZcPj7xCyjG+rGi1miVNd3haJKjrlfgSjhy3arpYBX6r7qKykzdXQU C/P+xnh7LsuZLBzbJ18IrZ/VNoEx2zqhjeC9Wju5KmPfXTarU81ziyOilIlA83RFzA3i SJGWIvc3Gv38oHeNAL5D8siO42iMXuJixHF1dFOFpOOH1kCX8KFBn+Bb0hZx2+jFH4qQ ryLnQRvrx7OEbOP4tGb4aXvSMaGmuqvTEoZJyh+13+ruA4rtULQlVkwuz2PIpE8P9d1h A/TA/cba5uufJXQgSB2tQjv9wZYpG4l5Sa/7b1fNS6E7SupnNsf3P5UeiwNSpOkKhOCk drAg== X-Gm-Message-State: AOJu0YwrU4BhcYZnDxxaS0MDg4lTLo88XuWS6urhsFoXsqQ+m2PAq/pz RGTgyJT25UTub1uWGWCdUxIzkgenz2qmdNbZGn9FtakANNoH5xeiWU/boRgyDPdj5ZlHpNdA4N4 dv9loFu7EQ+BS9oSV2obYcuX7xAn04RGO X-Google-Smtp-Source: AGHT+IGQ0JwSCzproM/wgwDRwSyQqgpiOES4hRlUAeXg9zB5WGhrRNT3o+iXGwurG7ihHytxRV2JmNSU6hePwy1qSfY= X-Received: by 2002:a05:6808:1527:b0:3e5:f141:bad with SMTP id 5614622812f47-3e638480bd8mr30796191b6e.24.1730817658963; Tue, 05 Nov 2024 06:40:58 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ron Johnson Date: Tue, 5 Nov 2024 09:40:47 -0500 Message-ID: Subject: Re: Postgres listens on random port To: pgsql-general Content-Type: multipart/alternative; boundary="000000000000bbd16806262b6372" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000bbd16806262b6372 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 --=20 Death to , and butter sauce. Don't boil me, I'm still alive. crustacean! --000000000000bbd16806262b6372 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Nov 5, 2024 at 9:22=E2=80=AFAM Ka= l <kalel.code11@gmail.com&= gt; 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 actua= lly being set by running this:

select setting, source, s= ourcefile, 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=A00 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=A0tcp =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.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: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.242.216:3= 8998 =C2=A0 =C2=A010.109.165.4:543= 2 =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.2= 42.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=A0ESTABLISHED
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:5432 =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 sauc= e.
Don't boil me, I'm still alive.
<Redacted>= ; crustacean!
--000000000000bbd16806262b6372--