Обсуждение: Init script for multiple postmasters
Hi,
I'm trying to set up two postmasters on a two-node redhat cluster.
Instance #1:
pg_data: /var/lib/pgsql/data
user: postgres
Instance #2:
pg_data: /var/lib/pgsql2/data2
user: postgres2
Since databases are managed by cluster manager I need two different initscripts. Unfortunately the script provided in the rpm uses the 'status' function which does not make difference between two groups of processes:
$ /etc/init.d/postgresql status
postmaster (pid 5320 5319 5318 5316 5314) is running...
$ /etc/init.d/postgresql2 status
postmaster (pid 5320 5319 5318 5316 5314) is running...
In this scenario the cluster manager cannot determine wether a single instance is running or down.
I'm going to modify initscripts and use a differente approach to probe postmasters status, but I'm not sure if this is good:
ps ax | grep postmaster | grep /var/lib/pgsql2/data2
ps ax | grep postmaster | grep /var/lib/pgsql/data
What would you suggest?
Thanks
Nicola
Nicola Mauri wrote: > In this scenario the cluster manager cannot determine wether a single > instance is running or down. > I'm going to modify initscripts and use a differente approach to probe > postmasters status, but I'm not sure if this is good: > > ps ax | grep postmaster | grep /var/lib/pgsql2/data2 > ps ax | grep postmaster | grep /var/lib/pgsql/data > > What would you suggest? pg_ctl -d /var/lib/pgsql2/data2 status -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support
On 05/22/2006 02:33 PM, Alvaro Herrera wrote: > Nicola Mauri wrote: > >> In this scenario the cluster manager cannot determine wether a single >> instance is running or down. >> I'm going to modify initscripts and use a differente approach to probe >> postmasters status, but I'm not sure if this is good: >> >> ps ax | grep postmaster | grep /var/lib/pgsql2/data2 >> ps ax | grep postmaster | grep /var/lib/pgsql/data >> >> What would you suggest? > > pg_ctl -d /var/lib/pgsql2/data2 status > My experience is that you can not know if the database is running or has died by only checking the status flag. But if you combines these two, by checking the PID process ID from the pg_ctl command and then use 'ps -ax' to see that this process is really alive, then you have a proof. rgds Ola Sandbu