PostgreSQL La base de donnees la plus sophistiquee au monde.

Forums PostgreSQL.fr

Le forum officiel de la communauté francophone de PostgreSQL

Vous n'êtes pas identifié(e).

#26 Re : Installation » PostgreSQL 9.1.3 sur Mac OS X Lion et accès distant » 04/04/2012 17:21:43

edlm a écrit :

L'IPV6 où se trouvent les bases étant fixe (freebox).

Le DNAT est il bien en place ? Port ouvert sur la freebox et redirigé sur le port qui est à l'écoute sur le serveur PostgreSQL ?


Ah purée, qu'elle andouille je fais, je n'ai pas redirigé 5432 sur 198.162.0.10

damned !

Bon, ça se complique un peu, j'ai deux serveurs psql l'un en 198.162.0.10 sous Mac OS X et un autre en 198.162.0.20 sous Xubuntu.

Il faudra que je change de port sur l'un des côtés.

#27 Re : Installation » PostgreSQL 9.1.3 sur Mac OS X Lion et accès distant » 04/04/2012 17:12:51

Je commence à voir le pb.

j'ai ajouté la ligne :

host	all		yt		192.168.0.20		md5

dans mon pg_hba.conf

et, la réponse depuis le client en "192.168.0.20" est :

$ psql -h 192.168.0.10 -U yt -d landp_public
psql: could not connect to server: Connexion refusée
	Is the server running on host "192.168.0.10" and accepting
	TCP/IP connections on port 5432?

alors qu'avant d'avoir modifié pg_hba.conf, j'avais :

$ psql -h 192.168.0.10 -U yt -d landp_public
psql: FATAL:  no pg_hba.conf entry for host "192.168.0.20", user "yt", database "landp_public", SSL off

donc, déjà mon pg_hba.conf est bien lu sur "192.168.0.10".

par contre, avec cette ligne ajoutée, le serveur ne démarre plus, si j'essaie de m'y connecter en local :

$ psql -h localhost -U yt -d landp_public
psql: could not connect to server: Connection refused
	Is the server running on host "localhost" (::1) and accepting
	TCP/IP connections on port 5432?
could not connect to server: Connection refused
	Is the server running on host "localhost" (fe80::1) and accepting
	TCP/IP connections on port 5432?
could not connect to server: Connection refused
	Is the server running on host "localhost" (127.0.0.1) and accepting
	TCP/IP connections on port 5432?

alors qu'avant d'avoir modifié pg_hba.conf j'avais bien :

psql -h localhost -U yt -d landp_public
Password for user yt: 
psql (9.0.5, server 9.1.3)
WARNING: psql version 9.0, server version 9.1.
         Some psql features might not work.
Type "help" for help.

landp_public=> \q

donc, la ligne :

host	all		yt		192.168.0.20		md5

est incorrecte ?
le server n'avait pas de pid :

$ sudo -s -u postgresql
$ /Library/PostgreSQL/9.1/bin/pg_ctl -D /Library/PostgreSQL/9.1/data restart
pg_ctl: PID file "/Library/PostgreSQL/9.1/data/postmaster.pid" does not exist
Is server running?
starting server anyway
server starting
$ exit

Et ça roule à nouveau...

#28 Re : Installation » PostgreSQL 9.1.3 sur Mac OS X Lion et accès distant » 04/04/2012 16:26:15

Oui :

$  sudo cat /Library/PostgreSQL/9.1/data/postgresql.conf | grep listen_addresses

listen_addresses = '*'        # what IP address(es) to listen on;

OK, merci bien pour ce document, je le lirai attentivement !

#29 Installation » PostgreSQL 9.1.3 sur Mac OS X Lion et accès distant » 04/04/2012 14:07:29

unbewusst
Réponses : 11

j'ai essayé d'accéder à distance à mes bases psql en ajoutant IPV6 ou IPV4 dans pg_hba.conf.
soit la connection m'a été refusée soit le serveur ne redémarrait pas sans donner d'erreur.
Aussi, pour l'instant, je peux y accéder en remote par un tunnel ssh. L'IPV6 où se trouvent les bases étant fixe (freebox).
On m'a indiqué qu'il vaut mieux utiliser SSL, que je ne connais pas du tout.

Je suis donc à la recherche d'infos et surtout de tutos concernant la connection à distance soit par TCP/IP tout court soit en passant par SSL.

Pied de page des forums

Propulsé par FluxBB