Thread: question about installation

question about installation

From
martin soethof
Date:
Hello
I have the following situation.
I used a postgres installer that can choose seperate paths for the normal postgres and the data folder.
I used this because i wanted to share a database on an external hard drive between 2 computers.
I installed it on PC #1, the normal postgres files are on my D drive, the data folder and its components are on the portable F drive..
Tomorrow i will be sitting behind PC #2, how should i install it..
If i do install it the same way, won't that overwrite the existing data folder on the F drive and thus result in loss of data or a corrupt database.
Or will postgres-installation simply notice i already have a data folder there and ask if i want to share this?
Could you please guide me through the path of how to install postgresql on the 2nd computer, so that both computers share their data in the same folder..
I used postgresql 8.4
Regards,
Martin

Re: question about installation

From
Raymond O'Donnell
Date:
On 11/07/2012 13:58, martin soethof wrote:
> Hello
> I have the following situation.
> I used a postgres installer that can choose seperate paths for the
> normal postgres and the data folder.
> I used this because i wanted to share a database on an external hard
> drive between 2 computers.
> I installed it on PC #1, the normal postgres files are on my D drive,
> the data folder and its components are on the portable F drive..
> Tomorrow i will be sitting behind PC #2, how should i install it..
> If i do install it the same way, won't that overwrite the existing data
> folder on the F drive and thus result in loss of data or a corrupt database.
> Or will postgres-installation simply notice i already have a data folder
> there and ask if i want to share this?
> Could you please guide me through the path of how to install postgresql
> on the 2nd computer, so that both computers share their data in the same
> folder..

What platform are you on? From the above it sounds like Windows.

You might be able to do it as follows:

- Install Postgres on the second computer using a local path for the
data directory.
- Stop the database server.
- Restart it with the -D option pointing at the data directory on the
external drive.

Make sure that you use the same major version on both computers - e.g.
9.1, 9.0, etc.

I think this will work; though it's not something I personally would
do... it sounds a bit fragile.

Ray.


--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie



Re: question about installation

From
Craig Ringer
Date:
On 07/11/2012 08:58 PM, martin soethof wrote:
Hello
I have the following situation.
I used a postgres installer that can choose seperate paths for the normal postgres and the data folder.
I used this because i wanted to share a database on an external hard drive between 2 computers.

It'll work so long as both computers are running the same PostgreSQL major version (same x.y version) built with the same options and the same bitness (32- or 64-bit). I'd use replication instead if possible, but it should work so long as the HDD isn't connected to and mounted by both computers at the same time. If you're using USB that's impossible and you'll be fine, but it's something to watch out for using FireWire or SCSI/SAS.

The main thing is that you won't be able to use it as an auto-starting Windows service. You must either start and stop the service manually when the disk is added/removed, or use pg_ctl to start/stop the DB manually.

You will also have to watch out for permissions.

Personally, I'd use pg_ctl to start/stop the DB manually. See the PostgreSQL documentation. That way you don't have to wrangle the Windows service at all.

Tomorrow i will be sitting behind PC #2, how should i install it..
Check the command lines for the EnterpriseDB installer. I'd be surprised if it didn't have a binaries-only option that allowed you to skip database creation and creation of a Windows service entry, so you can then just use pg_ctl to start/stop the DB.

--
Craig Ringer

Re: question about installation

From
Sachin Srivastava
Date:


On Wed, Jul 11, 2012 at 6:28 PM, martin soethof <martinsoethof@hotmail.com> wrote:
Hello
I have the following situation.
I used a postgres installer that can choose seperate paths for the normal postgres and the data folder.
I used this because i wanted to share a database on an external hard drive between 2 computers.
I installed it on PC #1, the normal postgres files are on my D drive, the data folder and its components are on the portable F drive..
Tomorrow i will be sitting behind PC #2, how should i install it..
If i do install it the same way, won't that overwrite the existing data folder on the F drive and thus result in loss of data or a corrupt database.
Or will postgres-installation simply notice i already have a data folder there and ask if i want to share this?
Could you please guide me through the path of how to install postgresql on the 2nd computer, so that both computers share their data in the same folder..
I used postgresql 8.4

The installer will not over-write any settings in your data folder and continue as usual. Its an option where you can give a pre-existing data folder to a new installation.
 
Regards,
Martin



--
Regards,
Sachin Srivastava
EnterpriseDB, India