473,408 Members | 2,813 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,408 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 2107
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.