473,378 Members | 1,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Multiple databases on seperate drives/file systems?

I am running postgresql 7.2.4 on a Redhat 8.0 system.

I have been looking for a way to setup another database besides the
initial one setup under /var/lib/pgsql/data on a different file system.

I have found a few references to configuring a separate PGDATA2
environment variable and running the initlocation PGDATA2 followed by
createdb -D PGDATA2 testdb.

The directories are created.

However when executing those steps I get the following error:

-bash-2.05b$ createdb testdb2 -D 'PGDATA2'
ERROR: Postmaster environment variable 'PGDATA2' not set
createdb: database creation failed
I have verified that PGDATA2 environment variable is set.
-bash-2.05b$ echo $PGDATA2
/vhost/database/data

I have restarted postmaster with the assumption that it needed the
environment variables setup in the postgres users shell.

My guess is that PGDATA2 is not set for some reason for the postmaster
service. I looked in the init.d/postgresql startup script and can see
where PGDATA is checked for and setup. I take it that the environment
variables from postgres user are not used?

Is there a way to set databases in different file systems using a single
postmaster service?

--
Scot L. Harris
we***@cfl.rr.com

.... mindreading equipment is currently classified CIA property at
best (hello echelon!)

- Alan Cox on linux-kernel
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #1
17 2103
Scot L. Harris wrote:
I am running postgresql 7.2.4 on a Redhat 8.0 system.

I have been looking for a way to setup another database besides the
initial one setup under /var/lib/pgsql/data on a different file system.

I have found a few references to configuring a separate PGDATA2
environment variable and running the initlocation PGDATA2 followed by
createdb -D PGDATA2 testdb.

The directories are created.

However when executing those steps I get the following error:

-bash-2.05b$ createdb testdb2 -D 'PGDATA2'
ERROR: Postmaster environment variable 'PGDATA2' not set
createdb: database creation failed


1. Have you tried not quoting PGDATA2 (I seem to remember it being picky
about such things).

2. Are you aware you can use a full path (/vhost/database/data) instead
of PGDATA2? This requires setting a compile-time flag though.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #2
Scot L. Harris wrote:
I am running postgresql 7.2.4 on a Redhat 8.0 system.

I have been looking for a way to setup another database besides the
initial one setup under /var/lib/pgsql/data on a different file system.

I have found a few references to configuring a separate PGDATA2
environment variable and running the initlocation PGDATA2 followed by
createdb -D PGDATA2 testdb.

The directories are created.

However when executing those steps I get the following error:

-bash-2.05b$ createdb testdb2 -D 'PGDATA2'
ERROR: Postmaster environment variable 'PGDATA2' not set
createdb: database creation failed


1. Have you tried not quoting PGDATA2 (I seem to remember it being picky
about such things).

2. Are you aware you can use a full path (/vhost/database/data) instead
of PGDATA2? This requires setting a compile-time flag though.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #3
On Tue, 2004-06-08 at 14:34, Richard Huxton wrote:

1. Have you tried not quoting PGDATA2 (I seem to remember it being picky
about such things).

2. Are you aware you can use a full path (/vhost/database/data) instead
of PGDATA2? This requires setting a compile-time flag though.


Thanks for responding.

Yes I have tried it without quoting the PGDATA2. Same result.

I have also tried the full path but the flag is apparently not set to
allow that.

Besides the error I am getting it appears to me that postmaster would
not be able to find this new location for the new database. From
looking at the startup script in init.d it looks like it has PGDATA hard
coded and I did not see any place in the other config files to specify
additional database locations.

It seems like I am missing a piece of the puzzle.

--
Scot L. Harris
we***@cfl.rr.com

If you keep anything long enough, you can throw it away.
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #4
On Tue, 2004-06-08 at 14:34, Richard Huxton wrote:

1. Have you tried not quoting PGDATA2 (I seem to remember it being picky
about such things).

2. Are you aware you can use a full path (/vhost/database/data) instead
of PGDATA2? This requires setting a compile-time flag though.


Thanks for responding.

Yes I have tried it without quoting the PGDATA2. Same result.

I have also tried the full path but the flag is apparently not set to
allow that.

Besides the error I am getting it appears to me that postmaster would
not be able to find this new location for the new database. From
looking at the startup script in init.d it looks like it has PGDATA hard
coded and I did not see any place in the other config files to specify
additional database locations.

It seems like I am missing a piece of the puzzle.

--
Scot L. Harris
we***@cfl.rr.com

If you keep anything long enough, you can throw it away.
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #5
"Scot L. Harris" <we***@cfl.rr.com> wrote:
[snip]
Yes I have tried it without quoting the PGDATA2. Same result.

I have also tried the full path but the flag is apparently not set to
allow that.

Besides the error I am getting it appears to me that postmaster would
not be able to find this new location for the new database. From
looking at the startup script in init.d it looks like it has PGDATA hard
coded and I did not see any place in the other config files to specify
additional database locations.

It seems like I am missing a piece of the puzzle.


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

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #6
"Scot L. Harris" <we***@cfl.rr.com> wrote:
[snip]
Yes I have tried it without quoting the PGDATA2. Same result.

I have also tried the full path but the flag is apparently not set to
allow that.

Besides the error I am getting it appears to me that postmaster would
not be able to find this new location for the new database. From
looking at the startup script in init.d it looks like it has PGDATA hard
coded and I did not see any place in the other config files to specify
additional database locations.

It seems like I am missing a piece of the puzzle.


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

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #7
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
we***@cfl.rr.com

Real computer scientists don't comment their code. The identifiers are
so long they can't afford the disk space.
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #8
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
we***@cfl.rr.com

Real computer scientists don't comment their code. The identifiers are
so long they can't afford the disk space.
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #9
"Scot L. Harris" <we***@cfl.rr.com> writes:
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.


Depends which startup script you are using. I know that up till
recently the Red Hat init script did

su -l postgres -s /bin/sh -c "pg_ctl start ..."

and because it forced /bin/sh, anything you might have put in say
~postgres/.bash_profile wouldn't get read. You can just take out
that -s switch though.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #10
"Scot L. Harris" <we***@cfl.rr.com> writes:
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.


Depends which startup script you are using. I know that up till
recently the Red Hat init script did

su -l postgres -s /bin/sh -c "pg_ctl start ..."

and because it forced /bin/sh, anything you might have put in say
~postgres/.bash_profile wouldn't get read. You can just take out
that -s switch though.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #11
"Scot L. Harris" <we***@cfl.rr.com> writes:
The startup script in /etc/init.d does have the su line as you describe
above. On RH8 it appears that /bin/sh is linked to /bin/bash. So does
the shell being executed not look at the .bash_profile since it was
invoked as /bin/sh?
Not sure; you could probably find out with some study of its man page.
Seems likely though, else you'd not be here complaining ;-)
Or can I just put the PGDATA2 environment variable in a .profile file?


That would be an alternative answer. Be aware though that future RH
releases will remove the -s switch, so eventually you'll want to do
it that way.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #12
"Scot L. Harris" <we***@cfl.rr.com> writes:
The startup script in /etc/init.d does have the su line as you describe
above. On RH8 it appears that /bin/sh is linked to /bin/bash. So does
the shell being executed not look at the .bash_profile since it was
invoked as /bin/sh?
Not sure; you could probably find out with some study of its man page.
Seems likely though, else you'd not be here complaining ;-)
Or can I just put the PGDATA2 environment variable in a .profile file?


That would be an alternative answer. Be aware though that future RH
releases will remove the -s switch, so eventually you'll want to do
it that way.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #13
On Wed, 2004-06-09 at 10:20, Tom Lane wrote:
Depends which startup script you are using. I know that up till
recently the Red Hat init script did

su -l postgres -s /bin/sh -c "pg_ctl start ..."

and because it forced /bin/sh, anything you might have put in say
~postgres/.bash_profile wouldn't get read. You can just take out
that -s switch though.

regards, tom lane


Thanks for the pointer.

The startup script in /etc/init.d does have the su line as you describe
above. On RH8 it appears that /bin/sh is linked to /bin/bash. So does
the shell being executed not look at the .bash_profile since it was
invoked as /bin/sh?

Or can I just put the PGDATA2 environment variable in a .profile file?
--
Scot L. Harris <we***@cfl.rr.com>
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #14
On Wed, 2004-06-09 at 10:20, Tom Lane wrote:
Depends which startup script you are using. I know that up till
recently the Red Hat init script did

su -l postgres -s /bin/sh -c "pg_ctl start ..."

and because it forced /bin/sh, anything you might have put in say
~postgres/.bash_profile wouldn't get read. You can just take out
that -s switch though.

regards, tom lane


Thanks for the pointer.

The startup script in /etc/init.d does have the su line as you describe
above. On RH8 it appears that /bin/sh is linked to /bin/bash. So does
the shell being executed not look at the .bash_profile since it was
invoked as /bin/sh?

Or can I just put the PGDATA2 environment variable in a .profile file?
--
Scot L. Harris <we***@cfl.rr.com>
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #15
"Scot L. Harris" <we***@cfl.rr.com> wrote:
[snip]
Any more ideas before I have to go hacking on the startup script?


Not a clue, Scot. Sorry.

Jim

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #16
"Scot L. Harris" <we***@cfl.rr.com> wrote:
[snip]
Any more ideas before I have to go hacking on the startup script?


Not a clue, Scot. Sorry.

Jim

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #17
In article <20**************@sss.pgh.pa.us>,
Tom Lane <tg*@sss.pgh.pa.us> wrote:
Depends which startup script you are using. I know that up till
recently the Red Hat init script did

su -l postgres -s /bin/sh -c "pg_ctl start ..."

and because it forced /bin/sh, anything you might have put in say
~postgres/.bash_profile wouldn't get read. You can just take out
that -s switch though.

Actually, I think it's that bash is broken (well, it is if you ask me, but
not if you ask Chet Ramey). At least it was circa 2001 when I last looked
at this issue.

I had to ask -l to get my init scripts to work (that is, to source .profile
when started with su - ).

mrc
--
Mike Castle da*****@ix.netcom.com www.netcom.com/~dalgoda/
We are all of us living in the shadow of Manhattan. -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: sean peters | last post by:
Hi all, i've been weighing the pros and cons of running multiple concurrent mysqld's on one server, to have better control over what databases are on what physical disks. System: 4 processor sun...
11
by: Mike | last post by:
Looking to find any information on how to properly configure multiple instances of DB2. This is on Win2k db2 ver 7.2. I am basically looking for information on how the multiple instance settings...
19
by: Steve Jorgensen | last post by:
I've run across this issue several times of late, and I've never come up with a satisfactory answer to the best way to handle this schema issue. You have a large section of schema in which a...
6
by: Cable | last post by:
Hello, I am hoping that someone can answer a question or two regarding file access. I have created an app that reads an image from a file then displays it (using OpenGL). It works well using...
0
by: Scot L. Harris | last post by:
I am running postgresql 7.2.4 on a Redhat 8.0 system. I have been looking for a way to setup another database besides the initial one setup under /var/lib/pgsql/data on a different file system. ...
7
by: BWill | last post by:
Hi, I'm writing a file browser, but I'm not sure how I could go about detecting the drives available on windows and linux systems (preferably using the standard modules if possible). I guess I...
3
by: LurfysMa | last post by:
I would like to hear opinions on the tradeoffs of putting the tables, forms, and queries for several related datasets in separate databases vs one combined database. I am working on an...
1
by: Query Builder | last post by:
I have one of our production Accounting Databases starting from 2 GB now grown into a 20 GB Database over the period of a few years... I have been getting timeouts when transactions are trying to...
1
by: Bob Alston | last post by:
Looking for design approach ideas for collecting data from multiple remote, standalone databases. I have built one of these in Access. Another I am told was built in Access. some others the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.