How do I determine my data dir for a created database for pg_ctl?

Started by Matthew Pettisover 17 years ago6 messagesgeneral
Jump to latest
#1Matthew Pettis
matthew.pettis@gmail.com

Hi,

I have a database I can psql into... How can I determine what its
absolute path is so I can use pg_ctl on it to restart it? Because
when I use pg_ctl, it tells me I have to provide it in the -D flag as
an argument.

Thanks,
matt

--
It is from the wellspring of our despair and the places that we are
broken that we come to repair the world.
-- Murray Waas

#2Matthew Pettis
matthew.pettis@gmail.com
In reply to: Matthew Pettis (#1)
Fwd: How do I determine my data dir for a created database for pg_ctl?

Hi,

I have a database I can psql into... How can I determine what its
absolute path is so I can use pg_ctl on it to restart it? Because
when I use pg_ctl, it tells me I have to provide it in the -D flag as
an argument.

Thanks,
matt

--
It is from the wellspring of our despair and the places that we are
broken that we come to repair the world.
-- Murray Waas

--
It is from the wellspring of our despair and the places that we are
broken that we come to repair the world.
-- Murray Waas

#3Klint Gore
kgore4@une.edu.au
In reply to: Matthew Pettis (#2)
Re: Fwd: How do I determine my data dir for a created database for pg_ctl?

Matthew Pettis wrote:

I have a database I can psql into... How can I determine what its
absolute path is so I can use pg_ctl on it to restart it? Because
when I use pg_ctl, it tells me I have to provide it in the -D flag as
an argument.

show data_directory;

klint.

--
Klint Gore
Database Manager
Sheep CRC
A.G.B.U.
University of New England
Armidale NSW 2350

Ph: 02 6773 3789
Fax: 02 6773 3266
EMail: kgore4@une.edu.au

#4Tovo Rabemanantsoa
tovo@bordeaux.inra.fr
In reply to: Matthew Pettis (#1)
Re: How do I determine my data dir for a created database for pg_ctl?

Matthew Pettis wrote:

Hi,

I have a database I can psql into... How can I determine what its
absolute path is so I can use pg_ctl on it to restart it? Because
when I use pg_ctl, it tells me I have to provide it in the -D flag as
an argument.

Thanks,
matt

Hello,
I use postgresql on a linux ubuntu platform and the path used by default is /etc/postgresql/8.1/main/pgdata
In reality, this path is a symbolic link to /var/lib/postgresql/8.1/main
I suppose that in the other linux distros, it's near this configuration.
Hope this helps

--
Tovo J. RABEMANANTSOA
INRA - UR1263 EPHYSE
71, Av. Edouard Bourlaux
F-33140 Villenave d'Ornon - France
Tᅵlᅵphone : +33 5 57 12 24 09

#5Barbara Figueirido
barbara@bariloche.com.ar
In reply to: Matthew Pettis (#1)
Re: How do I determine my data dir for a created database for pg_ctl?

Matthew Pettis wrote:

Hi,

I have a database I can psql into... How can I determine what its
absolute path is so I can use pg_ctl on it to restart it? Because
when I use pg_ctl, it tells me I have to provide it in the -D flag as
an argument.

Thanks,
matt

Hi. I'm quite a novice, but I think I can help. In need of determining
the path to the data, I use an indirect method: since different
distributions have different paths, I try to locate the pg_hba.conf
file, which resides on the same directory as your data (with the command
"find / -name 'pg_hba.conf'" (without the double quotes) issued as root).
But since your postmaster is running, I would rather try the following:

ps auwx |grep postmaster

this tells you whether it is in fact running, and if it is, tells you
also the path where the -D flag points to.

Hope this is somehow useful. Best regards,
Barbara

#6Matthew Pettis
matthew.pettis@gmail.com
In reply to: Barbara Figueirido (#5)
Re: How do I determine my data dir for a created database for pg_ctl?

Thank You, Barbara,

See Klint Gore's solution -- that's the one I used and it worked for
me quite well.

Thanks again,
Matt

On Wed, Aug 20, 2008 at 2:38 PM, Barbara Figueirido
<barbara@bariloche.com.ar> wrote:

Matthew Pettis wrote:

Hi,

I have a database I can psql into... How can I determine what its
absolute path is so I can use pg_ctl on it to restart it? Because
when I use pg_ctl, it tells me I have to provide it in the -D flag as
an argument.

Thanks,
matt

Hi. I'm quite a novice, but I think I can help. In need of determining
the path to the data, I use an indirect method: since different
distributions have different paths, I try to locate the pg_hba.conf
file, which resides on the same directory as your data (with the command
"find / -name 'pg_hba.conf'" (without the double quotes) issued as root).
But since your postmaster is running, I would rather try the following:

ps auwx |grep postmaster

this tells you whether it is in fact running, and if it is, tells you
also the path where the -D flag points to.

Hope this is somehow useful. Best regards,
Barbara

--
It is from the wellspring of our despair and the places that we are
broken that we come to repair the world.
-- Murray Waas