Re: killing old connections
От | Reiner Dassing |
---|---|
Тема | Re: killing old connections |
Дата | |
Msg-id | 393FB629.A6DCBAA3@wettzell.ifag.de обсуждение исходный текст |
Ответ на | killing old connections ("Tim White" <twhite@friendlyworks.com>) |
Список | pgsql-admin |
Hello Tim! Tim White wrote: > > Is there a way to view the active/inactive connections to PostgreSQL 6.5.3? I have the same problems, but I solved it by using the following algorithm: 1. Get a list all processes of the postmaster by ps -u postgres | grep /usr/local/pgsql/bin/postmaster 2. If there is just 1 process, finish 3. Determine the pid's (Process IDs) of all the processes of step 1 4. Determine the PPIDs (Parent PIDs) of all processes, by ps -p PID -o ppid (well, this line is for Tru64; you have to ask your man page for your switches) 5. Determine the process which is the father of all your processes, this is the one which has as its father the PID 1 The father postmaster so to say is not the process you should look at during the further steps. 6. For all the other PIDs do - determine the elapsed sleeping time and ist state by ps -p PID -o etime,sl,state (under Tru64) - if the sleeping time is greater than ??? hours (or minutes) kill it by 'kill PID' This algorithm was implemented in PERL and is running every hour via cron. Maybe that helps > And if so is it possible to kill those that are inactive? I'm having > difficulty in testing using a Java application, where connections are > established and then not being destroyed properly. This causes me to get an > error message stating that there are "...too many clients already.". > > Any help is greatly appreciated. > > Tim White -- Mit freundlichen Gruessen / With best regards Reiner Dassing
В списке pgsql-admin по дате отправления: