Merge "mysql: Enable deployer to set Limits"
This commit is contained in:
@@ -169,6 +169,15 @@
|
|||||||
# (optional) The name or ip address of host running monitoring database (clustercheck)
|
# (optional) The name or ip address of host running monitoring database (clustercheck)
|
||||||
# Defaults to '127.0.0.1'
|
# Defaults to '127.0.0.1'
|
||||||
#
|
#
|
||||||
|
# [*open_files_limit*]
|
||||||
|
# (optional) An integer that specifies the open_files_limit for MySQL
|
||||||
|
# Defaults to 65535
|
||||||
|
#
|
||||||
|
# [*mysql_systemd_override_settings*]
|
||||||
|
# (optional) An hash of setting to override for MariaDB unit file.
|
||||||
|
# Defaults to {}
|
||||||
|
# Example : { 'LimitNOFILE' => 'infinity', 'LimitNPROC' => 4, 'TimeoutSec' => '30' }
|
||||||
|
#
|
||||||
# [*firewall_settings*]
|
# [*firewall_settings*]
|
||||||
# (optional) Allow to add custom parameters to firewall rules
|
# (optional) Allow to add custom parameters to firewall rules
|
||||||
# Should be an hash.
|
# Should be an hash.
|
||||||
@@ -212,11 +221,21 @@ class cloud::database::sql::mysql (
|
|||||||
$galera_clustercheck_dbuser = 'clustercheckdbuser',
|
$galera_clustercheck_dbuser = 'clustercheckdbuser',
|
||||||
$galera_clustercheck_dbpassword = 'clustercheckpassword',
|
$galera_clustercheck_dbpassword = 'clustercheckpassword',
|
||||||
$galera_clustercheck_ipaddress = '127.0.0.1',
|
$galera_clustercheck_ipaddress = '127.0.0.1',
|
||||||
|
$open_files_limit = 65535,
|
||||||
|
$mysql_systemd_override_settings = {},
|
||||||
$firewall_settings = {},
|
$firewall_settings = {},
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include 'xinetd'
|
include 'xinetd'
|
||||||
|
|
||||||
|
if $mysql_systemd_override_settings['LimitNOFILE'] {
|
||||||
|
$open_files_limit_real = $mysql_systemd_override_settings['LimitNOFILE']
|
||||||
|
$mysql_systemd_override_settings_real = $mysql_systemd_override_settings
|
||||||
|
} else {
|
||||||
|
$open_files_limit_real = $open_files_limit
|
||||||
|
$mysql_systemd_override_settings_real = merge($mysql_systemd_override_settings, { 'LimitNOFILE' => $open_files_limit})
|
||||||
|
}
|
||||||
|
|
||||||
$gcomm_definition = inline_template('<%= @galera_internal_ips.join(",") + "?pc.wait_prim=no" -%>')
|
$gcomm_definition = inline_template('<%= @galera_internal_ips.join(",") + "?pc.wait_prim=no" -%>')
|
||||||
|
|
||||||
# Specific to the Galera master node
|
# Specific to the Galera master node
|
||||||
@@ -344,6 +363,24 @@ class cloud::database::sql::mysql (
|
|||||||
require => [Package[$mysql_server_package_name], File[$mysql_server_config_file]]
|
require => [Package[$mysql_server_package_name], File[$mysql_server_config_file]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $::operatingsystemrelease >= 7 {
|
||||||
|
file { "/etc/systemd/system/${mysql_service_name}.service.d" :
|
||||||
|
ensure => directory,
|
||||||
|
}
|
||||||
|
file { "/etc/systemd/system/${mysql_service_name}.service.d/custom.conf" :
|
||||||
|
content => template('cloud/database/systemd-custom.conf.erb'),
|
||||||
|
owner => 'root',
|
||||||
|
mode => '0755',
|
||||||
|
group => 'root',
|
||||||
|
notify => [Service['mysqld'], Exec['mariadb-sysctl-daemon-reload']],
|
||||||
|
}
|
||||||
|
exec { 'mariadb-sysctl-daemon-reload' :
|
||||||
|
command => '/usr/bin/systemctl daemon-reload',
|
||||||
|
refreshonly => true,
|
||||||
|
notify => Service['mysqld'],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} # RedHat
|
} # RedHat
|
||||||
'Debian': {
|
'Debian': {
|
||||||
# Specific to Debian / Ubuntu
|
# Specific to Debian / Ubuntu
|
||||||
@@ -396,7 +433,7 @@ class cloud::database::sql::mysql (
|
|||||||
before => Package[$mysql_server_package_name],
|
before => Package[$mysql_server_package_name],
|
||||||
}
|
}
|
||||||
|
|
||||||
if($::osfamily == 'Debian'){
|
if $::osfamily == 'Debian' {
|
||||||
# The startup time can be longer than the default 30s so we take
|
# The startup time can be longer than the default 30s so we take
|
||||||
# care of it there. Until this bug is not resolved
|
# care of it there. Until this bug is not resolved
|
||||||
# https://mariadb.atlassian.net/browse/MDEV-5540, we have to do it
|
# https://mariadb.atlassian.net/browse/MDEV-5540, we have to do it
|
||||||
|
@@ -94,6 +94,34 @@ describe 'cloud::database::sql::mysql' do
|
|||||||
|
|
||||||
end # configure mysqlchk http replication
|
end # configure mysqlchk http replication
|
||||||
|
|
||||||
|
context 'configure override of systemd defaults' do
|
||||||
|
before :each do
|
||||||
|
facts.merge!( :hostname => 'os-ci-test1',
|
||||||
|
:osfamily => 'RedHat',
|
||||||
|
:operatingsystemrelease => 7 )
|
||||||
|
end
|
||||||
|
before :each do
|
||||||
|
params.merge!(:mysql_systemd_override_settings => { 'LimitNOFILE' => 666 })
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_file('/etc/systemd/system/mysql-bootstrap.service.d/custom.conf').with_content(/[Service]/) }
|
||||||
|
it { is_expected.to contain_file('/etc/systemd/system/mysql-bootstrap.service.d/custom.conf').with_content(/LimitNOFILE=666/) }
|
||||||
|
it { is_expected.to contain_file('/etc/my.cnf').with_content(/open_files_limit = 666/) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'configure open_file_limits' do
|
||||||
|
before :each do
|
||||||
|
facts.merge!( :hostname => 'os-ci-test1',
|
||||||
|
:osfamily => 'RedHat',
|
||||||
|
:operatingsystemrelease => 7 )
|
||||||
|
end
|
||||||
|
before :each do
|
||||||
|
params.merge!(:open_files_limit => 666)
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_file('/etc/my.cnf').with_content(/open_files_limit = 666/) }
|
||||||
|
end
|
||||||
|
|
||||||
context 'configure databases on the galera master server' do
|
context 'configure databases on the galera master server' do
|
||||||
|
|
||||||
before :each do
|
before :each do
|
||||||
@@ -271,7 +299,8 @@ describe 'cloud::database::sql::mysql' do
|
|||||||
|
|
||||||
context 'on RedHat platforms' do
|
context 'on RedHat platforms' do
|
||||||
let :facts do
|
let :facts do
|
||||||
{ :osfamily => 'RedHat' }
|
{ :osfamily => 'RedHat',
|
||||||
|
:operatingsystemrelease => 7 }
|
||||||
end
|
end
|
||||||
|
|
||||||
let :platform_params do
|
let :platform_params do
|
||||||
|
@@ -20,7 +20,7 @@ max_heap_table_size = 128M
|
|||||||
query_cache_type = 0
|
query_cache_type = 0
|
||||||
myisam_recover = BACKUP
|
myisam_recover = BACKUP
|
||||||
key_buffer_size = 16M
|
key_buffer_size = 16M
|
||||||
open_files_limit = 65535
|
open_files_limit = <%= @open_files_limit_real %>
|
||||||
table_open_cache = 1024
|
table_open_cache = 1024
|
||||||
table_definition_cache = 500
|
table_definition_cache = 500
|
||||||
myisam_sort_buffer_size = 512M
|
myisam_sort_buffer_size = 512M
|
||||||
@@ -37,7 +37,7 @@ innodb_flush_log_at_trx_commit = 1
|
|||||||
innodb_lock_wait_timeout = 50
|
innodb_lock_wait_timeout = 50
|
||||||
innodb_thread_concurrency = 48
|
innodb_thread_concurrency = 48
|
||||||
innodb_file_per_table = 1
|
innodb_file_per_table = 1
|
||||||
innodb_open_files = 65535
|
innodb_open_files = <%= @open_files_limit_real %>
|
||||||
innodb_io_capacity = 1000
|
innodb_io_capacity = 1000
|
||||||
innodb_file_format = Barracuda
|
innodb_file_format = Barracuda
|
||||||
innodb_file_format_max = Barracuda
|
innodb_file_format_max = Barracuda
|
||||||
|
4
templates/database/systemd-custom.conf.erb
Normal file
4
templates/database/systemd-custom.conf.erb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[Service]
|
||||||
|
<% @mysql_systemd_override_settings_real.each do |key, value| -%>
|
||||||
|
<%= key -%>=<%= value %>
|
||||||
|
<% end -%>
|
Reference in New Issue
Block a user