Thread: PGDATA

PGDATA

From
sasan3@gmail.com
Date:

I just can't understand the use of this PGDATA variable!!!!!

-I am on FC3. (pgl 7.4)
-I am installing rpms and then running /etc/init.d/postgresql start
(which is done by default)
-The resulting "data" directory is in /var/lib/pgsql/data

I now want the "data" directory to be on
/home3/myreallylargepartition/pgsql/data
so:

-I login as postgres
-I change .bash_profile so that PGDATA points at the new directory
-I restart the server by  doing a "/etc/init.d/postgresql restart"

Shouldn't any new tables I create be in the new area?!!!!!

Thanks.


Re: PGDATA

From
Richard Broersma Jr
Date:
> I just can't understand the use of this PGDATA variable!!!!!
>
> -I am on FC3. (pgl 7.4)
> -I am installing rpms and then running /etc/init.d/postgresql start
> (which is done by default)
> -The resulting "data" directory is in /var/lib/pgsql/data
>
> I now want the "data" directory to be on
> /home3/myreallylargepartition/pgsql/data
> so:
>
> -I login as postgres
> -I change .bash_profile so that PGDATA points at the new directory
> -I restart the server by  doing a "/etc/init.d/postgresql restart"
>
> Shouldn't any new tables I create be in the new area?!!!!!
>

Well not really,  I bet /etc/init.d/postgresql is getting its variables from
/etc/conf.d/postgresql.  you will have to find it there and change it.

Regards,

Richard Broersma Jr.

Re: PGDATA

From
"sasan3@gmail.com"
Date:

Well.. you are correct!
After studying the contents of "/etc/init.d/postfresql", I put
"PGDATA=/home3/mylargedisk/data" in "/etc/sysconfig/pgsql/postgresql"
and it now works.

So what the ..... is this PGDATA!!!!!! It must be a trivial concept
cause nobody else is worried about how it works!!  And How do I get
each database to be in a different directory?!!

Thanks.

>
> Well not really,  I bet /etc/init.d/postgresql is getting its variables from
> /etc/conf.d/postgresql.  you will have to find it there and change it.
>
> Regards,
>
> Richard Broersma Jr.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>                http://archives.postgresql.org/


Re: PGDATA

From
Ragnar
Date:
On fös, 2006-11-24 at 16:14 -0800, sasan3@gmail.com wrote:
>
> Well.. you are correct!
> After studying the contents of "/etc/init.d/postfresql", I put
> "PGDATA=/home3/mylargedisk/data" in "/etc/sysconfig/pgsql/postgresql"
> and it now works.
>
> So what the ..... is this PGDATA!!!!!! It must be a trivial concept
> cause nobody else is worried about how it works!!  And How do I get
> each database to be in a different directory?!!

are you looking for:

  CREATE TABLESPACE myts LOCATION '/foo';
  CREATE DATABASE mydb WITH TABLESPACE=myts;

?

gnari



Re: PGDATA

From
"Jeffrey Webster"
Date:
On 24 Nov 2006 04:43:02 -0800, sasan3@gmail.com <sasan3@gmail.com> wrote:


I just can't understand the use of this PGDATA variable!!!!!

-I am on FC3. (pgl 7.4)
-I am installing rpms and then running /etc/init.d/postgresql start
(which is done by default)
-The resulting "data" directory is in /var/lib/pgsql/data

I now want the "data" directory to be on
/home3/myreallylargepartition/pgsql/data
so:

-I login as postgres
-I change .bash_profile so that PGDATA points at the new directory
-I restart the server by  doing a "/etc/init.d/postgresql restart"

Shouldn't any new tables I create be in the new area?!!!!!

Thanks.


After you changed PGDATA, and thus, the location of the data files, did you remember to run "initdb" first?

This is the usual sequence of events for changing where the data files exist (as root, or via sudo):

/etc/init.d/postgresql stop
mkdir -p /pgsql/data
chown -R pgsql:pgsql /pgsql/data
su -l pgsql
export PGDATA=/pgsql/data  # Make sure /etc/init.d/postgresql is aware of this change.
initdb



Starting the database being the last thing you do.