Postgresql 连接被拒绝

Jon*_*han 2 postgresql

我正在尝试远程连接到我的 postgresql 数据库。我设置了两个运行 ubuntu 14.04 的虚拟机。我正在尝试使用第一个虚拟机连接到第二个虚拟机

psql -h 10.0.1.23 -U postgres -d postgres
Run Code Online (Sandbox Code Playgroud)

但我收到错误:

Could not connect to server: Connection refused
    Is the server running on host "10.0.1.23" and accepting
    TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)

我已经更改了 pg_hba.conf 并添加了

host all all 10.0.1.64/24 md5
host all all * md5
host all all 0.0.0.0/0 md5
Run Code Online (Sandbox Code Playgroud)

并更改了 postgresql.conf listen_address=" * "

试图允许所有传入连接。我还尝试更改防火墙设置,但我不确定端口是否正确侦听连接。

编辑:输出

netstat -an | grep -E '^tcp[^6].*LISTEN'
tcp   0   0 127.0.1.1:53   0.0.0.0:*    LISTEN
tcp   0   0 0.0.0.0:22     0.0.0.0:*    LISTEN
tcp   0   0 127.0.0.1:631  0.0.0.0:*    LISTEN
tcp   0   0 0.0.0.0:23     0.0.0.0:*    LISTEN
tcp   0   0 127.0.0.1:5432 0.0.0.0:*    LISTEN
Run Code Online (Sandbox Code Playgroud)

Jon*_*han 6

显然我忘了从 listen_address="*" 中删除 #。一直都是评论。我好蠢。