Re: After configuring remote access,server can't be started

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Alex Luya <alexander(dot)luya(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: After configuring remote access,server can't be started
Date: 2015-11-22 16:20:37
Message-ID: 5651EB55.8080301@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/22/2015 01:54 AM, Alex Luya wrote:
> My postgresql 9.4 is installed in centos 6.7,and I have followed this:
>
> http://www.cyberciti.biz/faq/postgresql-remote-access-or-connection/

The above is more than eight years old, approach with caution.

>
>
> 1,cd /var/libpgsql/9.4/data
>
> 2,cp postgresql.conf.sample postgresql.conf

You have already been told this is not a good idea. Instead modify the
postgresql.conf that was created by initdb. Same for pg_hba.conf below.

>
> 3,sudo vi postgresql.conf and add two lines,and save it:
>
> *listen_addresses = "*"
> tcpip_socket = true*

Again, tcpip_socket no longer exists.

>
>
> 4,cp pg_hba.conf.sample pg_hba.conf
>
> 5,sudo vi pg_hba.conf then *commented(maybe this is uneccessary)*
>
> #host all all 127.0.0.1/32 <http://127.0.0.1/32>
> @authmethodhost@
> #host all all ::1/128
> @authmethodhost@
>
>
> 6,add two lines:(I have tried to change *md5 to trust*,neither works)
>
> *host all all 0.0.0.0/0 <http://0.0.0.0/0>
> md5
> host all all ::0/0 md5*
>

First match wins in pg_hba.conf, so it is important where the lines
where commented out and added. In other words, need to see the complete
listing to tell much, though I suspect this does not have anything to do
with the problem below.

>
> 7,then *save*:pg_hba.conf
>
> 8,then *restart* postgresql sever by
>
> * sudo service postgresql-9.4 restart*
> 9.*close iptables*
> * sudo service iptables stop
> *
> *
> *
> *got error:*
>
> Stopping postgresql-9.4 service: [ OK ]
> Starting postgresql-9.4 service: *[FAILED]*
>
>
> *tail /var/lib/pgsql/9.4/pgstartup.log,got*
>
> < 2015-11-22 11:47:42.691 CST >LOG: could not create IPv6 socket:
> Address family not supported by protocol
> < 2015-11-22 11:47:42.718 CST >LOG: redirecting log output to
> logging collector process
> < 2015-11-22 11:47:42.718 CST >HINT: Future log output will appear
> in directory "pg_log".

So the above is the start up logging(which usually just goes to the
screen), before Postgres starts logging to its log file.

>
>
> Questions are:
> 1, Is this "could not create IPv6..." just a warning or the actual
> reason of starting failure?
> 2, Where is the pg_log directory?

Per John's post in $PGDATA/pg_log. If there is nothing relevant in there
you might want to look in the system log to see if the OS is shutting
down Postgres for some reason.

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message 657985552@qq.com 2015-11-23 06:20:58 Re: ??: postgres cpu 100% need help
Previous Message Maxim Boguk 2015-11-22 10:58:52 Re: After configuring remote access,server can't be started