我安装了PostgreSQL并尝试连接:
$ psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
$ ps aux | grep postg
$ sudo service postgresql start
- 不会产生。
$ psql -U ivan -h localhost msg_proxy
psql: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
为什么呢?我的iptables似乎没问题:
$ sudo iptables-save
# Generated by iptables-save v1.6.0 on Mon Feb 6 13:31:17 2017
*filter
:INPUT ACCEPT [43867:5867960]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [34820:18177695]
COMMIT
# Completed on Mon Feb 6 13:31:17 2017
sudo netstat -pant | grep postgres
的输出为空