且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何配置“用于PostgreSQL服务器的Azure数据库".用postgres_fdw到另一个PostgreSQL数据库

更新时间:2022-11-29 22:54:34

有关详细信息,请参阅" Azure Database for PostgreSQL服务器防火墙规则".

在创建服务器时,请确保您使用了正确的端口号在提到 postgres_fdw 示例.

关于限制,您可以参考"Azure数据库中PostgreSQL的局限性".

希望这会有所帮助.


I have a postgres_fdw in a "Azure Database for PostgreSQL" that connects to another PostgreSQL database that resides on an Azure VM running Windows OS and is running on a non-standard port: 5435.

When executing a: select * from xfer.xx_table, I receive this error:

SQL Error [08001]: ERROR: could not connect to server "xx_db_xxx_xxx_xx_xxx"
  Detail: could not connect to server: Network is down (0x00002742/10050)
Is the server running on host "xxx.xxx.xx.xxx" and accepting
TCP/IP connections on port 5435?

On the PostgreSQL database that I am connecting to--I have the pg_hba.conf wide open.  In fact, I can take the same Server/Foreign Table creation statements to my local postgres database and it works perfectly.

So it appears that I don't have something configured correctly in the "Azure Database for PostgreSQL server" instance.

There doesn't seem to be a lot of options with connection security.

I did try "Allow access to Azure services" but if I understand it correctly, that is a 0.0.0.0 firewall setting? In any case, it did not help.

The "Azure Database for PostgreSQL server" is located in East US.

The original PostgreSQL database resides in South Central US and in a different resource group.  I wouldn't think this should matter since the database is wide open and I can connect to it from outside the Azure platform.

Am I running into a limitation of the  "Azure Database for PostgreSQL server" instance? Or something else?


Connections to your Azure Database for PostgreSQL server communicate over port 5432. When you try to connect from within a corporate network, outbound traffic over port 5432 might not be allowed by your network's firewall. If so, you can't connect to your server unless your IT department opens port 5432.

For more details, refer "Configure a server-level firewall rule" and "Azure Database for PostgreSQL server firewall rules".

While creating server, make sure you have used the right port number which is mentioned in postgres_fdw examples.

Regarding limitations, you may refer "Limitations in Azure Database for PostgreSQL".

Hope this helps.