瀏覽代碼

galera configmap support

tags/2016.12
Jakub Pavlik 8 年之前
父節點
當前提交
0647d43b22
共有 6 個文件被更改,包括 130 次插入104 次删除
  1. +0
    -102
      galera/files/my.cnf.bootstrap
  2. +82
    -0
      galera/files/my.cnf.container
  3. +2
    -2
      galera/map.jinja
  4. +7
    -0
      galera/meta/config.yml
  5. +37
    -0
      metadata/service/master/container.yml
  6. +2
    -0
      metadata/service/support.yml

+ 0
- 102
galera/files/my.cnf.bootstrap 查看文件

@@ -1,102 +0,0 @@
# All files in this package is subject to the GPL v2 license
# More information is in the COPYING file in the top directory of this package.
# Copyright (C) 2011 severalnines.com
{%- if pillar.galera.master is defined %}
{%- from "galera/map.jinja" import master with context %}
{%- set service = master %}
{%- endif %}
{%- if pillar.galera.slave is defined %}
{%- from "galera/map.jinja" import slave with context %}
{%- set service = slave %}
{%- endif %}
[MYSQLD]
user=mysql
basedir=/usr/
datadir=/var/lib/mysql
socket={{ service.socket }}
pid_file=mysqld.pid
port=3306
log_error={{ service.log_file }}
log_warnings=2
#log_output=FILE
### INNODB OPTIONS
innodb_buffer_pool_size=9211M
innodb_flush_log_at_trx_commit=2
innodb_file_per_table=1
innodb_data_file_path = ibdata1:100M:autoextend
## You may want to tune the below depending on number of cores and disk sub
innodb_read_io_threads=4
innodb_write_io_threads=4
innodb_io_capacity=200
innodb_doublewrite=1
innodb_log_file_size=1024M
innodb_log_buffer_size=96M
innodb_buffer_pool_instances=8
innodb_log_files_in_group=2
innodb_thread_concurrency=64
#innodb_file_format=barracuda
innodb_flush_method = O_DIRECT
innodb_autoinc_lock_mode=2
## avoid statistics update when doing e.g show tables
innodb_stats_on_metadata=0
default_storage_engine=innodb

bind-address={{ service.bind.address }}

# CHARACTER SET
#collation_server = utf8_unicode_ci
#init_connect='SET NAMES utf8'
character_set_server = utf8

# REPLICATION SPECIFIC
#server_id must be unique across all mysql servers participating in replication.
#server_id=SERVERID
binlog_format=ROW
#log_slave_updates=1
#log_bin=binlog
#relay_log=relay-bin
#expire_logs_days=7
#gtid_mode=ON
#enforce_gtid_consistency=1
# OTHER THINGS, BUFFERS ETC
key_buffer_size = 24M
tmp_table_size = 64M
max_heap_table_size = 64M
max_allowed_packet = 512M
#sort_buffer_size = 256K
#read_buffer_size = 256K
#read_rnd_buffer_size = 512K
#myisam_sort_buffer_size = 8M
skip_name_resolve
memlock=0
sysdate_is_now=1
max_connections={{ service.get('max_connections', 20000) }}
thread_cache_size=512
query_cache_type = 0
query_cache_size = 0
table_open_cache=1024
lower_case_table_names=0
# 5.6 backwards compatibility
#explicit_defaults_for_timestamp=1
#

# Desired SST donor name.
#wsrep_sst_donor=

# Protocol version to use
# wsrep_protocol_version=
[MYSQL]
socket={{ service.socket }}
#default_character_set=utf8
[client]
socket={{ service.socket }}
default_character_set=utf8
[mysqldump]
max_allowed_packet = 512M
socket={{ service.socket }}
default_character_set=utf8
[MYSQLD_SAFE]
pid_file=mysqld.pid
log_error={{ service.log_file }}
basedir=/usr/
datadir=/var/lib/mysql

+ 82
- 0
galera/files/my.cnf.container 查看文件

@@ -0,0 +1,82 @@
{%- if pillar.galera.master is defined %}
{%- from "galera/map.jinja" import master with context %}
{%- set service = master %}
{%- endif %}

