我在運行Ubuntu Server 14.04的服務器上安裝了PostgreSQL 9.3。無法連接到端口5432上的Postgresql
如果我ssh到通過終端服務器,我能夠用psql連接。但是,當我嘗試配置的pgAdmin III進行遠程連接,我得到:
Server doesn't listen The server doesn't accept connections: the connection library reports could not connect to server: Connection refused Is the server running on host "172.24.3.147" and accepting TCP/IP connections on port 5432?
當我在服務器上運行service postgresql status
它給了我:
9.3/main (port 5432): online
所以當然我想的東西這裏很重要。
編輯
當在服務器上運行netstat -na
,我得到(相關部分,我猜):
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN
tcp 0 0 172.24.3.147:22 172.24.3.240:61950 ESTABLISHED
tcp 0 0 172.24.3.147:22 172.24.3.240:60214 ESTABLISHED
您沒有綁定到該ip。 pg正在傾聽其他內容,比如說可能只是127.0.0.1:5432 –
你是什麼意思'綁定'?當我嘗試通過pgAdmin進行連接時,我正在使用服務器的端口(在ssh中使用)。 – Rodrigo
你必須告訴pg要監聽連接的接口/ ip。如果它只綁定到127.0.0.1:5432,那麼在172.24.3.147:5432上的任何嘗試都不起作用,因爲沒有監聽到該ip:port combo –