2016-05-17 36 views
1

当我尝试连接到远程云上的Postgres时。它显示:连接到远程Postgres时出现错误

psql: server closed the connection unexpectedly 
     This probably means the server terminated abnormally 
     before or while processing the request. 

本地系统 - 的Postgres 9.3(窗口)
远程系统是在Azure上 - Postgres的9.2版本(CentOS)

命令我使用的是:psql -h "abc.cloudapp.net" -p 5432

我给自己定终点为5432在天青 改变在postgresql.conf为‘*’,以允许连接 ,改变了pg_hba到(host all all ip/24 md5)

请帮我解决这个问题。

回答

0

端点正常,您还需要设置网络安全组。

enter image description here

尝试定义不仅仅是5432,但端口(1024-65536例如)的范围内。

UPD:我能够创建CentOS的7.0 + PostgreSQL和连接到该实例:

sudo yum install postgresql-server postgresql-contribs 
sudo postgresql-setup initdb 
sudo vi /var/lib/pgsql/data/pg_hba.conf 

编辑127.0.0.1/32到0.0.0.0/0

sudo systemctl start postgresql 
sudo systemctl enable postgresql  
sudo vim /var/lib/pgsql/data/postgresql.conf 
sudo service postgresql restart 
sudo service postgresql restart 
sudo -u postgres createuser --superuser azureuser -P 

然后我下载了pgAdmin并与之连接。 (见截图)(不要关注test1数据库,只需将其更改为postgres)。

enter image description here

+0

我在哪里可以找到这在蔚蓝的经典门户。请分享截图。 –

+0

啊,有道理。你在经典门户上创建了虚拟机吗? –

+0

是的,我创建了,但在新的门户网站,我没有网络安全组 –

相关问题