[MYSQLD]
user=mysql
basedir=/usr/
bind-address={{ service.bind.address }}
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
pid_file=/var/lib/mysql/mysql.pid
port=3306
log_warnings=2
innodb_buffer_pool_size=3138M
innodb_flush_log_at_trx_commit=2
innodb_file_per_table=1
innodb_data_file_path = ibdata1:100M:autoextend
innodb_read_io_threads=8
innodb_write_io_threads=8
innodb_io_capacity=500
innodb_doublewrite=0
innodb_log_file_size=627M
innodb_log_buffer_size=32M
innodb_buffer_pool_instances=-1
innodb_log_files_in_group=2
innodb_thread_concurrency=64
innodb_flush_method = O_DIRECT
innodb_autoinc_lock_mode=2
innodb_stats_on_metadata=0
innodb_locks_unsafe_for_binlog=1
default_storage_engine=innodb
server_id=1
binlog_format=ROW
key_buffer_size = 64M
tmp_table_size = 64M
max_heap_table_size = 64M
max_allowed_packet = 512M

wait_timeout=1800
myisam_sort_buffer_size = 64M
open_files_limit=102400
character-set-server=utf8

skip_name_resolve
memlock=0
sysdate_is_now=1
max_connections={{ service.get('max_connections', 20000) }}
thread_cache_size=512
query_cache_type = 0
query_cache_size = 0
table_open_cache=10000
lower_case_table_names=0
performance_schema = 1
performance-schema-max-mutex-classes = 0
performance-schema-max-mutex-instances = 0
wsrep_provider={{ service.wsrep_provider }}
wsrep_on=ON
wsrep_provider_options="gcache.size=512M; gmcast.segment=0"
wsrep_cluster_name="my_wsrep_cluster"
wsrep_cluster_address="gcomm://{% for member in service.members %}{{ member.host}}{% if not loop.last %},{% endif %}{% endfor %}"
wsrep_slave_threads=8
wsrep_certify_nonPK=1
wsrep_max_ws_rows=131072
wsrep_max_ws_size=1073741824
wsrep_debug=0
wsrep_convert_LOCK_to_trx=0
wsrep_retry_autocommit=1
wsrep_auto_increment_control=1
wsrep_replicate_myisam=1
wsrep_drupal_282555_workaround=0
wsrep_causal_reads=0
wsrep_sst_method=xtrabackup
wsrep_sst_auth={{ service.admin.user }}:{{ service.admin.password }}

[MYSQL]
socket=/var/lib/mysql/mysql.sock

[xtrabackup]
parallel=4
user={{ service.admin.user }}
password={{ service.admin.password }}

+ 2
- 2
galera/map.jinja 查看文件

@@ -17,7 +17,7 @@
'socket': '/var/run/mariadb/mysqld.sock',
'config': '/etc/my.cnf',
},
}, merge=salt['pillar.get']('galera:master')) %}
}, merge=pillar.galera.get('master', {})) %}

{%- set slave = salt['grains.filter_by']({
'Debian': {
@@ -37,4 +37,4 @@
'socket': '/var/run/mariadb/mysqld.sock',
'config': '/etc/my.cnf',
},
}, merge=salt['pillar.get']('galera:slave')) %}
}, merge=pillar.galera.get('slave', {})) %}

+ 7
- 0
galera/meta/config.yml 查看文件

@@ -0,0 +1,7 @@
config:
{%- if pillar.galera.master is defined %}
{%- from "galera/map.jinja" import master with context %}
my.cnf:
source: "salt://galera/files/my.cnf.container"
template: jinja
{%- endif %}

+ 37
- 0
metadata/service/master/container.yml 查看文件

@@ -0,0 +1,37 @@
parameters:
_param:
galera_server_cluster_name: galeracluster
galera_server_bind_port: 3306
galera_server_admin_user: root
kubernetes:
control:
configmap:
galera-master:
grains:
os_family: Debian
pillar:
galera:
master:
enabled: true
name: ${_param:galera_server_cluster_name}
bind:
address: 0.0.0.0
port: ${_param:galera_server_bind_port}
maintenance_password: ${_param:galera_server_maintenance_password}
admin:
user: ${_param:galera_server_admin_user}
password: ${_param:galera_server_admin_password}
members:
- host: ${_param:mysql_service_host01}
port: 4567
- host: ${_param:mysql_service_host02}
port: 4567
- host: ${_param:mysql_service_host03}
port: 4567
mysql:
server:
users:
- name: haproxy
host: localhost
- name: haproxy
host: '%'

+ 2
- 0
metadata/service/support.yml 查看文件

@@ -9,3 +9,5 @@ parameters:
enabled: true
sphinx:
enabled: true
config:
enabled: true

Loading…
取消
儲存