On 01/01/2012 11:51 AM, Jay Levitt wrote:
>
> revoke connect on database rails_dev from public;
> select pg_terminate_backend(procpid) from pg_stat_activity where
> datname='rails_dev';
>
> Still, the app can reconnect. (So can psql.)
>
> So...
>
> 1. How can I prevent (or redirect, or timeout, or anything) new
> connections? I think superuser roles might be exempt from connection
> limits and privileges. I could repeatedly terminate backends until
> I'm able to rename the database, but... ick.
>
> 2. What's a better way to slave to a master database without being a
> read-only slave? In other words, we want to use the production
> database as a starting point each morning, but we'll be creating test
> rows and tables that we wouldn't want to propagate to production. Can
> I do this while the database is live through some existing replication
> tool? The production database is on Ubuntu but the workstations are
> Macs, FWIW.
>
> Jay
More along the lines of what Greg has said. Not clear to me why an
individual dev box needs to be that current data-wise. Of course
stopping and starting your app should be easy, especially for the
developers so maybe that's a better place to start. Then dev can do it
when and how often suits dev best (even cronning shutdown app; reload
db; to happen 3am Sundays)