Discussion:
how do you run postgres without dns server
(too old to reply)
Ivan Dimitrov
2004-11-10 09:45:18 UTC
Permalink
I have a database on a machine that does not know what localhost is. Yes, I
have 127.0.0.1, but I can't resolve localhost to it. I don't want to start a
caching dns, and don't want to change resolve.conf. Upon starting, postgres
gives error cannot bind to localhost. then starts accepting connections to
127.0.0.1 normaly.
So, why does postgres try to resolve localhost in the first place? Because of
this error pg_autovacuum does not start.
--
Hi! I'm your friendly neighbourhood signature virus.
Copy me to your signature file and help me spread!
Halford Dace
2004-11-10 10:05:00 UTC
Permalink
localhost should be defined in your hosts file, which in most unixoid
environments is /etc/hosts. It is not an error.

Hal
Post by Ivan Dimitrov
I have a database on a machine that does not know what localhost is. Yes, I
have 127.0.0.1, but I can't resolve localhost to it. I don't want to start a
caching dns, and don't want to change resolve.conf. Upon starting, postgres
gives error cannot bind to localhost. then starts accepting connections to
127.0.0.1 normaly.
So, why does postgres try to resolve localhost in the first place? Because of
this error pg_autovacuum does not start.
--
Hi! I'm your friendly neighbourhood signature virus.
Copy me to your signature file and help me spread!
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
Ivan Dimitrov
2004-11-10 10:15:37 UTC
Permalink
Yes, it is there
127.0.0.1 localhost
but when i strace postmaster on startup it never looks in /etc/hosts
Post by Halford Dace
localhost should be defined in your hosts file, which in most unixoid
environments is /etc/hosts. It is not an error.
Hal
Post by Ivan Dimitrov
I have a database on a machine that does not know what localhost is. Yes,
I have 127.0.0.1, but I can't resolve localhost to it. I don't want to
start a caching dns, and don't want to change resolve.conf. Upon
starting, postgres gives error cannot bind to localhost. then starts
accepting connections to 127.0.0.1 normaly.
So, why does postgres try to resolve localhost in the first place?
Because of this error pg_autovacuum does not start.
--
Hi! I'm your friendly neighbourhood signature virus.
Copy me to your signature file and help me spread!
--
Hi! I'm your friendly neighbourhood signature virus.
Copy me to your signature file and help me spread!
Oliver Elphick
2004-11-10 14:08:07 UTC
Permalink
Post by Ivan Dimitrov
Yes, it is there
127.0.0.1 localhost
but when i strace postmaster on startup it never looks in /etc/hosts
Look at the "hosts:" line in /etc/nsswitch.conf. It needs to have the
word "files" in there.
--
Oliver Elphick ***@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA
========================================
"But thanks be to God, which giveth us the victory
through our Lord Jesus Christ."
I Corinthians 15:57


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html
Ivan Dimitrov
2004-11-10 15:19:47 UTC
Permalink
Yes that is true too. I've checked it all. It apears that postgres tries to
resolve only through dns'...:(

I think that the problem is in the postgresql, but I can't reproduce the
problem anymore, because I was forced to install a caching dns server, and
I'm not allowed to play with it anymore (business must run).

The nscd problem:
I didn't post this before, because I thik this is not a postgres related
problem, but after a few hours playing with it I couldn't fix the problem
I have nscd + pgsql backend
I have
passwd: compat [NOTFOUND=continue SUCCESS=return] pgsql
group: compat [NOTFOUND=continue SUCCESS=return] pgsql

in /etc/nsswitch.conf
The logic of this, from what I could understand from the documentation is:
"Look in the standart files (/etc/passwd, /etc/group)" for username and
groups, if not found, search in pgsql databasee, else return successfull"

The problem is that when I stop the database and I try to `id realuser` it
gives:
# id root
Could not connect to database

The system is Debian sarge with packages:
nscd 2.3.2.ds1-18
libnss-pgsql1 1.0.2-1.2
postgresql 7.4.5-3
Post by Oliver Elphick
Post by Ivan Dimitrov
Yes, it is there
127.0.0.1 localhost
but when i strace postmaster on startup it never looks in /etc/hosts
Look at the "hosts:" line in /etc/nsswitch.conf. It needs to have the
word "files" in there.
--
Hi! I'm your friendly neighbourhood signature virus.
Copy me to your signature file and help me spread!
S. C.
2004-11-11 01:07:09 UTC
Permalink
Do you got "hosts: files dns" in your nsswitch.conf?
Otherwise , /etc/hosts won't be used.


-----------------------------------------------------------------
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd: compat
group: compat
shadow: compat

hosts: files dns
networks: files

protocols: db files
services: db files
ethers: db files
rpc: db files

netgroup: nis
----------------------------------------------

Regards
Simon Chen.

---------- Original Message -----------
From: Ivan Dimitrov <***@bastun.net>
To: pgsql-***@postgresql.org
Sent: Wed, 10 Nov 2004 17:19:47 +0200
Subject: Re: [ADMIN] nscd [was] how do you run postgres without dns server
Post by Ivan Dimitrov
Yes that is true too. I've checked it all. It apears that postgres
tries to resolve only through dns'...:(
I think that the problem is in the postgresql, but I can't reproduce
the problem anymore, because I was forced to install a caching dns
server, and I'm not allowed to play with it anymore (business must
run).
I didn't post this before, because I thik this is not a postgres
related problem, but after a few hours playing with it I couldn't
compat [NOTFOUND=continue SUCCESS=return] pgsql
in /etc/nsswitch.conf
The logic of this, from what I could understand from the
documentation is: "Look in the standart files (/etc/passwd,
/etc/group)" for username and groups, if not found, search in pgsql
databasee, else return successfull"
The problem is that when I stop the database and I try to `id
# id root
Could not connect to database
nscd 2.3.2.ds1-18
libnss-pgsql1 1.0.2-1.2
postgresql 7.4.5-3
Post by Oliver Elphick
Post by Ivan Dimitrov
Yes, it is there
127.0.0.1 localhost
but when i strace postmaster on startup it never looks in /etc/hosts
Look at the "hosts:" line in /etc/nsswitch.conf. It needs to have the
word "files" in there.
--
Hi! I'm your friendly neighbourhood signature virus.
Copy me to your signature file and help me spread!
------- End of Original Message -------


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Loading...