---------- Forwarded message ----------
From: John McKown <john.archie.mckown@xxxxxxxxx>
Date: Tue, Aug 6, 2013 at 2:23 PM
Subject: Re: Sharing data directories between machines
To: Davide Setti <davide.setti@xxxxxxxxx>
Given that the user seems to want a single copy of the data base, rather than two replicated and synchronized copies, wouldn't that indicate that the clients on all machines need to point to the PostgreSQL server on one machine? Instead of trying to have a the data base server process running on both machines and pointing at the same physical data base. The thought makes me shudder.
If it were me (on Linux or UNIX, I don't know Windows), I'd have a world-readable file somewhere on the "mounted" drive (shared via NFS or CIFS I guess). This file would simply contain lines like:
export PGHOST=ip.or.name.of.machine.running.server
export PGPORT=5432 #stand PostgreSQL TCP/IP port
I would then "source" that file in the shell's start up script on all machines, and also "source" it in the start up scripts for everything else which uses PostgreSQL. This shared file could be modified whenever the PostgreSQL server is moved from one machine to another.
Too bad the PostgreSQL server cannot be in a "Federated" configuration so that it "knows" which databases are controlled by which server and automatically passes the requests around. Or does it and I just can't find it?
http://en.wikipedia.org/wiki/Federated_database_system
IBM's DB2 can do this.
--
From: John McKown <john.archie.mckown@xxxxxxxxx>
Date: Tue, Aug 6, 2013 at 2:23 PM
Subject: Re: Sharing data directories between machines
To: Davide Setti <davide.setti@xxxxxxxxx>
Given that the user seems to want a single copy of the data base, rather than two replicated and synchronized copies, wouldn't that indicate that the clients on all machines need to point to the PostgreSQL server on one machine? Instead of trying to have a the data base server process running on both machines and pointing at the same physical data base. The thought makes me shudder.
If it were me (on Linux or UNIX, I don't know Windows), I'd have a world-readable file somewhere on the "mounted" drive (shared via NFS or CIFS I guess). This file would simply contain lines like:
export PGHOST=ip.or.name.of.machine.running.server
export PGPORT=5432 #stand PostgreSQL TCP/IP port
I would then "source" that file in the shell's start up script on all machines, and also "source" it in the start up scripts for everything else which uses PostgreSQL. This shared file could be modified whenever the PostgreSQL server is moved from one machine to another.
Too bad the PostgreSQL server cannot be in a "Federated" configuration so that it "knows" which databases are controlled by which server and automatically passes the requests around. Or does it and I just can't find it?
http://en.wikipedia.org/wiki/Federated_database_system
IBM's DB2 can do this.
On Tue, Aug 6, 2013 at 2:00 PM, Davide Setti <davide.setti@xxxxxxxxx> wrote:
You can't just make them share the data dir (for example: what about
caches in memory?)
Probably what you want is streaming replication:
http://wiki.postgresql.org/wiki/Streaming_Replication
Regards.
--
On Tue, Aug 6, 2013 at 7:45 PM, JD Wong <jdmswong@xxxxxxxxx> wrote:
> Hi all!
>
> I have two servers, which share a large mounted drive. I would like to
> share postgres databases between them dynamically so that when one makes
> changes, they are immediately available in the other.
>
> I tried moving the data directory over to the mounted drive, and pointing
> both postgresql.confs to that one. I was able to have both access the same
> databases, but they can't share changes. It's like they're running on two
> separate data directories, even though show data_directory reports the same
> path for each.
>
> How can I make them play nicely?
>
> Thanks!
> -JD
Davide Setti
code: http://github.com/vad
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
As of next week, passwords will be entered in Morse code.
Maranatha! <><
John McKown
Maranatha! <><
John McKown
--
As of next week, passwords will be entered in Morse code.
Maranatha! <><
John McKown
Maranatha! <><
John McKown