Обсуждение: Stop connections to a specific database
I'm migrating a pg server (v 8.1.4) this weekend, and I have 2 dbs left on it. One cannot be shut down until tomorrow. The last remaining one, I can migrate today. However, the software that talks to it is somewhat "hinky" and has several places that connect -- there is no overall consolidated connection information. To ensure this is working properly, I want to disable connections to that db on the old server while using the new one for testing, to ensure everything is properly working. Given the fact that the other db must remain live on this old server during that time, I just want to stop connections to this one particular database. Is there a simple, preferred method for doing so?
>>> "Scott Whitney" <swhitney@journyx.com> wrote: > I just want to stop connections to this > one particular database. > > Is there a simple, preferred method for doing so? It sounds like pg_hba.conf might be your ticket: http://www.postgresql.org/docs/8.2/interactive/auth-pg-hba-conf.html -Kevin
You can update your pg_hba.conf file. Change the database column to list the one database.
# DATABASE can be "all", "sameuser", "samerole", a database name, or
Assuming you database is called "mydb and you enter the connecting from IP, it should look like this. # TYPE DATABASE USER CIDR-ADDRESS METHOD
After that, do a pg_ctl reload
From: Scott Whitney <swhitney@journyx.com> |