我是否需要设置 tcpip_socket = true 以允许远程连接到 postgresql 数据库?

ber*_*436 3 postgresql ubuntu

我正在尝试启用与在 ubuntu 12.04 上运行的 postgresql 9.1 db 的远程连接。

教程说“将 tcpip_socket 设置为 true”——但它适用于 centos 服务器。我在 ubuntu 上。

我的 postgresql.conf 中没有看到这一行。

$cat /etc/postgresql/9.1/main/postgresql.conf | grep tcpip_socket
Run Code Online (Sandbox Code Playgroud)

当我添加它时,我收到错误:

 "FATAL:  unrecognized configuration parameter "tcpip_socket"
Run Code Online (Sandbox Code Playgroud)

如果它在 ubuntu 12.04 上运行,我是否需要告诉 postgres 9.1“打开”tcp_ip 连接?

Cra*_*ger 10

您只需要:

listen_addresses = '*'
Run Code Online (Sandbox Code Playgroud)

然后修改pg_hba.conf以允许来自所需源的连接。

这在您正在阅读的(非常旧的)文章的评论中有所说明。

以后可以尝试使用主要的 PostgreSQL 文档或最新的教程。

看: