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 1rz1cQ-001Z1d-7D for pgsql-general@arkaria.postgresql.org; Mon, 22 Apr 2024 21:54:34 +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 1rz1cO-000WJc-GH for pgsql-general@arkaria.postgresql.org; Mon, 22 Apr 2024 21:54:32 +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 1rz1cO-000WJ9-3x for pgsql-general@lists.postgresql.org; Mon, 22 Apr 2024 21:54:32 +0000 Received: from mail-vs1-xe29.google.com ([2607:f8b0:4864:20::e29]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rz1cH-002Pfz-7g for pgsql-general@postgresql.org; Mon, 22 Apr 2024 21:54:31 +0000 Received: by mail-vs1-xe29.google.com with SMTP id ada2fe7eead31-47a21e0cde6so1869820137.0 for ; Mon, 22 Apr 2024 14:54:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713822863; x=1714427663; 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=hkz3vuZQQbfTLMKGo8vBR5E1GA2Y6hyFevsiQB+uwTE=; b=VFEt6pstCtDwcHtckXZdReJCtnMHL+HCv+xvluJAFAGG7hPpZxFV1dgmxx8lawtzuu NAsiUSpeNkJZcOQxbWRwstn1+bm/10/800HGpoU69t9vgse5nipRO5QhV97EbmZjY2Ix 1yX22xOeeTOBXuVSK5EQMomRpZBpW1V56cJfjjGyivk69KalRcLaUyPqAmP0h5BaQnL5 LmVIC6OORy3kdqwjNZGSQ0m1Tv3ZC47ZrrVGiWQwi/LANt1+4zRDUu1IYwuvhcCRUY3P jDa0CFNXCCnwKT5yjCKWHBzrxPK7UV07dmzpDN643A38ZvTvxpQjAzglhw/j9YmSECPG hG4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713822863; x=1714427663; 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=hkz3vuZQQbfTLMKGo8vBR5E1GA2Y6hyFevsiQB+uwTE=; b=rJZT2vNgg3UnGH/LqBn8W1b0gtgy0HenXSyQWTi+PWEiPVpGw+po3FZhugz/x47mar X8bHkXZDIrzIrjMpA3HBI1vVESnxxocorWxs0+CzvVQ02B21LO8KeqUH6qIEN4A01aae MCd9KKqXchdc5kG1gO82+VtiZLYFoShAgpiv+I4GGhODbwYyUEM/ZyETiJYdpM8l+kli p6m3MAUbdH3t/fYp/3/dGAOA0ie/X/cDayIMuiKL2ABU1bZNZpT+81vK4TdBmCuWb1vQ 8Yxp+eNkLixxZsCAKLMrL+cgQiKO7JyJ8LNwdP/ajyzw2LluV0WsnqNsEQS6U7BQ5fGE yIkw== X-Gm-Message-State: AOJu0Yyr6ZOrkMEIBFZFvk2BlkjBcslsvOqxD6VQJHU5Vy4/FmCLbgMX EZInJkWQ/6h+yDn9I9JWMAfoPVjFs/U+emN3QJPhfhHhZY5r8p+fLIFeS51URPvBdBTaWX2R+bg tx/6IDLzmKkJONteWXj86BKSUjtFBYA== X-Google-Smtp-Source: AGHT+IGR20z+k2b2Qtppri4HD7v7uDQDCPWPbMjvvt9veqHBZVaev+hnC4z+8aLyZXTggTXVhTTDi8b6IEtrVIZjeGI= X-Received: by 2002:a05:6102:5091:b0:47b:bc10:b6c5 with SMTP id bl17-20020a056102509100b0047bbc10b6c5mr18038988vsb.16.1713822863462; Mon, 22 Apr 2024 14:54:23 -0700 (PDT) MIME-Version: 1.0 References: <2015f756-b188-4840-922d-6f927997ab51@aklaver.com> In-Reply-To: <2015f756-b188-4840-922d-6f927997ab51@aklaver.com> From: Atul Kumar Date: Tue, 23 Apr 2024 03:24:12 +0530 Message-ID: Subject: Re: issue with reading hostname To: Adrian Klaver Cc: pgsql-general Content-Type: multipart/alternative; boundary="000000000000fc183b0616b67a30" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000fc183b0616b67a30 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I mean, Once I change the hostname then how will the socket read the new hostname ? Does it require a postgres service restart ? On Tue, Apr 23, 2024 at 3:19=E2=80=AFAM Adrian Klaver wrote: > On 4/22/24 14:37, Atul Kumar wrote: > > Can we edit the socket to change the hostname in it ? > > On Ubuntu 22.04 install, given: > > srwxrwxrwx 1 postgres postgres 0 Apr 22 14:01 .s.PGSQL.5432=3D > -rw------- 1 postgres postgres 68 Apr 22 14:01 .s.PGSQL.5432.lock > > The contents of .s.PGSQL.5432.lock(the file that indicates a Postgres > instance has a lock on the socket) are: > > 862 > /var/lib/postgresql/15/main > 1713795311 > 5432 > /var/run/postgresql > > There is no hostname to be changed as you are working with a local socket= . > > > > > Regards. > > > > On Tue, Apr 23, 2024 at 2:41=E2=80=AFAM Ron Johnson > > wrote: > > > > On Mon, Apr 22, 2024 at 4:14=E2=80=AFPM Atul Kumar > > wrote: > > > > Hi, > > > > I have postgresql version 15 running on centos7. > > > > I have below query that reads hostname from /tmp directory: > > > > psql postgres -A -t -p 5432 -h /tmp/ -c 'SELECT > > pg_is_in_recovery();' > > > > > > If you installed from the PGDG repository (possibly also the CENTOS > > repos, but I'm not sure), then the domain socket also lives in : > > /var/run/postgresql > > > > * I find that more expressive than /tmp. > > * No need to specify the host when using sockets. > > * Using a socket name makes parameterizing the hostname easier in > > scripts. > > > > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > > --000000000000fc183b0616b67a30 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I mean, Once I change the hostname then how will the socke= t read the new hostname ? Does it require a postgres service restart ?
=


On Tue, Apr 23, 2024 at 3:19=E2=80=AFAM Adrian Kla= ver <adrian.klaver@aklaver.= com> wrote:
On 4/22/24 14:37, Atul Kumar wrote:
> Can we edit the socket to change the hostname in it ?

On Ubuntu 22.04 install, given:

srwxrwxrwx=C2=A0 1 postgres postgres=C2=A0 =C2=A0 0 Apr 22 14:01 .s.PGSQL.5= 432=3D
-rw-------=C2=A0 1 postgres postgres=C2=A0 =C2=A068 Apr 22 14:01 .s.PGSQL.5= 432.lock

The contents of .s.PGSQL.5432.lock(the file that indicates a Postgres
instance has a lock on the socket) are:

862
/var/lib/postgresql/15/main
1713795311
5432
/var/run/postgresql

There is no hostname to be changed as you are working with a local socket.<= br>
>
> Regards.
>
> On Tue, Apr 23, 2024 at 2:41=E2=80=AFAM Ron Johnson <ronljohnsonjr@gmail.com =
> <mailto:ronljohnsonjr@gmail.com>> wrote:
>
>=C2=A0 =C2=A0 =C2=A0On Mon, Apr 22, 2024 at 4:14=E2=80=AFPM Atul Kumar = <akumar14871@= gmail.com
>=C2=A0 =C2=A0 =C2=A0<mailto:akumar14871@gmail.com>> wrote:
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Hi,
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0I have postgresql=C2=A0 version 15 ru= nning on centos7.
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0I have below query that reads hostnam= e from /tmp directory:
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0psql postgres -A -t -p 5432 -h /tmp/ = -c 'SELECT
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pg_is_in_recovery();'
>
>
>=C2=A0 =C2=A0 =C2=A0If you installed from the PGDG repository (possibly= also the CENTOS
>=C2=A0 =C2=A0 =C2=A0repos, but I'm not sure), then the domain socke= t also lives in :
>=C2=A0 =C2=A0 =C2=A0/var/run/postgresql
>
>=C2=A0 =C2=A0 =C2=A0* I find that more expressive than /tmp.
>=C2=A0 =C2=A0 =C2=A0* No need to specify the host when using sockets. >=C2=A0 =C2=A0 =C2=A0* Using a socket name makes parameterizing the host= name easier in
>=C2=A0 =C2=A0 =C2=A0scripts.
>
>

--
Adrian Klaver
adrian.klave= r@aklaver.com

--000000000000fc183b0616b67a30--