我在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的传出连接一定有问题。