2017-09-10 75 views
0

目前我需要與我的服務器(Ubuntu 16.04 LTS)建立遠程連接。 我安裝PostgreSQL,我做了如下設置:端口5432在Google Compute Engine上關閉

/etc/postgresql/9.5/main/postgresql.conf:

listen_addresses='*' 

/etc/postgresql/9.5/main/pg_hba.conf :

host all    all    0.0.0.0/0    md5 

如果運行這個命令:netstat的-anpt | grep的LISTEN 顯示端口監聽 enter image description here

但是當我嘗試建立連接,我有這樣的錯誤: enter image description here

tool告訴我,端口關閉: enter image description here

回答

2

只允許配置Postgresql服務器是不夠的。您需要在Google計算引擎中添加防火牆規則。檢查this

防火牆規則控制傳入或傳出流量到實例。默認情況下,來自網絡外部的傳入流量被阻止。

+0

它的工作原理,謝謝! [來自gCloud的配置](https://imgur.com/a/nmJd6) [來自我的控制檯的信息](https://imgur.com/a/Ee2QK) – Rul

+0

很高興它工作正常 –

相關問題