我有一个运行的微型免费层RHEL 6实例,并使用yum说明安装了postgresql 9.2:http: //yum.pgrpms.org/howtoyum.php
我可以使用此服务器在本地连接到PG服务器:
03:46:20 root@xxx[~]$ psql -hlocalhost -p5432 -Upostgres
Run Code Online (Sandbox Code Playgroud)
但是,我从来没有成功地连接到盒子外面.错误消息如下所示:
12:11:56 saladinxu@GoodOldMBP[~]$ psql -h ec2-xxx.ap-southeast-1.compute.amazonaws.com -p5432 -Upostgres
psql: could not connect to server: Connection refused
Is the server running on host "ec2-54-251-188-3.ap-southeast-1.compute.amazonaws.com" (54.251.188.3) and accepting TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)
我尝试了很多不同的方法.以下是我的配置文件现在的样子:
/var/lib/pgsql/9.2/data/postgresql.conf:
...
# - Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
port = 5432 # (change requires restart) …Run Code Online (Sandbox Code Playgroud)