Re: postgres 8 data directory other then default? - Mailing list pgsql-sql

From Joel Fradkin
Subject Re: postgres 8 data directory other then default?
Date
Msg-id 000901c5106c$47be3f90$797ba8c0@jfradkin
Whole thread Raw
In response to Re: postgres 8 data directory other then default?  (Richard Huxton <dev@archonet.com>)
List pgsql-sql
Thank you for all the help.

I was able to get system up (8.0 RPMS, not a build of 8.0.1)

I installed to the normal /var/lib/pgsql/data directory.
I did an initdb on the pgdata drive initdb /pgdata/data
This created a data folder on that drive set.
I used the instructions below for linking my wal to /wal drive.

I edited the postgres.conf in /var/lib/pgsl/data to use the
data_directory='pgdata/data'

I am hoping this means the log files and such are on /var/lib/pgsql/data and
that the actual data is on the pgdata/data and the wal is on the /wal.

I could confirm the /pgdata and /wal sytems were growing in size as I added
data to the database.

Everyone on this list has been so super helpful; I could never have figured
it out without all the guidance. I just wanted to thank everyone who jumped
in with help. Stuff is so hard when you're ignorant. I know my way around
the MSSQL world, and with the help here I feel I am getting started with
Postgres. Silly stupid stuff like environment variables etc when your new
take so long to figure out the right commands and where to put them, that's
why I really appreciated the step by step help.

I was thinking of documenting the whole process from install to finished
working project. You all think this be a good idea, just post it here?

Joel Fradkin
Wazagua, Inc.
2520 Trailmate Dr
Sarasota, Florida 34243
Tel.  941-753-7111 ext 305
jfradkin@wazagua.com
www.wazagua.com
Powered by Wazagua
Providing you with the latest Web-based technology & advanced tools.
C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, IncThis email message is for the use of the intended recipient(s)
andmay 
contain confidential and privileged information.  Any unauthorized review,
use, disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and delete and destroy
all copies of the original message, including attachments.


-----Original Message-----
From: Richard Huxton [mailto:dev@archonet.com]
Sent: Friday, February 11, 2005 4:22 AM
To: Joel Fradkin
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] postgres 8 data directory other then default?

Joel Fradkin wrote:
> I am trying to use a different drive for the data.
>
> I have edited postgres.conf to point to the new location, but I get the
> error /pgdata/PG_VERSION is missing.
>
> Do I have to do a initdb?
>
> When I try an initdb it says it is not empty. (has lost and found folder
in
> it).

Create a sub-directory. Separate filesystems will have a lost+found
folder at the top-level, so you'll need to create a directory called
pgsql (or whatever).

> Fedora Core 3 linux.
>
> I was able to do an init db if I create a folder called data in the
pgdata,
> but I was not sure if it then would use that folder for all the files (I
> just want my data to be there).

Ah - there you go then. All files live there unless you use
tablespaces/symbolic links.

> I also want to move my wal files to the /wal drives once I get it to start
> using pgdata drive for data.
>
> I got some info on this
>
> 0) backup your data
> 1) stop postmaster and verify.
> 2) cd $PGDATA; mv pg_xlog original_pg_xlog; ln -s /wal pg_xlog; cp
> original_pg_xlog/* pg_xlog
> 3) start postmaster and confirm correct startup in log files.
>
> Will this work? I am guessing this info would be in the var/lib folder not
> the /pgdata folder?

Well, what you might want to do is:
1. Setup your .../pgsql/data folder on the WAL drive.
2. initb that location
3. Set up a tablespace for your data on the other drive(s)

You can then have a default location for your database, and even move a
single table over to its own drive(s) if that's what you need. Details
in the manuals (start at chapter 18, then check the details in the SQL
reference).

I'd test it with a sample database first, make sure you're practiced
with it. Oh - if you do filesystem backups when the database is stopped,
make sure you remember to back up the alternate tablespace.

> Thanks in advance and sorry for asking so many dumb newb questions.
>
> Least this time the install of 8 went super smooth, just went to the
> postgres site and got the rpm's (Since I did not install 7 with the OS it
> asked for the fedora cd's a few times but all rpm's went ok).

Excellent.

> On the 8.1 files which are in tar files do I need to get those as well to
> get to 8.1 if so what is the procedure other then copying the files to my
> system (I have the .tar.bz)

It'll be 8.0.1 rather then 8.1 and they'll be source files. You unpack
them run configure and make and out pops a new version of PG. I'd
recommend sticking with the RPMs for the moment.

--  Richard Huxton  Archonet Ltd



pgsql-sql by date:

Previous
From: KÖPFERL Robert
Date:
Subject: Constraint doesn't see a currently insertet record
Next
From: Michael Fuhr
Date:
Subject: Re: Constraint doesn't see a currently insertet record