Database Reference
In-Depth Information
pg_cache_warm() will read the saved cache information and perform a prefetch operation
on each block. This will bring the information back into cache using OS prefetch, if available.
Any non-existent blocks will be ignored.
http://projects.2ndQuadrant.com/pg_cacheutils/
Preventing new connections
In certain emergencies, you may need to lock down the server completely, or just prevent
specific users from accessing the database. It's hard to foresee all the situations in which
you might need to do this, so we present a range of options.
How to do it...
Connections can be prevented in a number of ways as follows:
F Pause/Resume the session pool. See recipe on controlling connection pools
F Stop the server! See the earlier recipe, but it is not recommended.
F Restrict connections to zero for a specific database by setting the connection limit
to zero.
ALTER DATABASE foo_db CONNECTION LIMIT 0;
This will limit normal users from connecting to that database, though it will still allow
superuser connections.
F Restrict connections to zero for a specific user by setting the connection limit to zero.
(See also later recipe.)
ALTER USER foo CONNECTION LIMIT 0;
This will limit normal users from connecting to that database, though it will still
allow connection if the user is a superuser, so luckily you cannot shut yourself
out accidentally.
F Change host-based authentication (HBA) file to refuse all incoming connections, and
then reload the server:
Create a new file named pg_hba_lockdown.conf , and add the following
two lines to the file. This puts rules in place that will completely lock down
the server, including superusers. Please have no doubt that this is a serious
and drastic action.
# TYPE DATABASE
USER CIDR-ADDRESS METHOD
local all
all
reject
0.0.0.0/0
host all
all
reject
 
Search WWH ::




Custom Search