Обсуждение: postmaster.pid file

Поиск
Список
Период
Сортировка

postmaster.pid file

От
"Tena Sakai"
Дата:

Hi Everybody,

I experienced something a bit strange.
When I issued, on a linux machine, the following
command as user postgres:
    ~/bin/pg_ctl -D ~/bin reload
It wasn't happy.  The complaint was:
    pg_ctl: PID file "/usr/local/pgsql/bin/postmaster.pid" does not exist
    Is server running?

Upon checking, I discovered that the file postmaster.pid was
in data directory and as I copied it into ~/bin directory (and
changed the ownership and permission appropriately), it sent
the HUP signal to the server process and all was well.  I am
sure I have issued this command before and never had problems
like today.

Question 1:
  What happened?
  Did I do the right thing?  If not, please tell me what I
  should've and could've done.

Question 2:
  As I looked at the pid file, there were three lines.  The
  first line seemed like the pid of the server process.  The
  second line indicates where the database cluster resides.
  In my case it is /usr/local/pgsql/data.  The last line has
  two numbers.  In my case they are: 5432001 and 131072.
  What do they represent?  I don't seem to have processes
  by such id.

Thank you in advance.

Regards,

Tena Sakai
tsakai@gallo.ucsf.edu

Re: postmaster.pid file

От
Tom Lane
Дата:
"Tena Sakai" <tsakai@gallo.ucsf.edu> writes:
> When I issued, on a linux machine, the following
> command as user postgres:
>     ~/bin/pg_ctl -D ~/bin reload
> It wasn't happy.

As well it shouldn't be.  -D is supposed to specify the data directory,
not the place where the executables are.

> Upon checking, I discovered that the file postmaster.pid was
> in data directory and as I copied it into ~/bin directory (and
> changed the ownership and permission appropriately),

That was a bad idea; you'll have to delete it from there manually.

            regards, tom lane

Re: postmaster.pid file

От
"Tena Sakai"
Дата:

Thank you, Tom.

As I typed:
    ~/bin/pg_ctl -D ~/bin reload

I thought I had typed:
    ~/bin/pg_ctl -D ~/data reload

(Had I not copied-and-pasted the actual command,
I would have given you the correct line, which
would have been really bad!)  I was blind!

I got the extra file in ~/bin directory removed.

Regards,

Tena
tsakai@gallo.ucsf.edu

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Mon 8/13/2007 3:37 PM
To: Tena Sakai
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] postmaster.pid file

"Tena Sakai" <tsakai@gallo.ucsf.edu> writes:
> When I issued, on a linux machine, the following
> command as user postgres:
>     ~/bin/pg_ctl -D ~/bin reload
> It wasn't happy.

As well it shouldn't be.  -D is supposed to specify the data directory,
not the place where the executables are.

> Upon checking, I discovered that the file postmaster.pid was
> in data directory and as I copied it into ~/bin directory (and
> changed the ownership and permission appropriately),

That was a bad idea; you'll have to delete it from there manually.

                        regards, tom lane

Re: postmaster.pid file

От
Tom Lane
Дата:
"Tena Sakai" <tsakai@gallo.ucsf.edu> writes:
> As I typed:
>     ~/bin/pg_ctl -D ~/bin reload
> I thought I had typed:
>     ~/bin/pg_ctl -D ~/data reload

I recommend setting up PGDATA as an environment variable, so you never
have to type it at all ...

            regards, tom lane

Re: postmaster.pid file

От
Peter Eisentraut
Дата:
Tena Sakai wrote:
>     ~/bin/pg_ctl -D ~/bin reload

It's quite unlikely that your data directory is "~/bin".

>   As I looked at the pid file, there were three lines.  The
>   first line seemed like the pid of the server process.  The
>   second line indicates where the database cluster resides.
>   In my case it is /usr/local/pgsql/data.

That should be your -D argument then.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

Re: postmaster.pid file

От
"Tena Sakai"
Дата:

Hi Tom,

An excellent suggestion and I've just done it.
Many thanks.

Tena Sakai
tsakai@gallo.ucsf.edu


-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Mon 8/13/2007 4:21 PM
To: Tena Sakai
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] postmaster.pid file

"Tena Sakai" <tsakai@gallo.ucsf.edu> writes:
> As I typed:
>     ~/bin/pg_ctl -D ~/bin reload
> I thought I had typed:
>     ~/bin/pg_ctl -D ~/data reload

I recommend setting up PGDATA as an environment variable, so you never
have to type it at all ...

                        regards, tom lane