简体   繁体   English

允许远程连接PostgreSQL

[英]Allow remote connection postgresql

I'm completed the installation of PG server. 我已经完成了PG服务器的安装。 I want to be able to be able to remote connect to it with pgAdmin but keeps on getting server don't listen error. 我希望能够使用pgAdmin远程连接到它,但一直在获取服务器不监听错误。

could not connect to server: Connection refused Is the server running on host "192.168.1.11" and accepting TCP/IP connections on port 5432?

It's on my network and I know I have to edit pg_hba.config file. 它在我的网络上,我知道我必须编辑pg_hba.config文件。 Everywhere I read, I have to add a line, 我到处阅读,我必须加一行,

host    all         all         ip address/mask    md5

My question is, what is the /mask and how/where do I get it? 我的问题是,什么是/ mask?如何/在哪里获得? The IP I'm connecting from is 192.168.1.9. 我连接的IP是192.168.1.9。

Thank you so much for your time, I am using Ubuntu 16.04 and Postgresql 9.4. 非常感谢您的宝贵时间,我使用的是Ubuntu 16.04和Postgresql 9.4。

The number after the / is actually not a mask, but the CIDR mask length. /后面的数字实际上不是掩码,而是CIDR掩码长度。

It states how many leading bits must match the IP address preceeding the / for an incoming address to match the pg_hba.conf entry. 它指出要与pg_hba.conf条目匹配的传入地址,必须有多少个前导位必须与/之前的IP地址匹配。

If you want the line to only work for your host, use 192.168.1.9/32 (all 32 bits must match). 如果您希望该线路仅适用于您的主机,请使用192.168.1.9/32 (所有32位必须匹配)。
To have the line apply to all hosts that start with 192.168.1. 要将该行应用于以192.168.1.开头的所有主机192.168.1. , use 192.168.1.0/24 . ,使用192.168.1.0/24
To match all hosts, use 0.0.0.0/0 . 要匹配所有主机,请使用0.0.0.0/0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM