From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Len Morgan <len-morgan(at)xroadstx(dot)com> |
Cc: | pgsql-questions(at)postgreSQL(dot)org, PostgreSQL Hackers Mailing List <pgsql-hackers(at)hub(dot)org> |
Subject: | Re: [HACKERS] RE: [QUESTIONS] Identity Crisis |
Date: | 1998-05-05 18:23:58 |
Message-ID: | 21334.894392638@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Len Morgan writes:
>> My question is this: Is there a way to identify on the line
>> which starts up the backends, which host is starting it? In other
>> words, if I do ps -ax on the server, can I have an ip address or host
>> name show up to let me know which host is connected to which backend?
Hackers, if anyone does something with setting the backend process title,
this seems like a good idea to me.
However, a feature that may or may not show up in 6.4 is not going to
help Len with his immediate problem. Len, I'd suggest a couple of
things you can do today:
1. netstat on your server will show open TCP connections. Look for
connections to port 5432 at your end. If you have a lot of users
it might be hard to spot the culprit --- but I suspect that looking
for the machine that shows a number of open connections, not just
one, will do it.
2. If that doesn't work, but you can identify a backend process that's
been laying around for awhile, you can use "lsof" to find out
which network connection leads to that process. For example,
I use ps to find that process 21309 is a backend, then:
$ lsof -p 21309
COMMAND PID USER FD TYPE DEVICE SIZE/OFF INODE NAME
postgres 21309 postgres 3u inet 0x0d2d1b00 0t0 TCP *:5432 (LISTEN)
postgres 21309 postgres 5u inet 0x0d749000 0t302 TCP localhost:5432->localhost:2325 (ESTABLISHED)
postgres 21309 postgres 6u inet 0x0d749000 0t302 TCP localhost:5432->localhost:2325 (ESTABLISHED)
(lots of non-inet open files for this process snipped)
So I see the client connected to this server is at port 2325 on
localhost.
lsof (list open files) might already be installed on your machine,
if not see http://www-rcd.cc.purdue.edu/abe/. It's an invaluable
tool for debugging all sorts of Unix problems, well worth having
in your sysadmin kit.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | The Hermit Hacker | 1998-05-05 20:23:42 | Re: [HACKERS] OK to send e-mail? |
Previous Message | Jackson, DeJuan | 1998-05-05 17:39:23 | RE: [QUESTIONS] Insert Errors |