473,670 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Poatgresql database on more than one disk

Hi All,

I am a newcommer to Postgresql, currently I am looking at moving
a Pick based application across to PostgreSQL.

I am using RH Linux and Postgresql 7.3.6

The test system I am using has a 2 channel raid card with a disk pack
connected to each channel. The OS and Postgresql sits on its own internal
disk.

I would like to be able to use one disk pack for development and the
other for end user testing / verification (the tape drive can only backup
one disk pack completely, not both)

I have spent a fair amount of time researching how I can run two
databases, one on each disk pack but have not been able to find a
solution.

Is it possible to configure Postgresql to have seperate databases
on seperate disks ?

TIA

Barry
Nov 23 '05 #1
7 1600
Barry wrote:
Hi All,

I am a newcommer to Postgresql, currently I am looking at moving
a Pick based application across to PostgreSQL.

I am using RH Linux and Postgresql 7.3.6

The test system I am using has a 2 channel raid card with a disk pack
connected to each channel. The OS and Postgresql sits on its own internal
disk.

I would like to be able to use one disk pack for development and the
other for end user testing / verification (the tape drive can only backup
one disk pack completely, not both)

I have spent a fair amount of time researching how I can run two
databases, one on each disk pack but have not been able to find a
solution.

Is it possible to configure Postgresql to have seperate databases
on seperate disks ?


Not easily as will be with the Table Space feature that most probably
will be present on 7.5

With 7.3.6 what you can do is move your db and create a link in the
original place:

-bash-2.05b$ oid2name
All databases:
---------------------------------
17142 = kalman
19185 = photodb
27895 = empdb
1 = template1
17141 = template0
5776262 = logs
-bash-2.05b$ pwd
/var/lib/pgsql/data/base

-bash-2.05b$ ll
total 32
drwx------ 2 postgres postgres 4096 Feb 8 15:18 1
drwx------ 2 postgres postgres 4096 Feb 8 03:56 17141
drwx------ 2 postgres postgres 4096 May 25 19:37 17142
drwx------ 2 postgres postgres 8192 Feb 8 15:58 19185
drwx------ 3 postgres postgres 8192 May 16 02:46 27895
drwx------ 2 postgres postgres 4096 May 18 00:06 5776262

in my case if I want the database kalman to another disk what I have to
do is: stop the engine, move the directory /var/lib/pgsql/data/base/17142
to the new location and create the link.
With the same mechanism you can also place different tables in different
disks.

I hope this help you.
Regards
Gaetano Mendola






Nov 23 '05 #2
Gaetano Mendola <me*****@bigfoo t.com> wrote in message news:<40******* *******@bigfoot .com>...
Barry wrote:
Hi All,

I am a newcommer to Postgresql, currently I am looking at moving
a Pick based application across to PostgreSQL.

I am using RH Linux and Postgresql 7.3.6

The test system I am using has a 2 channel raid card with a disk pack
connected to each channel. The OS and Postgresql sits on its own internal
disk.

I would like to be able to use one disk pack for development and the
other for end user testing / verification (the tape drive can only backup
one disk pack completely, not both)

I have spent a fair amount of time researching how I can run two
databases, one on each disk pack but have not been able to find a
solution.

Is it possible to configure Postgresql to have seperate databases
on seperate disks ?


Not easily as will be with the Table Space feature that most probably
will be present on 7.5

With 7.3.6 what you can do is move your db and create a link in the
original place:

-bash-2.05b$ oid2name
All databases:
---------------------------------
17142 = kalman
19185 = photodb
27895 = empdb
1 = template1
17141 = template0
5776262 = logs
-bash-2.05b$ pwd
/var/lib/pgsql/data/base

-bash-2.05b$ ll
total 32
drwx------ 2 postgres postgres 4096 Feb 8 15:18 1
drwx------ 2 postgres postgres 4096 Feb 8 03:56 17141
drwx------ 2 postgres postgres 4096 May 25 19:37 17142
drwx------ 2 postgres postgres 8192 Feb 8 15:58 19185
drwx------ 3 postgres postgres 8192 May 16 02:46 27895
drwx------ 2 postgres postgres 4096 May 18 00:06 5776262

in my case if I want the database kalman to another disk what I have to
do is: stop the engine, move the directory /var/lib/pgsql/data/base/17142
to the new location and create the link.
With the same mechanism you can also place different tables in different
disks.

I hope this help you.
Regards
Gaetano Mendola


Works like a treat, thank you for your time.

Barry
Nov 23 '05 #3
On Tue, 2004-05-25 at 18:33, Barry wrote:
I would like to be able to use one disk pack for development and the
other for end user testing / verification (the tape drive can only backup
one disk pack completely, not both)

Is it possible to configure Postgresql to have seperate databases
on seperate disks ?


