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
diff --git a/lib/databases/postgresql b/lib/databases/postgresql
index b39984c..6e85d6e 100644
--- a/lib/databases/postgresql
+++ b/lib/databases/postgresql
@@ -10,6 +10,9 @@
set +o xtrace
+MAX_DB_CONNECTIONS=${MAX_DB_CONNECTIONS:-200}
+
+
register_database postgresql
@@ -64,6 +67,8 @@
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