Re: Cannot connect to postgresql on port 5432

Ron <[email protected]> Mon, 23 Dec 2019 13:42:52 -0600
Newsgroups gmane.comp.db.postgresql.admin
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------8B7485FAB9C6EBD18B18BF6F
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit

That error won't happen until after a connection is accepted.  And will 
throw a different error message.

On 12/23/19 1:39 PM, Pepe TD Vo wrote:
> change md5 to trust and try to connect again
>
> **
> *Bach-Nga
>
> *No one in this world is pure and perfect.  If you avoid people for their 
> mistakes you will be alone. So judge less, love and forgive more.
> To call him a dog hardly seems to do him justice though in as much as he 
> had four legs, a tail, and barked, I admit he was, to all outward 
> appearances. But to those who knew him well, he was a perfect gentleman 
> (Hermione Gingold)
>
> **Live simply **Love generously **Care deeply **Speak kindly.
> *** Genuinely rich *** Faithful talent *** Sharing success
>
>
> On Monday, December 23, 2019, 02:30:35 PM EST, 
> <[email protected]> wrote:
>
>
> Hi Experts,
>
> Post installation of  PostgreSQL it is not listening on an IP, only on 
> localhost.
>
> Please suggest your inputs.
>
> *_Used below command for installations –_*
>
> *# apt-get install postgresql-12*
>
> postgres=# select version();
>
> version
>
> ------------------------------------------------------------------------------------------------------------------
>
> PostgreSQL 12.1 (Debian 12.1-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled 
> by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
>
> (1 row)
>
> *_Entries in ::: /etc/postgresql/12/main/pg_hba.conf _*
>
> # Database administrative login by Unix domain socket
>
> local all postgres                                peer
>
> # TYPE  DATABASE        USER ADDRESS                 METHOD
>
> # "local" is for Unix domain socket connections only
>
> local all             all                    peer
>
> # IPv4 local connections:
>
> host all             all 127.0.0.1/32            md5
>
> # IPv6 local connections:
>
> host all             all ::1/128                 md5
>
> # Allow replication connections from localhost, by a user with the
>
> # replication privilege.
>
> local replication all                                     peer
>
> host replication     all 127.0.0.1/32            md5
>
> host replication     all ::1/128                 md5
>
> *_Not connected_*
>
> *__*
>
> *postgres@srv:/opt$ netstat -nlp | grep 5432*
>
> (Not all processes could be identified, non-owned process info
>
> will not be shown, you would have to be root to see it all.)
>
> tcp 0      0 127.0.0.1:5432 0.0.0.0:*               LISTEN      25857/postgres
>
> unix 2      [ ACC ]     STREAM     LISTENING 74234    25857/postgres 
> /var/run/postgresql/.s.PGSQL.5432
>
> *postgres@srv:~$ telnet 10.133.214.32 5432*
>
> Trying 10.133.214.32...
>
> telnet: Unable to connect to remote host: Connection refused
>

-- 
Angular momentum makes the world go 'round.

--------------8B7485FAB9C6EBD18B18BF6F
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    That error won't happen until after a connection is accepted.  And
    will throw a different error message.<br>
    <br>
    <div class="moz-cite-prefix">On 12/23/19 1:39 PM, Pepe TD Vo wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:[email protected]">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div class="ydpb105e2f7yahoo-style-wrap" style="font-family:
        verdana, helvetica, sans-serif; font-size: 16px;">
        <div>
          <div dir="ltr" data-setdir="false">change <span><span
                style="font-family: Helvetica Neue, Helvetica, Arial,
                sans-serif;">md5 to trust and try to connect again</span></span></div>
          <div><br>
          </div>
          <div class="ydpb105e2f7signature">
            <div id="ydpb105e2f7yui_3_13_0_rc_1_1_1381789421038_7868"
              class="ydpb105e2f7yiv3811552299ms__id13889"><font
                color="#0000ff"><b><span
                    class="ydpb105e2f7yiv3811552299sg"></span></b></font>
              <div id="ydpb105e2f7yui_3_13_0_rc_1_1_1381789421038_7874"
                class="ydpb105e2f7yiv3811552299ms__id13893"><font
                  id="ydpb105e2f7yui_3_13_0_rc_1_1_1381789421038_7873"
                  color="#0000ff"><span
                    id="ydpb105e2f7yui_3_13_0_rc_1_1_1381789421038_7871"
                    class="ydpb105e2f7yiv3811552299sg"><font
                      id="ydpb105e2f7yui_3_13_0_rc_1_1_1381789421038_7870"
                      style="background-color: inherit;" color="#8000ff"><b
id="ydpb105e2f7yui_3_13_0_rc_1_16_1381789421038_18">Bach-Nga<br
                          clear="none">
                        <br clear="none">
                      </b>No one in this world is pure and perfect.  If
                      you avoid people for their mistakes you will be
                      alone. So judge less, love and forgive more.</font></span></font></div>
              <div id="ydpb105e2f7yui_3_13_0_rc_1_1_1381789421038_7874"
                class="ydpb105e2f7yiv3811552299ms__id13893"><font
                  color="#0000ff"><span
                    class="ydpb105e2f7yiv3811552299sg"><font
                      style="background-color: inherit;" color="#8000ff">To
                      call him a dog hardly seems to do him justice
                      though in as much as he had four legs, a tail, and
                      barked, I admit he was, to all outward
                      appearances. But to those who knew him well, he
                      was a perfect gentleman (Hermione Gingold)</font></span></font></div>
              <br clear="none">
              <span style="color:rgb(128, 0, 255);"
                id="ydpb105e2f7yui_3_13_0_rc_1_1_1381789421038_7867">**Live
                simply **Love generously **Care deeply **Speak kindly.</span></div>
            <div id="ydpb105e2f7yui_3_13_0_rc_1_1_1381789421038_7866"
              class="ydpb105e2f7yiv3811552299ms__id13894"><span
                id="ydpb105e2f7yui_3_13_0_rc_1_1_1381789421038_7865"
                class="ydpb105e2f7yiv3811552299sg"><font
                  id="ydpb105e2f7yui_3_13_0_rc_1_1_1381789421038_7864"
                  style="background-color: inherit;" color="#8000ff">***
                  Genuinely rich *** Faithful talent *** Sharing success</font></span></div>
          </div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <div id="yahoo_quoted_7672811167" class="yahoo_quoted">
        <div style="font-family:'Helvetica Neue', Helvetica, Arial,
          sans-serif;font-size:13px;color:#26282a;">
          <div> On Monday, December 23, 2019, 02:30:35 PM EST,
            <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]">&lt;[email protected]&gt;</a> wrote: </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>
            <div id="yiv4373058981">
              <style><!--
