Problema com postgresql + debian Lenny
Boa tarde!
To com um problema para conseguir acessar o banco postgresql instalado no servidor debian 5.0.4, (Linux 2.6.26-2-686).
Instalei com o apt-get, a versão 8.3 do postgresql, tranquilo, não deu nenhum problema.
O problema é para acessar atraves no pgadmin3 num micro da rede, no dominio.
Modifiquei os arquivos pg_hba.conf, da seguinte maneira:
Citação:
local all postgres ident sameuser
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
#local all all ident sameuser
# IPv4 local connections:
host all all 0.0.0.0/0 password
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
E o postgresql.conf:
Citação:
listen_addresses = '*'
E inseri, no iptables a seguinte regra:
Citação:
$IPT -A INPUT -s $REDE_INT -p tcp --dport 5432 -j ACCEPT
Ao tentar acessar pelo pgadimn, ele diz que o servidor não está escutando... bla bla bla.
O engraçado que se dou um netstat -na | grep 5432, olha só o resultado:
Citação:
tcp 0 0 127.0.0.1:5432 0.0.0.0:* OUÃA
tcp6 0 0 ::1:5432 :::* OUÃA
unix 2 [ ACC ] STREAM OUVINDO 3743123 /var/run/postgresql/.s.PGSQL.5432
parece que ele não está escutando na interface da rede (192.168.10.x).
Ja tentei varias coisas, regras diferentes de firewall, etc. Mas não sei o que fazer para solucionar, esperava que alguem pudesse me dar uma ajuda, por favor.
Re: Problema com postgresql + debian Lenny
Tente isso:
local all postgres ident sameuser
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
#local all all ident sameuser
# IPv4 local connections:
host all all 192.168.10./24 password
host all all 127.0.0.1/32 md5
# IPv6 local connections:
#host all all ::1/128 md5
Re: Problema com postgresql + debian Lenny
# IPv4 local connections:
host all all 192.168.10.0/24 password
host all all 127.0.0.1/32 md5
# vai o range de sua rede, mas nao me lembro se vai o 0 do range o não, mas isso vai te ajudar, e tem que ver como é sua autenticação ao banco "password como descrito ou md5"
Re: Problema com postgresql + debian Lenny
Valeu pela força mfogaca, já fiz a mudança, mas vou poder testar a comunicação recem amanhã.
Muito Obrigado!
Re: Problema com postgresql + debian Lenny
Re: Problema com postgresql + debian Lenny
fiz as modificações, e ainda da o erro: (tentando acessar pelo pgadmin3 num micro da rede)
Citação:
"Server doesn´t listen
The server doesn't accept connections: the connection library reports
could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "192.168.10.1" and accepting TCP/IP connections on port 5432?
já tentei de tudo, modifiquei umas 200 vezes os config.
criei uma maquina virtual aqui, e testei nela, a mesma porcaria.
Parece que ele fica escutando só no "localhost".
To desesperado já
Re: Problema com postgresql + debian Lenny
vo te mandar o meu pg_hba.conf que foi apenas o que eu mudei deixa ele assim e desfaz alguma alteração que tu tenhas feito, e deixe com essa config, pq aqui funciona tranquilamente.
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the
# PostgreSQL documentation for a complete description
# of this file. A short synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access. Records take one of these forms:
#
# local DATABASE USER METHOD [OPTION]
# host DATABASE USER CIDR-ADDRESS METHOD [OPTION]
# hostssl DATABASE USER CIDR-ADDRESS METHOD [OPTION]
# hostnossl DATABASE USER CIDR-ADDRESS METHOD [OPTION]
#
# (The uppercase items must be replaced by actual values.)
#
# The first field is the connection type: "local" is a Unix-domain socket,
# "host" is either a plain or SSL-encrypted TCP/IP socket, "hostssl" is an
# SSL-encrypted TCP/IP socket, and "hostnossl" is a plain TCP/IP socket.
#
# DATABASE can be "all", "sameuser", "samerole", a database name, or
# a comma-separated list thereof.
#
# USER can be "all", a user name, a group name prefixed with "+", or
# a comma-separated list thereof. In both the DATABASE and USER fields
# you can also write a file name prefixed with "@" to include names from
# a separate file.
#
# CIDR-ADDRESS specifies the set of hosts the record matches.
# It is made up of an IP address and a CIDR mask that is an integer
# (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that specifies
# the number of significant bits in the mask. Alternatively, you can write
# an IP address and netmask in separate columns to specify the set of hosts.
#
# METHOD can be "trust", "reject", "md5", "crypt", "password",
# "krb5", "ident", "pam" or "ldap". Note that "password" sends passwords
# in clear text; "md5" is preferred since it sends encrypted passwords.
#
# OPTION is the ident map or the name of the PAM service, depending on METHOD.
#
# Database and user names containing spaces, commas, quotes and other special
# characters must be quoted. Quoting one of the keywords "all", "sameuser" or
# "samerole" makes the name lose its special character, and just match a
# database or username with that name.
#
# This file is read on server startup and when the postmaster receives
# a SIGHUP signal. If you edit the file on a running system, you have
# to SIGHUP the postmaster for the changes to take effect. You can use
# "pg_ctl reload" to do that.
# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records. In that case you will also need to make PostgreSQL listen
# on a non-local interface via the listen_addresses configuration parameter,
# or via the -i or -h command line switches.
#
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 192.168.0.0/24 md5
# IPv6 local connections:
#host all all ::1/128 md5
Re: Problema com postgresql + debian Lenny
Valeu fogaça.
Não funcionou ainda, he he.
Será que tu poderia me passar o postgresql.conf e a regra do iptables para liberar a porta?? porque realmente eu nao entendo o que estou fazendo errado.
Obs. do teu arquivo original pg_hba.conf só mudei a o endereço 192.168.0.0 de acordo com minha rede.
Mais ainda recebo a mesma mens de erro, quando tento acessar de um micro da rede.
Muito Obrigado pela ajuda até agora
Re: Problema com postgresql + debian Lenny
me passa seu email que lhe mando meu arquivo postgresql.conf
Re: Problema com postgresql + debian Lenny
Consegui solucionar Paulo!
O problema era que eu tava criando um backup da pasta "/etc/postgresql/8.3/main" como "/etc/postgresql/8.3/main.default" com os arquivos padrão.
E ao reiniciar o serviço, ele carregava tb esse main.default!!!!. disgraça....
Fica a dica ai, se alguem fizer a mesma burrice
Muito Obrigado pela ajuda Paulo!, as tuas dicas me ajudaram um monte tb!
Valeu!
Re: Problema com postgresql + debian Lenny
Como coloca o topico como "Resolvido"?
Re: Problema com postgresql + debian Lenny