0

AWS 계정에 Redshift 클러스터가 있습니다. 나는 파이썬에 연결할 수 그리고 난 로컬 스크립트를 실행할 때, 그것은 완벽하게 정상적으로 실행됩니다Amazon EC2 인스턴스에서 Amazon redshift 클러스터에 연결하는 방법

import psycopg2 
con = psycopg2.connect(dbname='some_dbname', host='hostname.us-east-2.redshift.amazonaws.com', port='port#', user='username', password='password') 
    cursor=con.cursor() 
    query = "select * from table;" 
    cursor.execute(query) 
    data = np.array(cursor.fetchall()) 
cursor.close() 
con.commit() 
con.close() 

하지만, 내 EC2 인스턴스 (아마존 리눅스 AMI)에 위의 스크립트를 복사 할 때, 다음 시도

conn = _connect(dsn, connection_factory=connection_factory, **kwasync) 
psycopg2.OperationalError: could not connect to server: Connection timed out 
    Is the server running on host "hostname.us-east-2.redshift.amazonaws.com" and accepting 
    TCP/IP connections on port port#? 

아무도 내 EC2 인스턴스에서 내 적색 편이 클러스터에 연결하는 방법에 나를 도울 수 : 그것을 실행, 나는 다음과 같은 오류가 발생합니다? 감사!

+1

EC2 인스턴스의 연결을 허용하도록 Redshift 클러스터에 할당 된 보안 그룹에서 포트를여셨습니까? –

+0

@ MarkB 아니, 어떻게해야합니까? – Rajiv

+0

로컬 컴퓨터에서 액세스 할 수 있도록 보안 그룹을 어떻게여셨습니까? 그것은 같은 과정입니다. –

답변

0

그것도 네트워킹 또는 보안 그룹

When you provision an Amazon Redshift cluster, it is locked down by default so nobody has access to it. To grant other users inbound access to an Amazon Redshift cluster, you associate the cluster with a security group.

EC2 당신이 네트워킹을위한 확인을해야 적색 편이 클러스터와 같은 VPC에있는 경우 http://docs.aws.amazon.com/redshift/latest/mgmt/working-with-security-groups.html

를 참조합니다. 그렇지 않은 경우이 가이드를 참조하십시오 http://docs.aws.amazon.com/redshift/latest/mgmt/enhanced-vpc-routing.html

+0

EC2 인스턴스로 이동하여 설명 탭에서 보안 그룹을 클릭하면 VPC ID가 동일하다는 것을 알 수 있습니다 Redshift 클러스터의 경우 그룹 ID는 서로 다르지만 연결할 수없고 시간이 초과되었습니다. 죄송합니다. 매우 새로운 점이 있습니다. – Rajiv

관련 문제