Re: issue with reading hostname

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Atul Kumar <akumar14871(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: issue with reading hostname
Date: 2024-04-22 21:59:39
Message-ID: ecd776a5-b615-4e77-bf58-193534534bac@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 4/22/24 14:54, Atul Kumar wrote:
> I mean, Once I change the hostname then how will the socket read the new
> hostname ? Does it require a postgres service restart ?

The host name of the machine?

>
>
>
> On Tue, Apr 23, 2024 at 3:19 AM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com
> <mailto:adrian(dot)klaver(at)aklaver(dot)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  1 postgres postgres    0 Apr 22 14:01 .s.PGSQL.5432=
> -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 AM Ron Johnson
> <ronljohnsonjr(at)gmail(dot)com <mailto:ronljohnsonjr(at)gmail(dot)com>
> > <mailto:ronljohnsonjr(at)gmail(dot)com
> <mailto:ronljohnsonjr(at)gmail(dot)com>>> wrote:
> >
> >     On Mon, Apr 22, 2024 at 4:14 PM Atul Kumar
> <akumar14871(at)gmail(dot)com <mailto:akumar14871(at)gmail(dot)com>
> >     <mailto:akumar14871(at)gmail(dot)com
> <mailto:akumar14871(at)gmail(dot)com>>> 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(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2024-04-22 22:06:40 Re: CLUSTER vs. VACUUM FULL
Previous Message David G. Johnston 2024-04-22 21:59:17 Re: issue with reading hostname