public inbox for [email protected]help / color / mirror / Atom feed
Re: issue with reading hostname 4+ messages / 3 participants [nested] [flat]
* Re: issue with reading hostname @ 2024-04-22 21:49 Adrian Klaver <[email protected]> 2024-04-22 21:54 ` Re: issue with reading hostname Atul Kumar <[email protected]> 0 siblings, 1 reply; 4+ messages in thread From: Adrian Klaver @ 2024-04-22 21:49 UTC (permalink / raw) To: Atul Kumar <[email protected]>; +Cc: pgsql-general 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 <[email protected] > <mailto:[email protected]>> wrote: > > On Mon, Apr 22, 2024 at 4:14 PM Atul Kumar <[email protected] > <mailto:[email protected]>> 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 [email protected] ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: issue with reading hostname 2024-04-22 21:49 Re: issue with reading hostname Adrian Klaver <[email protected]> @ 2024-04-22 21:54 ` Atul Kumar <[email protected]> 2024-04-22 21:59 ` Re: issue with reading hostname David G. Johnston <[email protected]> 2024-04-22 21:59 ` Re: issue with reading hostname Adrian Klaver <[email protected]> 0 siblings, 2 replies; 4+ messages in thread From: Atul Kumar @ 2024-04-22 21:54 UTC (permalink / raw) To: Adrian Klaver <[email protected]>; +Cc: pgsql-general 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 AM Adrian Klaver <[email protected]> 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 <[email protected] > > <mailto:[email protected]>> wrote: > > > > On Mon, Apr 22, 2024 at 4:14 PM Atul Kumar <[email protected] > > <mailto:[email protected]>> 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 > [email protected] > > ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: issue with reading hostname 2024-04-22 21:49 Re: issue with reading hostname Adrian Klaver <[email protected]> 2024-04-22 21:54 ` Re: issue with reading hostname Atul Kumar <[email protected]> @ 2024-04-22 21:59 ` David G. Johnston <[email protected]> 1 sibling, 0 replies; 4+ messages in thread From: David G. Johnston @ 2024-04-22 21:59 UTC (permalink / raw) To: Atul Kumar <[email protected]>; +Cc: Adrian Klaver <[email protected]>; pgsql-general On Mon, Apr 22, 2024 at 2:54 PM Atul Kumar <[email protected]> wrote: > I mean, Once I change the hostname then how will the socket read the new > hostname ? Does it require a postgres service restart ? > >> >> -h doesn't strictly mean hostname (the wording choice here does seem problematic), rather it is simply a direct specification of how and where the psql client looks for and connects to the server. When the specification is a filename it is that file that is used and hostname and any other networking-related stuff is immaterial. Though the server does choose to borrow the port number 5432 from networking to construct the unique name out of convenience. David J. ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: issue with reading hostname 2024-04-22 21:49 Re: issue with reading hostname Adrian Klaver <[email protected]> 2024-04-22 21:54 ` Re: issue with reading hostname Atul Kumar <[email protected]> @ 2024-04-22 21:59 ` Adrian Klaver <[email protected]> 1 sibling, 0 replies; 4+ messages in thread From: Adrian Klaver @ 2024-04-22 21:59 UTC (permalink / raw) To: Atul Kumar <[email protected]>; +Cc: 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 <[email protected] > <mailto:[email protected]>> 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 > <[email protected] <mailto:[email protected]> > > <mailto:[email protected] > <mailto:[email protected]>>> wrote: > > > > On Mon, Apr 22, 2024 at 4:14 PM Atul Kumar > <[email protected] <mailto:[email protected]> > > <mailto:[email protected] > <mailto:[email protected]>>> 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 > [email protected] <mailto:[email protected]> > -- Adrian Klaver [email protected] ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2024-04-22 21:59 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2024-04-22 21:49 Re: issue with reading hostname Adrian Klaver <[email protected]> 2024-04-22 21:54 ` Atul Kumar <[email protected]> 2024-04-22 21:59 ` David G. Johnston <[email protected]> 2024-04-22 21:59 ` Adrian Klaver <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox