After configuring remote access,server can't be started

Started by Alex Luyaover 10 years ago4 messagesgeneral
Jump to latest
#1Alex Luya
alexander.luya@gmail.com

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/

1,cd /var/libpgsql/9.4/data

2,cp postgresql.conf.sample postgresql.conf

3,sudo vi postgresql.conf and add two lines,and save it:

*listen_addresses = "*"tcpip_socket = true*

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
@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&gt;
md5host all all ::0/0
md5*

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".

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?

#2John R Pierce
pierce@hogranch.com
In reply to: Alex Luya (#1)
Re: After configuring remote access,server can't be started

On 11/22/2015 1:54 AM, Alex Luya wrote:

*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".

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

thats typically just a warning.

2, Where is the pg_log directory?

By default, the logs past that above are in $PGDATA/pg_log, which on
your system should /var/libpgsql/9.4/data/pg_log ... look for the
newest file after a failed start, and look at the last set of logs.

--
john r pierce, recycling bits in santa cruz

#3Maxim Boguk
maxim.boguk@gmail.com
In reply to: Alex Luya (#1)
Re: After configuring remote access,server can't be started

On Sun, Nov 22, 2015 at 8:54 PM, Alex Luya <alexander.luya@gmail.com> 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/

1,cd /var/libpgsql/9.4/data

2,cp postgresql.conf.sample postgresql.conf

3,sudo vi postgresql.conf and add two lines,and save it:

*listen_addresses = "*"​​tcpip_socket = true*

There are no such option as ​


tcpip_socket
​ anymore (it had been removed sometime around 2005 year).
So very likely your server doesn't start because your config file not valid
anymore.

--
Maxim Boguk
Senior Postgresql DBA
http://www.postgresql-consulting.ru/ <http://www.postgresql-consulting.com/&gt;

Phone RU: +7 910 405 4718
Phone AU: +61 45 218 5678

LinkedIn: http://www.linkedin.com/pub/maksym-boguk/80/b99/b1b
Skype: maxim.boguk
Jabber: maxim.boguk@gmail.com

"People problems are solved with people.
If people cannot solve the problem, try technology.
People will then wish they'd listened at the first stage."

#4Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Alex Luya (#1)
Re: After configuring remote access,server can't be started

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&gt;
@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&gt;
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.klaver@aklaver.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general