One solution is to run two postmasters (two services). Each would use a
different value for the PGDATA environment variable.

The pro to this is that there would be a greater degree of separation
between your development environment and test environment. You could
start and stop the development environment service separately from the
test environment, for instance.

The con is that only one postmaster can bind to port 5432 at a time.
You would have to set up one of the postmasters to use a different
port... perhaps 5433?

Since you are using RedHat, take a look at /etc/init.d/postgresql. You
should see where the the PGDATA environment variable is set in the top
of the script. PGPORT is also set, which is the port number that the
postmaster will use. (I am using Fedora Core 1 and Fedora Core 2. I
assume that RedHat's scripts are very similar to this, if not
identical).

If I were doing it, I'd probably copy /etc/init.d/postgresql to
/etc/init.d/postgresql_dev and /etc/init.d/postgresql_test . I'd modify
/etc/init.d/postgresql_test so that it controls my test environment and
/etc/init.d/postgresql_dev so that it controls my development
environment. I'd use chkconfig to disable the service postgresql and
enable the services postgresql_dev and postgresql_test . (That way, if
upgrades clobber /etc/init.d/postgresql, you're not left in a bind).

You can contact me off-list if you need more help with this solution.

--
Philip A. Chapman

Application Development:
Java, Visual Basic (MCP), PostgreSQL, MySQL, MSSQL
Linux, Windows 9x, Windows NT, Windows 2000, Windows XP

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBAu4QdAdp ynRSGw3URAkqCAJ 9jILOlk1him0uor MLxqpkQveSxvQCd Hm+b
K1jH7mZnSzl+QQi ekeAS6Pg=
=Awbq
-----END PGP SIGNATURE-----

Nov 23 '05 #4
On Wed, 2004-05-26 at 07:24, Barry wrote:
Gaetano Mendola <me*****@bigfoo t.com> wrote in message news:<40******* *******@bigfoot .com>...
Barry wrote: ....
The test system I am using has a 2 channel raid card with a disk pack
connected to each channel. The OS and Postgresql sits on its own internal
disk.

I would like to be able to use one disk pack for development and the
other for end user testing / verification (the tape drive can only backup
one disk pack completely, not both)

I have spent a fair amount of time researching how I can run two
databases, one on each disk pack but have not been able to find a
solution.

Is it possible to configure Postgresql to have seperate databases
on seperate disks ?
Not easily as will be with the Table Space feature that most probably
will be present on 7.5

With 7.3.6 what you can do is move your db and create a link in the
original place:

.... Works like a treat, thank you for your time.


You need to be aware that certain files in the top level of ${PGDATA}
(pg_clog/* and pg_xlog) are essential for reading your data and apply
globally to all databases. If pg_clog is destroyed, the database is
effectively destroyed too. It's not clear that your arrangements will
get that copied to tape.

You may also not be aware that simply dumping the files to tape is not
necessarily going to give you a consistent or recoverable database
unless you stop the postmaster first. pg_dumpall (or pg_dump for single
databases) can be used to dump transaction-consistent backups that
include every transaction completed at the time it begins to run; it is
also likely to take less space on tape than a dump of the raw database
files. If you recover a set of files that have been copied to tape by
an external utility while the database is active, you may find that some
transactions at least are unrecoverable and at the worst tables may be
corrupted. See the chapter on backups in the manual.

--
Oliver Elphick ol**@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA
=============== =============== ==========
"How precious also are thy thoughts unto me, O God! how
great is the sum of them! If I should count them, they
are more in number than the sand; when I awake, I am
still with thee." Psalms 139: 17,18
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 23 '05 #5
Could you just use the initlocation tool and specify the 'location'
parameter when creating the database?


-----Original Message-----
From: pg************* ****@postgresql .org
[mailto:pg****** ***********@pos tgresql.org] On Behalf Of Gaetano Mendola
Sent: Tuesday, May 25, 2004 8:22 PM
To: Barry; pg***********@p ostgresql.org
Subject: Re: [GENERAL] Poatgresql database on more than one disk

Barry wrote:
Hi All,

I am a newcommer to Postgresql, currently I am looking at moving
a Pick based application across to PostgreSQL.

I am using RH Linux and Postgresql 7.3.6

The test system I am using has a 2 channel raid card with a disk pack
connected to each channel. The OS and Postgresql sits on its own internal
disk.

I would like to be able to use one disk pack for development and the
other for end user testing / verification (the tape drive can only backup
one disk pack completely, not both)

I have spent a fair amount of time researching how I can run two
databases, one on each disk pack but have not been able to find a
solution.

Is it possible to configure Postgresql to have seperate databases
on seperate disks ?


Not easily as will be with the Table Space feature that most probably
will be present on 7.5

With 7.3.6 what you can do is move your db and create a link in the
original place:

-bash-2.05b$ oid2name
All databases:
---------------------------------
17142 = kalman
19185 = photodb
27895 = empdb
1 = template1
17141 = template0
5776262 = logs
-bash-2.05b$ pwd
/var/lib/pgsql/data/base

-bash-2.05b$ ll
total 32
drwx------ 2 postgres postgres 4096 Feb 8 15:18 1
drwx------ 2 postgres postgres 4096 Feb 8 03:56 17141
drwx------ 2 postgres postgres 4096 May 25 19:37 17142
drwx------ 2 postgres postgres 8192 Feb 8 15:58 19185
drwx------ 3 postgres postgres 8192 May 16 02:46 27895
drwx------ 2 postgres postgres 4096 May 18 00:06 5776262

in my case if I want the database kalman to another disk what I have to
do is: stop the engine, move the directory /var/lib/pgsql/data/base/17142
to the new location and create the link.
With the same mechanism you can also place different tables in different
disks.

I hope this help you.
Regards
Gaetano Mendola







---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


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

Nov 23 '05 #6
--On Monday, May 31, 2004 2:14 PM -0500 "Philip A. Chapman"
<pc******@pcsw. us> wrote:
On Tue, 2004-05-25 at 18:33, Barry wrote:

Is it possible to configure Postgresql to have seperate databases
on seperate disks ?


One solution is to run two postmasters (two services). Each would use a
different value for the PGDATA environment variable.


Pardon me for being dense, but I don't see how, with this approach, you
maintain transaction integrity between the two databases. Suppose you need
a transaction involving tables from both databases. Can you explain how you
achieve this?
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #7
> Pardon me for being dense, but I don't see how, with this approach, you
maintain transaction integrity between the two databases. Suppose you need
a transaction involving tables from both databases. Can you explain how you
achieve this?


You can't anyways (server side) no matter where the two
separate databases reside unless you use contrib/dblink in
which case it again matters not where the databases reside.

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #8

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

Similar topics

4
3672
by: cover | last post by:
The question is, we have two options to store images, either in a Database (MySQL, Postgres, ...) like blob data, or in the hard disk the file and the path in database. Which option is better? When? Why? Thanks you for your answers.
19
21210
by: dchow | last post by:
Our database size is currently 4G and is incrementing at a rate of 45M/day. What is the max size of a SQL database? And what is the size beyond which the server performance will start to go down?
5
8668
by: Pongthai | last post by:
Hi, I got a backup file from my friend which needs 11 GB to hold the transaction log. I tried to restore this database but an error message: "MODIFY FILE encountered operating system error 112(error not found) while attempting to expand the physical file." appeared. The free space is more than enough. I then tried another way
8
4876
by: 2centbob | last post by:
Has anyone had an issue with SQL Server not being able to expand against a RAID 5 file system? My current configuration is that the server is started and stopped using the local system account. I have only one database (besides the master, model,etc)on the server. What has happend to me several times is that the primary database in question try's to expand the main datafile for the database (.mdf). I setup the database to not expand...
10
3155
by: Stephen | last post by:
Hello, Is it normal for plain VACUUM on large table to degrade performance by over 9 times? My database becomes unusable when VACUUM runs. From reading newsgroups, I thought VACUUM should only slow down by 10% to 15%. Other MVCC databases like MySQL InnoDB can even VACUUM discretely (runs internally). Is it my Linux system or is it PostgreSQL? The database is mostly read-only. There are 133,000 rows and each row is about 2.5kB in size...
5
4696
by: Mike Turco | last post by:
What is the difference between creating relationships in the front-end vs. the back-end database? I was trying to create a relationship in a database front-end and noticed that I could not check the referential integrity box. What gives? Continuing on with that line of thinking, I understand what do the relationships do for you in a database, but what do they do physically to the tables? Thanks,
12
3756
by: Chris Springer | last post by:
I'd like to get some feedback on the issue of storing data out to disk and where to store it. I've never been in a production environment in programming so you'll have to bear with me... My question is about storing data in a database. Yes I understand that you can link to a database in your program and read and write to the database etc etc. Well, that's all find and dandy but what if the person you're writing the application for...
2
3440
by: James | last post by:
CASE 1: The following sentences were copied from the book "Administration Guide Performance". "If more pages have been written to disk, recovery of the database is faster after a system crash because the database manager can rebuild more of the buffer pool from disk instead of having to replay transactions from the database log files." My question is:
10
6150
by: gary0gilbert | last post by:
An unusual spin to this recurring disk or network error in a Terminal Server environment. Access 2000, Terminal Server 2000, file server is windows 2000. All users have a separate copy of the front end db, everyone accesses the back-end db via a network share. To preface, non Terminal Server users (4 or 5 in office) never have this problem. There are two Terminal Servers running win 2000, both basically identical. This error affects...
1
8593
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8663
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7423
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6218
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5687
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4396
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2804
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.