postgres_fdw无法连接到Amazon RDS上的服务器

pai*_*ail 5 postgresql amazon-web-services amazon-rds postgres-fdw

我在RDS中有两个Postgres 9.3.5实例,它们都在一个安全组中,该实例允许安全组中的所有入站流量和所有出站流量。我试图建立一个数据库,以便能够通过postgres_fdw从另一个表中选择几个。

我已经创建了服务器-

create server master 
foreign data wrapper postgres_fdw 
OPTIONS (dbname 'main', 
         host 'myinstance.xxxxx.amazonaws.com');
Run Code Online (Sandbox Code Playgroud)

以及必要的用户映射和外部表-

create foreign table condition_fdw (
    cond_id integer,
    cond_name text
) server master options(table_name 'condition', schema_name 'data');
Run Code Online (Sandbox Code Playgroud)

然而,一个简单的select count(*) from condition_fdw给我

ERROR:  could not connect to server "master"
DETAIL:  could not connect to server: Connection timed out
        Is the server running on host "myinstance.xxxxxx.amazonaws.com" (xx.xx.xx.xx) and accepting
        TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)

我可以通过psqlEC2实例连接到两个数据库。我知道直到最近RDS才不支持postgres_fdw,但我正在运行支持的新版本。

在创建服务器语句中,我尝试用其解析为的IP地址替换“ myinstance.xxxxxx.amazonaws.com”,但不走运。

有任何想法吗?

进一步测试

我在具有相同安全组的ec2实例上安装了postgres,主服务器的外部表的行为符合预期。

同一RDS实例上的数据库之间的postgres_fdw有效。

这一切使我认为Postgres RDS实例上来自postgres_fdw的传出连接一定有问题。

pai*_*ail 1

Amazon 似乎不允许来自 RDS 实例的传出连接,因此在跨 RDS 实例使用 postgres_fdw 进行更改之前是不可能的。我必须运行一个 ec2 实例作为我的 postgres 服务器,以便使用另一台服务器上的数据库的外部表。

http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.RDSSecurityGroups.html

  • 似乎这不再是真的:https://aws.amazon.com/about-aws/whats-new/2018/05/amazon-rds-supports-outbound-network-access-from-postgresql-read-replicas/ (2认同)