Set postgresql max_connections=200

Now that we have multiple workers running by default
in various projects (nova/cinder/glance/trove), the
postgresql job is failing intermittently with connection
failures to the database.

The default max_connections for postgresql is 100 so here
we double that.

Note that the default max_connections for mysql used to
be 100 but is now 151, so this change brings the postgresql
configuration more in line with mysql.

Change-Id: I2fcae8184a82e303103795a7bf57c723e27190c9
Closes-Bug: #1338841
This commit is contained in:
Matt Riedemann 2014-07-09 12:38:36 -07:00
parent 2efb9781c4
commit 94c654ef37

View File

@ -10,6 +10,9 @@ PG_XTRACE=$(set +o | grep xtrace)
set +o xtrace
MAX_DB_CONNECTIONS=${MAX_DB_CONNECTIONS:-200}
register_database postgresql
@ -64,6 +67,8 @@ function configure_database_postgresql {
fi
# Listen on all addresses
sudo sed -i "/listen_addresses/s/.*/listen_addresses = '*'/" $PG_CONF
# Set max_connections
sudo sed -i "/max_connections/s/.*/max_connections = $MAX_DB_CONNECTIONS/" $PG_CONF
# Do password auth from all IPv4 clients
sudo sed -i "/^host/s/all\s\+127.0.0.1\/32\s\+ident/$DATABASE_USER\t0.0.0.0\/0\tpassword/" $PG_HBA
# Do password auth for all IPv6 clients