I've got a VPS with Centos 6.4 installed. I used to have a VPS at Digital Ocean that when I start PostgreSQL or Monit that bind to localhost, they all work fine. But on the new VPS, when I have PostgreSQL listen to "localhost", PostgreSQL is saying:
WARNING: could not create listen socket for "localhost"
And Monit, when I tell Monit to listen on "localhost", Monit is saying:
http server: Could not create a server socket at port 2812 -- Cannot assign requested address
I wonder what could be wrong on my VPS that lead to such behavior. If I have PostgreSQL listen on '*' instead of "localhost" then it runs just fine.
Update:
My ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:50:56:0A:01:3D
inet addr:xxx.xx.xxx.xxx Bcast:103.27.236.127 Mask:255.255.255.192
inet6 addr: fe80::250:56ff:fe0a:13d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:198875 errors:0 dropped:0 overruns:0 frame:0
TX packets:49492 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:135854898 (129.5 MiB) TX bytes:7779876 (7.4 MiB)
lo Link encap:Local Loopback
LOOPBACK MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
My /etc/hosts
127.0.0.1 localhost.localdomain localhost localhost4 localhost4.localdomain4 CentOS64
::1 localhost localhost.localdomain localhost6.localdomain6 localhost6
Your
lo
interface is down. Note that it explicitly does not say it isUP
and does not have its associated IP address of 127.0.0.1. I have no idea how that would have happened, as this should always be brought up.If the
lo
interface is down, no programs can bind or connect to localhost.Bring it up yourself: