dot*_*dot 21 postgresql remote
我正在尝试连接到远程 psql 数据库。在我使用客户端的 IP 地址添加 pg_hba.conf 条目之前,我收到一条错误消息:
xdev@xdevbox:~$ psql -U postgres testdb -h 10.1.1.47
psql: FATAL: no pg_hba.conf entry for host "10.201.50.71", user "postgres", database "testdb", SSL off
Run Code Online (Sandbox Code Playgroud)
我使用信任设置添加了客户端的 IP。我还在服务器上的postgres.conf 中更改了监听地址来监听“*”。然后我使用 /etc/init.d/postgresql restart 命令重新启动了数据库服务器。
现在,当我尝试连接时,收到以下错误消息:
psql: could not connect to server: Connection refused
Is the server running on host "10.1.1.47" and accepting
TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)
在 postgresql.conf 中,端口设置为 5432。我不知道还有什么要检查的。
谢谢
小智 31
你必须配置以下两个文件
pg_hba.conf
host all all 0.0.0.0/0 md5
Run Code Online (Sandbox Code Playgroud)
配置文件
listen_addresses='*'
Run Code Online (Sandbox Code Playgroud)
您必须检查端口 5432 是否打开:http : //www.yougetsignal.com/tools/open-ports/
如果不是,则将规则添加到您的iptables:
iptables -A INPUT -s 0/0 -p tcp --dport 5432 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)
0/0:如果你想让任何人访问它。您可以将其更改为特定的 IP 地址或 IP 地址范围。
| 归档时间: |
|
| 查看次数: |
71784 次 |
| 最近记录: |