Postgres can't talk on TCP/IP connection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ggarrette
    New Member
    • Jul 2008
    • 2

    Postgres can't talk on TCP/IP connection

    Building OpenNMS 1.2.9 on
    OpenSUSE 10.3 using
    Postgres 8.2.7

    When I run:
    $OPENNMS_HOME/bin/install -disU

    Output is:
    Exception in thread "main" org.postgresql. util.PSQLExcept ion: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
    at org.postgresql. jdbc1.AbstractJ dbc1Connection. openConnection( AbstractJdbc1Co nnection.java:2 04)
    at org.postgresql. Driver.connect( Driver.java:139 )
    at java.sql.Driver Manager.getConn ection(DriverMa nager.java:525)
    at java.sql.Driver Manager.getConn ection(DriverMa nager.java:171)
    at org.opennms.ins tall.Installer. databaseConnect (Installer.java :613)
    at org.opennms.ins tall.Installer. install(Install er.java:195)
    at org.opennms.ins tall.Installer. main(Installer. java:2450)


    The research I've done suggests:
    Edit pg_hba.conf to Allow postgres to Authenticate

    You will need to change "ident sameuser" to "trust":
    local all all trust
    host all all 127.0.0.1/32 trust
    host all all ::1/128 trust

    local all all trust
    host all all 127.0.0.1 255.255.255.255 trust
    host all all ::1 ffff:ffff:ffff: ffff:ffff:ffff: ffff:ffff trust

    Edit postgresql.conf to Allow TCP/IP Connections

    You may also need to change the postgresql.conf to allow TCP/IP connections, if it cannot do so already. On older PostgreSQL versions, this is enabled with the flag:
    On newer PostgreSQL versions, this is enabled with:

    # you can use "*" to listen on all addresses
    listen_addresse s = 'localhost'

    I made all change and I restarted postgres with:
    sudo -u postgres /opt/pgsql/bin/pg_ctl -D /opt/pgslq/data -l /opt/pgsql/logfile start

    and re-ran
    $OPENNMS_HOME/bin/install -disU
    But received the same error. I'm at a wall with no other idea's and nothing left to google. Any suggestions?
  • rski
    Recognized Expert Contributor
    • Dec 2006
    • 700

    #2
    so i guess you have in postgresql.org
    Code:
    listen_addresses='*'
    don't you?

    and put in pg_hba.conf
    Code:
    host all all 0.0.0.0/0 trust
    restart postgres server
    check, what port does postgres listening on.

    does i work?

    Comment

    • ggarrette
      New Member
      • Jul 2008
      • 2

      #3
      Originally posted by rski
      so i guess you have in postgresql.org
      Code:
      listen_addresses='*'
      don't you?

      and put in pg_hba.conf
      Code:
      host all all 0.0.0.0/0 trust
      restart postgres server
      check, what port does postgres listening on.

      does i work?

      In postgresql.conf I put:
      listen_addresse s = 'localhost'
      port = 5432
      max_connections = 256
      shared_buffers = 1024MB
      max_fsm_pages = 204800


      In pg_hba.conf
      I put:
      # TYPE DATABASE USER CIDR-ADDRESS METHOD

      # "local" is for Unix domain socket connections only
      local all all trust
      # IPv4 local connections:
      host all all 127.0.0.1/32 trust
      # IPv6 local connections:
      host all all ::1/128 trust

      # TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
      local all all trust
      host all all 127.0.0.1 255.255.255.255 trust
      host all all ::1 ffff:ffff:ffff: ffff:ffff:ffff: ffff:ffff trust

      and restarted DB with:
      sudo -u postgres /opt/pgsql/bin/pg_ctl -D /opt/pgslq/data -l /opt/pgsql/logfile start

      I am a very new newbie. I put in above statements in as the documentation suggests. But still getting same error. is the info I put in correct? Did I start the DB with the right command?

      Comment

      • rski
        Recognized Expert Contributor
        • Dec 2006
        • 700

        #4
        read carefully i wrote

        in postgresql.conf set
        Code:
              listen_addresses='*'
        in pg_hba.conf

        Code:
              host all all 0.0.0.0/0 trust
        and restart postgres server
        As you said you are a begginer so i think you should read manual at postgresql.org
        To restart you should use option restart not start

        Comment

        Working...