Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2017
    Posts
    16

    Unanswered: postgres 10 remote connection

    Trying to get my postgresql database to be accessible from remote host.
    Ive added firewall rule:
    Code:
    iptables -I INPUT 5 -m state --state NEW -p tcp --dport 5432 -j ACCEPT
    and edited the pg_hba.conf file to specify:
    Code:
    host    all             all             10.0.0.0/16             md5
    However, remote host doesn't see any listener on the port:
    Code:
    telnet 10.0.3.10 5432
    Trying 10.0.3.10...
    telnet: connect to address 10.0.3.10: Connection refused
    I tried to add
    Code:
    listen_addresses = '*'
    to the postgresql.conf file, but then it won't restart successfully.
    Code:
    # service postgresql-10 restart
    Stopping postgresql-10 service:                            [  OK  ]
    Starting postgresql-10 service:                            [FAILED]

  2. #2
    Join Date
    Nov 2003
    Posts
    2,993
    Provided Answers: 23
    Do you see any errors in the Postgres logfile?

    If yes, which one?
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

  3. #3
    Join Date
    Jan 2017
    Posts
    16
    # find /var/lib/pgsql -name \*.log
    /var/lib/pgsql/10/data/log/postgresql-Wed.log
    /var/lib/pgsql/10/pgstartup.log

    The pgstartup.log contains:
    2017-12-06 11:32:59.077 MST [31815] LOG: listening on IPv4 address "127.0.0.1", port 5432
    2017-12-06 11:32:59.079 MST [31815] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
    2017-12-06 11:32:59.081 MST [31815] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
    2017-12-06 11:32:59.101 MST [31815] LOG: redirecting log output to logging collector process
    2017-12-06 11:32:59.101 MST [31815] HINT: Future log output will appear in directory "log".

    Seems to be only listening on 127.0.0.1, but I dont' have any idea why that would be or where to adjust that.

  4. #4
    Join Date
    Nov 2003
    Posts
    2,993
    Provided Answers: 23
    So you get the [FAILED] when restarting the service, but no error message in either log file? That sounds strange. If there is any error with the config files, it should be reported in the logfiles.

    The log you have shown indicates that apparently Postgres did start successfully.

    The place to change the listening address is indeed listen_addresses in postgresql.conf.
    You did change that in postgresql.conf, right?
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

  5. #5
    Join Date
    Jan 2017
    Posts
    16
    Specifically I get the failed message when I try to use the listen_address option, it starts ok without the option but only listens on 127.0.0.1.

  6. #6
    Join Date
    Nov 2003
    Posts
    2,993
    Provided Answers: 23
    Quote Originally Posted by usao View Post
    Specifically I get the failed message when I try to use the listen_address option, it starts ok without the option but only listens on 127.0.0.1.
    Just to make sure we are not missing the obvious: you are editing that in postgresql.conf, right?

    Please post the content of the logfile in case the startup fails.
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

  7. #7
    Join Date
    Jan 2017
    Posts
    16
    Oops, my bad, I am editing the postgresql.conf, however I mis-spelled the option name.
    Sorry for the trouble, I got it working now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •