Re: Multiple databases on seperate drives/file systems?

From: "Scot L(dot) Harris" <webid(at)cfl(dot)rr(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Multiple databases on seperate drives/file systems?
Date: 2004-06-09 13:45:10
Message-ID: 1086788709.20203.8.camel@lathe
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2004-06-08 at 17:01, Jim Seymour wrote:
> Perhaps the man pages are screwed-up?
>
> $ man createdb
> [snip]
> -D location
>
> --location location
> Specifies the alternative location for the database.
> See also initlocation(1).
>
> $ man initlocation
> [snip]
> EXAMPLES
> To create a database in an alternate location, using an
> environment variable:
>
> $ export PGDATA2=/opt/postgres/data
>
> Stop and start postmaster so it sees the PGDATA2 environment
> variable. The system must be configured so the postmaster
> sees PGDATA2 every time it starts. Finally:
>
> $ initlocation PGDATA2
> $ createdb -D PGDATA2 testdb
>
>
> Alternatively, if you allow absolute paths you could write:
>
> $ initlocation /opt/postgres/data
> $ createdb -D /opt/postgres/data/testdb testdb
>
> >From this I gather that what they *mean*, for the initlocation and
> createdb commands, is $PGDATA2. (Note the "$".)
>
> Jim

I started trying this using the man pages instructions. With the $
included I get the following results:

-bash-2.05b$ createdb -D $PGDATA2 testdb3
ERROR: Absolute paths are not allowed as database locations
createdb: database creation failed

Without the $ I get the following:

-bash-2.05b$ createdb -D PGDATA2 testdb3
ERROR: Postmaster environment variable 'PGDATA2' not set
createdb: database creation failed
-bash-2.05b$ echo $PGDATA2
/vhost/database/data

Which indicates to me that the PGDATA2 environment variable that is
defined in the postgres users .bash_profile is not being picked up by
the postmaster process. Which I have restarted numerous times in an
effort to get it to pick that variable up.

I am beginning to suspect that I would have to find a way to add the
PGDATA2 variable to the startup script for postgresql. Which the docs I
have read so far do not indicate as being required.

Any more ideas before I have to go hacking on the startup script?

--
Scot L. Harris
webid(at)cfl(dot)rr(dot)com

Real computer scientists don't comment their code. The identifiers are
so long they can't afford the disk space.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-06-09 14:06:27 Re: Prevent users from creating tables
Previous Message Doug McNaught 2004-06-09 13:18:04 Re: GRANTing privileges to a plpgsql function doesn't