From: Achilleas Mantzios <achill@matrix.gatewaynet.com>
To: pgsql-admin@postgresql.org
Subject: Re: How to start a database in ReadOnly mode?
Date: Thu, 7 Jul 2011 10:49:53 +0300
Message-ID: <201107071049.53956.achill@matrix.gatewaynet.com> (raw)
In-Reply-To: <CA+U5nMJCYodsfB-cXcz4TAcvKNfRmfpGewqrLhsaZLG_6Va5=w@mail.gmail.com>
References: <CA+wekE8nPz9hP3k5pP26W561n2QZRb=6=oh5A78G9pAf1hy06g@mail.gmail.com>
<CA+U5nMJCYodsfB-cXcz4TAcvKNfRmfpGewqrLhsaZLG_6Va5=w@mail.gmail.com>
Hello
ΣÏÎ¹Ï Thursday 07 July 2011 10:26:19 ο/η Simon Riggs ÎγÏαÏε:
> On Thu, Jul 7, 2011 at 8:08 AM, Paul Schluck <pschluck@gmail.com> wrote:
>
> > Is it possible to start a postgres cluster or 1 postgres database in
> > readonly mode? And - if yes - how can this be done?
>
> There is no formal, explicit command to do that. Just avoid doing
> writes, either in the application or by removing privileges.
>
This is how we did it, when there was a special requirement to do so for a special occasion,
make a new user (lets call it "readonly") and have the app authenticating with this user.
Manage his privileges with smth like: (for every table)
CREATE user readonly;
REVOKE ALL ON DATABASE <your database> FROM readonly;
(for each table) GRANT SELECT ON <your table> TO readonly;
For this last one you might need to write a script, producing the sql commands.
> --
> Simon Riggs http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services
>
--
Achilleas Mantzios
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: achill@matrix.gatewaynet.com
Subject: Re: How to start a database in ReadOnly mode?
In-Reply-To: <201107071049.53956.achill@matrix.gatewaynet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox