Postgresql

clusterdb 停止在 Ubuntu 12.04 伺服器中為 PostgreSQL 數據庫工作

  • March 20, 2013

在我的 Ubuntu 伺服器 12.04 上全新安裝 PostgreSQL(版本 9.2)後,clusterdb 實用程序停止工作。我使用了與 9.1 版相同的配置文件。

下面是實際的命令:

clusterdb -v -h localhost -p <port#> -U postgres -d <dbname>

這是我得到的回應:

clusterdb: could not connect to database <dbname>: could not connect to server: Connection refused
   Is the server running on host "localhost" (127.0.0.1) and accepting
   TCP/IP connections on port <port#>?

我能夠在本地和從外部連接到伺服器。我也可以毫無問題地使用其他實用程序,例如pg_dump

我的 pg_hba.conf 文件如下:

# Database administrative login by Unix domain socket
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the replication privilege.
local all postgres md5
host all all x.x.x.x/x md5         #my network
host    all all  x.x.x.x/x  md5    #internal ip of the server

PostgreSQL 9.2 和 9.1 中是否實施了任何可能阻止clusterdb正常工作的安全更改?

升級時好像出了點問題。您必須檢查portandlisten_addresses是否正確。也許已listen_address更改並且實例不再在主機上監聽?

pg_dump工具和其他工具仍在工作的原因可能是因為它們通過 unix 套接字而不是通過 TCP/IP 進行連接。如果您只省略and選項clusterdb,也應該能夠做到這一點。-h``-p

不相關,pg_hba.conf因為您的客戶端根本無法連接到伺服器。您可以使用 驗證伺服器是否正在偵聽預期的主機和埠telnet <host> <port>

http://www.postgresql.org/docs/9.2/static/runtime-config-connection.html

引用自:https://dba.stackexchange.com/questions/37077