Add new soft parameters
Make max_connections and innodb_buffer_pool_size configurable
through soft params instead of hard.
Change-Id: Id0bb8f6b6091289275864bf4dd6a6890d11b4782
diff --git a/README.rst b/README.rst
index 98eba4a..609ec3d 100644
--- a/README.rst
+++ b/README.rst
@@ -56,20 +56,19 @@
user: root
password: pass
-InnoDB parameters
-=================
+Configurable soft parameters
+============================
-- **innodb_buffer_pool_size** - the default value is 35% of the available ram
+- **galera_innodb_buffer_pool_size** - the default value is 3138M
+- **galera_max_connections** - the default value is 20000
Usage:
.. code-block:: yaml
- galera:
- master:
- innodb_buffer_pool_size: 1024M
- slave:
- innodb_buffer_pool_size: 1024M
+ _param:
+ galera_innodb_buffer_pool_size: 1024M
+ galera_max_connections: 200
Usage
=====
diff --git a/galera/files/my.cnf b/galera/files/my.cnf
index 070efcc..32e3a60 100644
--- a/galera/files/my.cnf
+++ b/galera/files/my.cnf
@@ -16,7 +16,7 @@
datadir=/var/lib/mysql
bind-address={{ service.bind.address }}
port=3306
-max_connections={{ service.get('max_connections', 20000) }}
+max_connections={{ service.max_connections }}
default-storage-engine=innodb
binlog_format=ROW
collation-server=utf8_general_ci
@@ -38,12 +38,7 @@
innodb_file_format=Barracuda
innodb_file_per_table=1
-{%- if service.innodb_buffer_pool_size is not defined %}
- {% set buffer_pool_size = '%.0fM'%(grains['mem_total']*0.35) %}
-{%- else %}
- {% set buffer_pool_size = service.innodb_buffer_pool_size %}
-{%- endif %}
-innodb_buffer_pool_size={{ buffer_pool_size }}
+innodb_buffer_pool_size={{ service.innodb_buffer_pool_size }}
innodb_log_file_size=627M
innodb_read_io_threads=8
innodb_write_io_threads=8
diff --git a/galera/files/my.cnf.container b/galera/files/my.cnf.container
index ec85ef1..dc09937 100644
--- a/galera/files/my.cnf.container
+++ b/galera/files/my.cnf.container
@@ -12,7 +12,7 @@
pid_file=/var/lib/mysql/mysql.pid
port=3306
log_warnings=2
-innodb_buffer_pool_size=3138M
+innodb_buffer_pool_size={{ service.innodb_buffer_pool_size }}
innodb_flush_log_at_trx_commit=2
innodb_file_per_table=1
innodb_data_file_path = ibdata1:100M:autoextend
@@ -45,7 +45,7 @@
skip_name_resolve
memlock=0
sysdate_is_now=1
-max_connections={{ service.get('max_connections', 20000) }}
+max_connections={{ service.max_connections }}
thread_cache_size=512
query_cache_type = 0
query_cache_size = 0
diff --git a/galera/files/my.cnf.init b/galera/files/my.cnf.init
index ea0e0f0..1d95bce 100644
--- a/galera/files/my.cnf.init
+++ b/galera/files/my.cnf.init
@@ -15,7 +15,7 @@
datadir=/var/lib/mysql
bind-address={{ service.bind.address }}
port=3306
-max_connections={{ service.get('max_connections', 20000) }}
+max_connections={{ service.max_connections }}
default-storage-engine=innodb
binlog_format=ROW
collation-server=utf8_general_ci
@@ -36,7 +36,7 @@
innodb_file_format=Barracuda
innodb_file_per_table=1
-innodb_buffer_pool_size=3138M
+innodb_buffer_pool_size={{ service.innodb_buffer_pool_size }}
innodb_log_file_size=627M
innodb_read_io_threads=8
innodb_write_io_threads=8
diff --git a/galera/map.jinja b/galera/map.jinja
index 65683f2..e7fea3c 100644
--- a/galera/map.jinja
+++ b/galera/map.jinja
@@ -1,5 +1,9 @@
{%- set master = salt['grains.filter_by']({
+ 'default': {
+ 'max_connections': 20000,
+ 'innodb_buffer_pool_size': '3138M',
+ },
'Debian': {
'pkgs': ['mysql-wsrep-5.6', 'galera-3', 'rsync', 'python-mysqldb', 'psmisc', 'netcat', 'percona-xtrabackup', 'socat', 'libdbd-mysql', 'python-pymysql'],
'service': 'mysql',
@@ -17,9 +21,13 @@
'socket': '/var/run/mariadb/mysqld.sock',
'config': '/etc/my.cnf',
},
-}, merge=pillar.galera.get('master', {})) %}
+}, merge=pillar.galera.get('master', {}), base='default') %}
{%- set slave = salt['grains.filter_by']({
+ 'default': {
+ 'max_connections': 20000,
+ 'innodb_buffer_pool_size': '3138M',
+ },
'Debian': {
'pkgs': ['mysql-wsrep-5.6', 'galera-3', 'rsync', 'python-mysqldb', 'libmysqlclient18', 'psmisc', 'netcat', 'percona-xtrabackup', 'socat', 'libdbd-mysql', 'python-pymysql'],
'service': 'mysql',
@@ -54,4 +62,4 @@
'socket': '/var/run/mysqld/mysqld.sock',
'config': '/etc/mysql/my.cnf',
},
-}, grain='oscodename', merge=pillar.galera.get('slave', {}))) %}
+}, grain='oscodename', merge=pillar.galera.get('slave', {})), base='default') %}
diff --git a/metadata/service/master/cluster.yml b/metadata/service/master/cluster.yml
index 7705f6b..05c4c57 100644
--- a/metadata/service/master/cluster.yml
+++ b/metadata/service/master/cluster.yml
@@ -8,6 +8,8 @@
galera_server_bind_address: ${_param:cluster_local_address}
galera_server_bind_port: 3306
galera_server_admin_user: root
+ galera_max_connections: 20000
+ galera_innodb_buffer_pool_size: 3138M
galera:
master:
enabled: true
@@ -26,6 +28,8 @@
port: 4567
- host: ${_param:cluster_node03_address}
port: 4567
+ max_connections: ${_param:galera_max_connections}
+ innodb_buffer_pool_size: ${_param:galera_innodb_buffer_pool_size}
mysql:
server:
users:
diff --git a/metadata/service/master/container.yml b/metadata/service/master/container.yml
index e6ac462..c80beef 100644
--- a/metadata/service/master/container.yml
+++ b/metadata/service/master/container.yml
@@ -3,6 +3,8 @@
galera_server_cluster_name: galeracluster
galera_server_bind_port: 3306
galera_server_admin_user: root
+ galera_max_connections: 20000
+ galera_innodb_buffer_pool_size: 3138M
kubernetes:
control:
configmap:
@@ -28,6 +30,8 @@
port: 4567
- host: ${_param:mysql_service_host03}
port: 4567
+ max_connections: ${_param:galera_max_connections}
+ innodb_buffer_pool_size: ${_param:galera_innodb_buffer_pool_size}
mysql:
server:
users:
diff --git a/metadata/service/slave/cluster.yml b/metadata/service/slave/cluster.yml
index 2432da6..de05623 100644
--- a/metadata/service/slave/cluster.yml
+++ b/metadata/service/slave/cluster.yml
@@ -8,6 +8,8 @@
galera_server_bind_address: ${_param:cluster_local_address}
galera_server_bind_port: 3306
galera_server_admin_user: root
+ galera_max_connections: 20000
+ galera_innodb_buffer_pool_size: 3138M
galera:
slave:
enabled: true
@@ -26,6 +28,8 @@
port: 4567
- host: ${_param:cluster_node03_address}
port: 4567
+ max_connections: ${_param:galera_max_connections}
+ innodb_buffer_pool_size: ${_param:galera_innodb_buffer_pool_size}
mysql:
server:
users:
diff --git a/tests/pillar/master_cluster.sls b/tests/pillar/master_cluster.sls
index 7257ce4..5b596d9 100644
--- a/tests/pillar/master_cluster.sls
+++ b/tests/pillar/master_cluster.sls
@@ -16,6 +16,8 @@
port: 4567
- host: 127.0.0.1
port: 4567
+ max_connections: 20000
+ innodb_buffer_pool_size: 3138M
mysql:
server:
users:
diff --git a/tests/pillar/slave_cluster.sls b/tests/pillar/slave_cluster.sls
index 10dfccb..40ec4de 100644
--- a/tests/pillar/slave_cluster.sls
+++ b/tests/pillar/slave_cluster.sls
@@ -16,6 +16,8 @@
port: 4567
- host: 127.0.0.1
port: 4567
+ max_connections: 20000
+ innodb_buffer_pool_size: 3138M
mysql:
server:
users: