Hallo Forum,
ich habe Probleme, auf mein PostgreSQL zuzugreifen, wenn ich es von einem anderen Rechner aus versuche. Auch der lokale Zugriff mit der IP-Adresse des Rechners klappt nicht.
Zugriff mit ‘localhost’ geht einwandfrei.
BS: Suse 10.3, psql (PostgreSQL) 8.2.5 (selbst compiliert)
Diese Version habe ich auf meinem System selbst compiliert (ohne Änderungen an den Parametern)
Was mache ich falsch?
Fehlt noch eine Information?
Zugriffsversuche rein lokal!
Server gestartet mit:
Walli2:~# su postgres --command=“/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data -d3 -i -e”
Protokoll-Auszug:
DEBUG: SSH_AGENT_PID=5910
DEBUG: HOSTNAME=Walli2
…
DEBUG: HOST=Walli2
DEBUG: TERM=xterm
DEBUG: SHELL=/bin/bash
DEBUG: PROFILEREAD=true
…
DEBUG: USER=postgres
…
DEBUG: DESKTOP_SESSION=kde
…
DEBUG: CPU=i686
DEBUG: _=/usr/local/pgsql/bin/postgres
…
DEBUG: HOME=/var/lib/pgsql
DEBUG: LESS_ADVANCED_PREPROCESSOR=no
DEBUG: OSTYPE=linux
…
DEBUG: no_proxy=localhost, .xxxxxxx.xxxxxx.de
…
DEBUG: MACHTYPE=i686-suse-linux
…
DEBUG: XAUTHLOCALHOSTNAME=Walli2
…
DEBUG: LC_COLLATE=de_DE@euro
DEBUG: LC_CTYPE=de_DE@euro
DEBUG: LC_MESSAGES=de_DE@euro
DEBUG: LC_MONETARY=C
DEBUG: LC_NUMERIC=C
DEBUG: LC_TIME=C
…
DEBUG: max_safe_fds = 980, usable_fds = 1000, already_open = 10
LOG: database system was shut down at 2008-02-06 20:06:45 CET
LOG: checkpoint record is at 0/460FE4
LOG: redo record is at 0/460FE4; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 0/741; next OID: 16442
LOG: next MultiXactId: 1; next MultiXactOffset: 0
LOG: database system is ready
DEBUG: transaction ID wrap limit is 2147484173, limited by database “postgres”
DEBUG: proc_exit(0)
DEBUG: shmem_exit(0)
DEBUG: exit(0)
Soweit alles o.k. und der rein lokale (mit localhost) Zugriff geht. Sobald ich aber eine IP-Adresse eingebe (auch die eigene), wird der Zugriff verweigert.
Es läuft keine Firewall!
Ich starte die Abfrage über ein Script
echo -e “\n\t… using Database: "$PGDATABASE" on Host: "$PGHOST" as User: "$PGUSER"\n”
psql -h $PGHOST -d $PGDATABASE -U $PGUSER -W
Echo ist
… using Database: “template1” on Host: “192.168.17.2” as User: “guenter”
Password for user guenter:
psql: FATAL: no pg_hba.conf entry for host “192.168.17.2”, user “guenter”, database “template1”
LOG: connection received: host=192.168.17.2 port=49513
FATAL: no pg_hba.conf entry for host “192.168.17.2”, user “guenter”, database “template1”
DEBUG: proc_exit(1)
DEBUG: shmem_exit(1)
DEBUG: exit(1)
DEBUG: forked new backend, pid=7827 socket=8
DEBUG: server process (PID 7827) exited with exit code 1
LOG: connection received: host=192.168.17.2 port=18878
FATAL: no pg_hba.conf entry for host “192.168.17.2”, user “guenter”, database “template1”
DEBUG: proc_exit(1)
DEBUG: shmem_exit(1)
DEBUG: exit(1)
DEBUG: forked new backend, pid=8072 socket=8
DEBUG: server process (PID 8072) exited with exit code 1
Konfigurations-Dateien (Auszüge):
/var/lib/pgsql/data/pg_hba.conf:
TYPE DATABASE USER CIDR-ADDRESS METHOD
IPv4 local connections:
#host all all 127.0.0.1/32 trust
#host all all 192.168.17.0/24 md5
#host all all 192.168.17.0/24 trust
host all all 192.168.17.2 trust
IPv6 local connections:
host all all ::1/128 md5
/var/lib/pgsql/data/postgresql.conf
#listen_addresses = ‘localhost’
#listen_addresses = “192.168.17.2, 192.168.17.4”
listen_addresses = “*”
In beiden Dateien:
Alle auskommetierten Zeilen arbeiteten nicht, die aktive sollte eigentlich funktionieren?
Abfrage mit ‘netstat -a’
Aktive Internetverbindungen (Server und stehende Verbindungen)
Proto Recv-Q Send-Q Local Address Foreign Address State
…
tcp 0 0 *:postgresql : LISTEN
tcp 0 0 walli2.walln:postgresql walli2.wallnig.fa:18878 TIME_WAIT
tcp 0 0 *:postgresql : LISTEN
…
Aktive Sockets in der UNIX Domäne (Server und stehende Verbindungen)
Proto RefZäh Flaggen Typ Zustand I-Node Pfad
…
unix 2 [ ACC ] STREAM HÖRT 23299 /tmp/.s.PGSQL.5432
…
psql --version
psql (PostgreSQL) 8.2.5
contains support for command-line editing
Die Datei ‘pg_ctl’ habe ich manuell kopiert, weil das Installscript das nicht gemacht hat (und diverse sym-links
‘# ln -s /usr/local/pgsql/bin/postmaster /usr/bin/ …’)
cp /Install/postgresql-8.2.5/contrib/start-scripts/linux /usr/bin/pg_ctl