From 94c654ef37f6a0247a307578f3240f97201a3cba Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Wed, 9 Jul 2014 12:38:36 -0700 Subject: [PATCH] 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 --- lib/databases/postgresql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/databases/postgresql b/lib/databases/postgresql index b39984cf10..6e85d6ec77 100644 --- a/lib/databases/postgresql +++ b/lib/databases/postgresql @@ -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