Fwd: Sharing data directories between machines

From: John McKown <john(dot)archie(dot)mckown(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Fwd: Sharing data directories between machines
Date: 2013-08-06 19:24:50
Message-ID: CAAJSdjixWNx7ae=8V461ixVXREUDfVhoebXAQCp=72QGVnAdVQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

OOPS - send to Davide directly. Sorry about that. Didn't look at the To:
I'm new here today.

---------- Forwarded message ----------
From: John McKown <john(dot)archie(dot)mckown(at)gmail(dot)com>
Date: Tue, Aug 6, 2013 at 2:23 PM
Subject: Re: [GENERAL] Sharing data directories between machines
To: Davide Setti <davide(dot)setti(at)gmail(dot)com>

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(dot)setti(at)gmail(dot)com> 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(at)gmail(dot)com> 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(at)postgresql(dot)org)
> 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

--
As of next week, passwords will be entered in Morse code.

Maranatha! <><
John McKown

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John McKown 2013-08-06 19:28:28 Re: Sharing data directories between machines
Previous Message John R Pierce 2013-08-06 19:12:33 Re: Sharing data directories between machines