Обсуждение: Mounting a data dir read only

Поиск
Список
Период
Сортировка

Mounting a data dir read only

От
Thorsten Körner
Дата:
Hi all,

I'm wondering if it is possible to connect a postgresql 8.2 server to a
datadir in readonly mode.
We actually want to implement a very large project, using postgresql database,
with pgpool. Our idea is, that one postgres instance, can read/write to the
files, while the other one should only read.
To avoid corruption, we want to set the second instance to read-only mode.

Is there a way to set such parameters, within startup parameters?

with Regards
Thorsten Körner
--
CappuccinoSoft Business Systems
Hamburg

Re: Mounting a data dir read only

От
Martijn van Oosterhout
Дата:
On Tue, Jan 16, 2007 at 04:35:24PM +0100, Thorsten Körner wrote:
> Hi all,
>
> I'm wondering if it is possible to connect a postgresql 8.2 server to a
> datadir in readonly mode.
> We actually want to implement a very large project, using postgresql database,
> with pgpool. Our idea is, that one postgres instance, can read/write to the
> files, while the other one should only read.
> To avoid corruption, we want to set the second instance to read-only mode.

It would avoid corruption on disk, but the second server will not get
the right data. The first server doesn't have any compulsion to write
out data blocks at the end of a transaction, so the second server will
read rubbish.

> Is there a way to set such parameters, within startup parameters?

Nope, do proper replication, either WAL-shipping, or slony, or
something.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

Re: Mounting a data dir read only

От
Thorsten Körner
Дата:
Hi Martijn,

thank you for your help.
Am Dienstag, 16. Januar 2007 16:45 schrieb Martijn van Oosterhout:
> On Tue, Jan 16, 2007 at 04:35:24PM +0100, Thorsten Körner wrote:
> > Hi all,
> >
> > I'm wondering if it is possible to connect a postgresql 8.2 server to a
[...]
>
> > Is there a way to set such parameters, within startup parameters?
>
> Nope, do proper replication, either WAL-shipping, or slony, or
> something.
Hmmm.
WAL-shipping has the problem, that the second server (used as a readonly
slave), will allways be out of synch, as long as he cannot read live from the
WAL-files of the master.
We evaluated Slony some time ago, and came to the conclusion, that it might be
working too slow.
The projects Website is a very high traffic site, with about 500 Pi / sec.  we
are facing performance trouble, when using just one server.
Searches etc. we have implemented using lucene on our backend servers, to keep
the database alive, but since content is very dynamic, there is need to
update lucene indexes very often.
Another problem are some logs, like counters how often users have seen the
pages with contents or userprofiles etc.
All those things, seems to me very difficulty to implement with slony.
Do you have a hint, which way we can go?

With regards
Thorsten Körner

--
CappuccinoSoft Business Systems
Hamburg

Re: Mounting a data dir read only

От
"Chad Wagner"
Дата:
On 1/16/07, Thorsten Körner <t.koerner@cappuccinosoft.de> wrote:
The projects Website is a very high traffic site, with about 500 Pi / sec.  we
are facing performance trouble, when using just one server.
Searches etc. we have implemented using lucene on our backend servers, to keep
the database alive, but since content is very dynamic, there is need to
update lucene indexes very often.
Another problem are some logs, like counters how often users have seen the
pages with contents or userprofiles etc.
All those things, seems to me very difficulty to implement with slony.
Do you have a hint, which way we can go?


Perhaps you need to look at a different solution.  It is apparent you want to reduce I/O and activity on the database, have you looked at distributed caches like memcached ( http://www.danga.com/memcached/) ?

Many popular high volume websites are using memcached (Wikipedia, Slashdot, Live Journal, etc.).

--
Chad
http://www.postgresqlforums.com/