Verbindung zum postgresql-server auf amazon ec2

Begann ich eine amazon ec2-Instanz und installiert postgresql 9.1 über. Dann ging ich zum
Sicherheitsgruppe: quicklaunch-1(there was one moredefault`, die ich nicht ändern) und öffnete die 5432 TCP-Port, die Tabelle sieht wie folgt aus:

(Service)   Source  Action
22        0.0.0.0/0         Delete
5432      0.0.0.0/32    Delete
5433      0.0.0.0/32    Delete
6432      0.0.0.0/32    Delete

Ich habe Datenbank angelegt und Benutzer .
Meine /etc/postgresql/9.1/main/pg_hba.conf sieht wie folgt aus:

# Database administrative login by Unix domain socket
local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD
host    all             all             0.0.0.0/0               md5
host    db_name         user_name       0.0.0.0/0               md5

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
host    replication     postgres        127.0.0.1/32            md5
host    replication     postgres        ::1/128                 md5

und /etc/postgresql/9.1/main/postgresql.conf sieht wie folgt aus:

# - Connection Settings -
listen_addresses = '*'
#listen_addresses = 'localhost'         # what IP address(es) to listen on;
                                        # comma-separated list of addresses;
                                        # defaults to 'localhost', '*' = all
                                        # (change requires restart)
port = 5432                             # (change requires restart)

Ich dann versuchen, eine Verbindung zu dem remote-Computer wie folgt:

psql -h ec2-xxx-xx-xxx-xxx.compute-1.amazonaws.com -d <database_name> -U <username>

wo ec2-xxx-xx-xxx-xxx.compute-1.amazonaws.com ist mein Öffentlichen DNS -.

Den oben genannten Befehl führt zu keiner Verbindung, wie kann ich die verbinden?

InformationsquelleAutor whatf | 2013-01-27

Schreibe einen Kommentar