PostgreSQL Processes are very few and countable like, writer process, wal writer proces,stats collector,autovacuum process,syslogger process,archiver process & daemon postmaster. If replication enabled then there will be wal sender & wal receiver process. In my trainings, I use to show process information by executing "ps -ef | grep postgres", but how could I show the same on Solaris. So, I checked with Solaris Documentation and found its very simple and easy to get the process names as linux.
In PostgreSQL documentaion, its said to use /usr/ucb/ps with -ww options to get process names instead of regular /usr/bin/ps, however most of the information are hidden by /usr/ucb/ps option as well. Lets see how to retrieve complete postgres process names in solaris.
Below are my postgres 9.1 instance processes on Solaris:
--Raghav
In PostgreSQL documentaion, its said to use /usr/ucb/ps with -ww options to get process names instead of regular /usr/bin/ps, however most of the information are hidden by /usr/ucb/ps option as well. Lets see how to retrieve complete postgres process names in solaris.
Below are my postgres 9.1 instance processes on Solaris:
bash-3.00$ /usr/ucb/ps -awwx | grep postgres 7778 ? S 0:04 /Desktop/postgres/9.1-pgdg/bin/64/postgres -D /Desktop/postgres/9.1-pgdg/data 7779 ? S 0:01 /Desktop/postgres/9.1-pgdg/bin/64/postgres -D /Desktop/postgres/9.1-pgdg/data 7780 ? S 0:00 /Desktop/postgres/9.1-pgdg/bin/64/postgres -D /Desktop/postgres/9.1-pgdg/data 7781 ? S 0:00 /Desktop/postgres/9.1-pgdg/bin/64/postgres -D /Desktop/postgres/9.1-pgdg/data 7776 pts/5 S 0:00 /Desktop/postgres/9.1-pgdg/bin/64/postgres -D /Desktop/postgres/9.1-pgdg/dataMore extended way with pargs:
bash-3.00$ pargs `/usr/ucb/ps -awwx | grep postgres | awk '{print $1}'` 7778: /Desktop/postgres/9.1-pgdg/bin/64/postgres -D /Desktop/postgres/9.1-pgdg/data argv[0]: postgres: writer process argv[1]: argv[2]: 7779: /Desktop/postgres/9.1-pgdg/bin/64/postgres -D /Desktop/postgres/9.1-pgdg/data argv[0]: postgres: wal writer process argv[1]: argv[2]: 7780: /Desktop/postgres/9.1-pgdg/bin/64/postgres -D /Desktop/postgres/9.1-pgdg/data argv[0]: postgres: autovacuum launcher process argv[1]: argv[2]: 7781: /Desktop/postgres/9.1-pgdg/bin/64/postgres -D /Desktop/postgres/9.1-pgdg/data argv[0]: postgres: stats collector process argv[1]: argv[2]: 7776: /Desktop/postgres/9.1-pgdg/bin/64/postgres -D /Desktop/postgres/9.1-pgdg/data argv[0]: /Desktop/postgres/9.1-pgdg/bin/64/postgres argv[1]: -D argv[2]: /Desktop/postgres/9.1-pgdg/data7776 is postmaster daemon process.
bash-3.00$ cat /Desktop/postgres/9.1-pgdg/data/postmaster.pid 7776 /Desktop/postgres/9.1-pgdg/data 1339917119 5432 /tmp localhost 5432001 50331683Though it seems simple I believe its worth to know :).
--Raghav
4 comments :
If you are using pargs, why not use pargs `pgrep postgres` directly?
instead of "grep something | awk '{ print $1 }'" you could try "awk '/something/ { print $1 }'"
So our documentation is wrong now? Can you suggest a patch?
@Johann/Daniel
Thanks for your comments. Yep, you can do it in that way as well. If you see any of my blogs, all commands are very basic. Intention is to keep very simple who are new to PG or OS.. :).
@ Bruce
Nope, documentation is pretty much correct. Sometimes using /usr/ucb/ps -auwwx won't display the process titles, for that we need to use extended approach like pargs on Solaris.
Thanks Bruce :)
Post a Comment