远程访问 PostGIS
在过去的三/四个月里,我在本地部署了 PostGIS,但现在我刚刚获得了一台服务器来部署 PostGIS 并扩大我的开源冒险。我已经安装了 Postgres/gis 并且它在我的 Windows 服务器上运行得很好,但是我如何从我的台式电脑(通过 QGIS)连接到它。我已经四处寻找有关“Windows Server 上的远程访问 PostGIS”及其变体的线程,但实际上没有找到任何具体内容。
我的要点是我必须编辑一些 Postgres 配置文件以允许远程访问,但是对此进行评论的线程都提供了不同的解决方案。很困惑!
For the last three/four months i've deployed PostGIS locally but now i've just been given a server to deploy PostGIS on and scale up my open source adventures. I've installed Postgres/gis and its working just fine on my Windows server, but how do I connect to it from my desktop pc (via QGIS). I've looked around for threads on 'Remote Access PostGIS on Windows Server' and variation of, but haven’t actually found anything concrete.
I get the gist that I have to edit the some of the Postgres config files to allow remote access, but the threads that do comment on doing this all offer difference solutions. Very confused!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简而言之,是的。它内置于 PostgreSQL 使用的 IP 协议中。
但是,这部分取决于您的网络。您的 Windows Server 是否有静态 IP 或 DNS 名称(例如 yourname.com)?如果您的服务器有动态 IP,请尝试类似 http://dyn.com/dns/ 的内容。此外,如果您的服务器位于防火墙或路由器后面,您可能需要使用端口转发将 PostgreSQL 端口(通常为 5432)暴露给外部流量。
PostgreSQL/PostGIS 方面的设置更容易。网络上有大量的资源告诉您如何启用与 PostgreSQL 数据库的远程连接(例如 这个)。基本上,您需要编辑
postgresql.conf
和pg_hba.conf
文件,然后重新启动和/或刷新服务器。若要从 QGIS 进行连接,请使用“主机”中的 DNS 名称或 IP 地址建立新连接。我经常使用 QGIS 连接到远程服务器。
In short, yes. It's built into the IP protocol used by PostgreSQL.
However, it partially depends on your network. Does your Windows Server have either a static IP or a DNS name (e.g., yourname.com)? If your server have a dynamic IP, try something like http://dyn.com/dns/. Furthermore, if your server is behind a firewall or router, you might need to use port forwarding to expose the PostgreSQL port (usually 5432) to outside traffic.
The PostgreSQL/PostGIS side of things is easier to set up. There are tonnes of resources out in the web to tell you how to enable remote connections to a PostgreSQL database (e.g. this). Basically, you need to edit your
postgresql.conf
andpg_hba.conf
files, and either restart and/or refresh your server.To connect from QGIS, make a new connection with the DNS name or IP address in "Host". I frequently use QGIS to connect to remote servers.
特别注意
postgresql.conf 中的配置。
默认情况下,它只允许本地连接,您需要添加“*”以允许来自任何计算机的连接。
Take spacial attention to the
configuration in postgresql.conf.
By default it only allows local conections and you need to put the '*' to allows connection from any machine.