#yiv4373058981  
 _filtered {}
 _filtered {}
#yiv4373058981  
#yiv4373058981 p.yiv4373058981MsoNormal, #yiv4373058981 li.yiv4373058981MsoNormal, #yiv4373058981 div.yiv4373058981MsoNormal
	{margin:0cm;margin-bottom:.0001pt;font-size:11.0pt;font-family:"Calibri", sans-serif;}
#yiv4373058981 a:link, #yiv4373058981 span.yiv4373058981MsoHyperlink
	{color:#0563C1;text-decoration:underline;}
#yiv4373058981 a:visited, #yiv4373058981 span.yiv4373058981MsoHyperlinkFollowed
	{color:#954F72;text-decoration:underline;}
#yiv4373058981 span.yiv4373058981EmailStyle17
	{font-family:"Calibri", sans-serif;color:windowtext;}
#yiv4373058981 .yiv4373058981MsoChpDefault
	{font-family:"Calibri", sans-serif;}
 _filtered {}
#yiv4373058981 div.yiv4373058981WordSection1
	{}
--></style>
              <div>
                <div class="yiv4373058981WordSection1">
                  <p class="yiv4373058981MsoNormal">Hi Experts,</p>
                  <p class="yiv4373058981MsoNormal">  </p>
                  <p class="yiv4373058981MsoNormal">Post installation of
                     PostgreSQL it is not listening on an IP, only on
                    localhost.</p>
                  <p class="yiv4373058981MsoNormal">  </p>
                  <p class="yiv4373058981MsoNormal">Please suggest your
                    inputs.</p>
                  <p class="yiv4373058981MsoNormal">  </p>
                  <p class="yiv4373058981MsoNormal"><span
style="font-size:11.5pt;font-family:sans-serif;color:#1D1C1D;background:#F8F8F8;"
                      lang="EN-GB">  </span></p>
                  <p class="yiv4373058981MsoNormal"><b><u><span
                          lang="EN-GB">Used below command for
                          installations –</span></u></b></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">
                       </span></p>
                  <p class="yiv4373058981MsoNormal"><b><span
                        lang="EN-GB"># apt-get install postgresql-12</span></b></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">postgres=#
                      select version();</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">                                                    
                      version</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">------------------------------------------------------------------------------------------------------------------</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">PostgreSQL
                      12.1 (Debian 12.1-1.pgdg100+1) on
                      x86_64-pc-linux-gnu, compiled by gcc (Debian
                      8.3.0-6) 8.3.0, 64-bit</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">(1
                      row)</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">
                       </span></p>
                  <p class="yiv4373058981MsoNormal"><b><u><span
                          lang="EN-GB">Entries in :::
                          /etc/postgresql/12/main/pg_hba.conf
                        </span></u></b></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">#
                      Database administrative login by Unix domain
                      socket</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">local  
                      all            
                      postgres                                peer</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">#
                      TYPE  DATABASE        USER           
                      ADDRESS                 METHOD</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">#
                      "local" is for Unix domain socket connections only</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">local  
                      all             all                 
                                         peer</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">#
                      IPv4 local connections:</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">host   
                      all             all            
                      127.0.0.1/32            md5</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">#
                      IPv6 local connections:</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">host   
                      all             all            
                      ::1/128                 md5</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">#
                      Allow replication connections from localhost, by a
                      user with the</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">#
                      replication privilege.</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">local  
                      replication    
                      all                                     peer</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">host   
                      replication     all            
                      127.0.0.1/32            md5</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">host   
                      replication     all            
                      ::1/128                 md5</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">
                       </span></p>
                  <p class="yiv4373058981MsoNormal"><b><u><span
                          lang="EN-GB">Not connected</span></u></b></p>
                  <p class="yiv4373058981MsoNormal"><b><u><span
                          lang="EN-GB"><span
                            style="text-decoration:none;"> </span></span></u></b></p>
                  <p class="yiv4373058981MsoNormal"><b>postgres@srv:/opt$
                      netstat -nlp | grep 5432</b></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">(Not
                      all processes could be identified, non-owned
                      process info</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">will
                      not be shown, you would have to be root to see it
                      all.)</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">tcp       
                      0      0 127.0.0.1:5432         
                      0.0.0.0:*               LISTEN      25857/postgres</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">unix 
                      2      [ ACC ]     STREAM     LISTENING    
                      74234    25857/postgres      
                      /var/run/postgresql/.s.PGSQL.5432</span></p>
                  <p class="yiv4373058981MsoNormal">  </p>
                  <p class="yiv4373058981MsoNormal">  </p>
                  <p class="yiv4373058981MsoNormal"><b><span
                        lang="EN-GB">postgres@srv:~$ telnet
                        10.133.214.32 5432</span></b></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">Trying
                      10.133.214.32...</span></p>
                  <p class="yiv4373058981MsoNormal"><span lang="EN-GB">telnet:
                      Unable to connect to remote host: Connection
                      refused</span></p>
                  <p class="yiv4373058981MsoNormal">  </p>
                  <p class="yiv4373058981MsoNormal">  </p>
                  <p class="yiv4373058981MsoNormal">  </p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      Angular momentum makes the world go 'round.</div>
  </body>
</html>

--------------8B7485FAB9C6EBD18B18BF6F--