
Update the database timeouts to higher values to prevent the services from disconnecting too frequently: - set the Galera HAProxy timeout to 90 minutes (with parameter) - set the database_idle_timeout to 5000 seconds (83 minutes) to allow the services to drop the connection before HAProxy does - add `on-marked-down shutdown-sessions` to Galera HAProxy balancer members to allow shutting down sessions when a Galera host goes down. Change-Id: I62c70c906a009df43acaf172eb27729d5d257b0f
93 lines
3.1 KiB
Puppet
93 lines
3.1 KiB
Puppet
#
|
|
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
#
|
|
# == Class: cloud::database::dbaas
|
|
#
|
|
# Common class to install OpenStack Database as a Service (Trove)
|
|
#
|
|
# === Parameters:
|
|
#
|
|
# [*trove_db_host*]
|
|
# (optional) Hostname or IP address to connect to trove database
|
|
# Defaults to '127.0.0.1'
|
|
#
|
|
# [*trove_db_user*]
|
|
# (optional) Username to connect to trove database
|
|
# Defaults to 'trove'
|
|
#
|
|
# [*trove_db_password*]
|
|
# (optional) Password to connect to trove database
|
|
# Defaults to 'trovepassword'
|
|
#
|
|
# [*trove_db_idle_timeout*]
|
|
# (optional) Timeout before idle SQL connections are reaped.
|
|
# Defaults to 5000
|
|
#
|
|
# [*rabbit_hosts*]
|
|
# (optional) List of RabbitMQ servers. Should be an array.
|
|
# Defaults to ['127.0.0.1:5672']
|
|
#
|
|
# [*rabbit_password*]
|
|
# (optional) Password to connect to nova queues.
|
|
# Defaults to 'rabbitpassword'
|
|
#
|
|
# [*nova_admin_username*]
|
|
# (optional) Trove username used to connect to nova.
|
|
# Defaults to 'trove'
|
|
#
|
|
# [*nova_admin_password*]
|
|
# (optional) Trove password used to connect to nova.
|
|
# Defaults to 'trovepassword'
|
|
#
|
|
# [*nova_admin_tenant_name*]
|
|
# (optional) Trove tenant name used to connect to nova.
|
|
# Defaults to 'services'
|
|
#
|
|
class cloud::database::dbaas(
|
|
$trove_db_host = '127.0.0.1',
|
|
$trove_db_user = 'trove',
|
|
$trove_db_password = 'trovepassword',
|
|
$trove_db_idle_timeout = 5000,
|
|
$rabbit_hosts = ['127.0.0.1:5672'],
|
|
$rabbit_password = 'rabbitpassword',
|
|
$nova_admin_username = 'trove',
|
|
$nova_admin_tenant_name = 'services',
|
|
$nova_admin_password = 'trovepassword',
|
|
) {
|
|
|
|
$encoded_user = uriescape($trove_db_user)
|
|
$encoded_password = uriescape($trove_db_password)
|
|
|
|
class { 'trove':
|
|
database_connection => "mysql://${encoded_user}:${encoded_password}@${trove_db_host}/trove?charset=utf8",
|
|
database_idle_timeout => $trove_db_idle_timeout,
|
|
mysql_module => '2.2',
|
|
rabbit_hosts => $rabbit_hosts,
|
|
rabbit_password => $rabbit_password,
|
|
rabbit_userid => 'trove',
|
|
nova_proxy_admin_pass => $nova_admin_password,
|
|
nova_proxy_admin_user => $nova_admin_username,
|
|
nova_proxy_admin_tenant_name => $nova_admin_tenant_name
|
|
}
|
|
|
|
exec {'trove_db_sync':
|
|
command => 'trove-manage db_sync',
|
|
user => 'trove',
|
|
path => '/usr/bin',
|
|
unless => "/usr/bin/mysql trove -h ${trove_db_host} -u ${encoded_user} -p${encoded_password} -e \"show tables\" | /bin/grep Tables"
|
|
}
|
|
|
|
}
|