Python 3.x 试图从本地PC连接到专用VPC中的群集时,连接被拒绝
来自BigQuery的红移noob。我没有网络/CIDR/防火墙/路由/VPC方面的经验 我正在尝试使用python包Python 3.x 试图从本地PC连接到专用VPC中的群集时,连接被拒绝,python-3.x,amazon-redshift,Python 3.x,Amazon Redshift,来自BigQuery的红移noob。我没有网络/CIDR/防火墙/路由/VPC方面的经验 我正在尝试使用python包psycopg2从本地计算机连接到红移群集(单节点)。 当我尝试连接时,会出现以下错误: psycopg2.OperationalError: could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "my-cluster.so
psycopg2
从本地计算机连接到红移群集(单节点)。
当我尝试连接时,会出现以下错误:
psycopg2.OperationalError: could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "my-cluster.some-random-stuff.us-east-2.redshift.amazonaws.com" (172.31.xx.xxx) and accepting
TCP/IP connections on port 5439?
在帖子中,我将上述私有IP地址(172.31.xx.xxx)以及我的本地IP地址添加到安全组入站规则中(VPC>security>security group
),但这不起作用
我还遵循文档,在我的routes表中添加了routes0.0.0/0
和::/0
。这也没用
我错过了什么
这是我的密码:
def connect_redshift():
client = boto3.client('redshift', region_name=REGION_NAME)
credentials = client.get_cluster_credentials(DbUser=USER,
DbName=DATABASE_NAME,
ClusterIdentifier=CLUSTER_ID,
AutoCreate=False)
try:
conn = psycopg2.connect(
host=HOST,
port=PORT,
user=credentials['DbUser'],
password=credentials['DbPassword'],
database=DATABASE_NAME
)
return conn
except psycopg2.Error:
logger.exception('Failed to open database connection.')
print("Failed")
使用aws配置,我添加了访问密钥ID和密钥。我有
AdministratorAccess
权限 这可能是由于一个或多个网络配置问题造成的,请参阅以获取一些疑难解答提示。但是,您可能需要熟悉您网络的人员的帮助,包括本地网络防火墙配置和AWS VPC设置。这可能是由于一个或多个网络配置问题造成的,请参阅以获取一些疑难解答提示。但是,您可能需要熟悉您网络的人员的帮助,包括本地网络防火墙配置和AWS VPC设置。