Saltstack Official Galera Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

106 行
3.3KB

  1. # All files in this package is subject to the GPL v2 license
  2. # More information is in the COPYING file in the top directory of this package.
  3. # Copyright (C) 2011 severalnines.com
  4. {%- if pillar.galera.get('master',{}).get('enabled', False) %}
  5. {%- from "galera/map.jinja" import master with context %}
  6. {%- set service = master %}
  7. {%- endif %}
  8. {%- if pillar.galera.get('slave',{}).get('enabled', False) %}
  9. {%- from "galera/map.jinja" import slave with context %}
  10. {%- set service = slave %}
  11. {%- endif %}
  12. [mysql]
  13. {% if service.get('ssl', {}).get('enabled', False) %}
  14. ssl-ca={{ service.ssl.ca_file }}
  15. ssl-cert={{ service.ssl.cert_file }}
  16. ssl-key={{ service.ssl.key_file }}
  17. {% endif %}
  18. [mysqld_safe]
  19. syslog
  20. [mysqld]
  21. datadir=/var/lib/mysql
  22. bind-address={{ service.bind.address }}
  23. port=3306
  24. max_connections={{ service.max_connections }}
  25. default-storage-engine=innodb
  26. binlog_format=ROW
  27. collation-server=utf8_general_ci
  28. init-connect='SET NAMES utf8'
  29. character-set-server=utf8
  30. default-storage-engine=innodb
  31. {%- if service.get('error_log_enabled', False) %}
  32. log_error = /var/log/mysql/error.log
  33. {%- else %}
  34. #log_error = /var/log/mysql/error.log
  35. {%- endif %}
  36. skip-external-locking
  37. skip-name-resolve
  38. socket = /var/run/mysqld/mysqld.sock
  39. myisam_sort_buffer_size=64M
  40. wait_timeout=1800
  41. open_files_limit=102400
  42. table_open_cache=10000
  43. key_buffer_size=64M
  44. max_allowed_packet=256M
  45. query_cache_size=0
  46. query_cache_type=0
  47. innodb_file_format=Barracuda
  48. innodb_file_per_table=1
  49. innodb_buffer_pool_size={{ service.innodb_buffer_pool_size }}
  50. innodb_log_file_size=627M
  51. innodb_read_io_threads={{ service.get('innodb_read_io_threads', 8) }}
  52. innodb_write_io_threads={{ service.get('innodb_write_io_threads', 8) }}
  53. innodb_io_capacity=500
  54. innodb_flush_log_at_trx_commit=2
  55. innodb_flush_method=O_DIRECT
  56. innodb_doublewrite=0
  57. innodb_autoinc_lock_mode=2
  58. innodb_locks_unsafe_for_binlog=1
  59. {%- if service.members|length > 1 %}
  60. wsrep_cluster_address="gcomm://{% for member in service.members %}{{ member.host}}:4567{% if not loop.last %},{% endif %}{% endfor %}/?pc.wait_prim=no"
  61. {%- else %}
  62. wsrep_cluster_address="gcomm://"
  63. {%- endif %}
  64. wsrep_provider={{ service.wsrep_provider }}
  65. wsrep_cluster_name="openstack"
  66. wsrep_slave_threads={{ service.get('wsrep_slave_threads', 8) }}
  67. wsrep_sst_method=xtrabackup-v2
  68. wsrep_sst_auth={{ service.admin.user }}:{{ service.admin.password }}
  69. wsrep_node_address={{ service.bind.address }}
  70. wsrep_provider_options="gcache.size = 256M"
  71. wsrep_provider_options="gmcast.listen_addr = tcp://{{ service.bind.address }}:4567"
  72. {% if service.get('ssl', {}).get('enabled', False) %}
  73. wsrep_provider_options="socket.ssl=yes;socket.ssl_key={{ service.ssl.key_file }};socket.ssl_cert={{ service.ssl.cert_file }};socket.ssl_ca={{ service.ssl.ca_file }}"
  74. {%- if service.ssl.ciphers is defined %}
  75. {%- set _ciphers = [] %}
  76. {%- for cipher_name, cipher in service.ssl.get('ciphers', {}).iteritems() %}
  77. {%- if cipher.get('enabled', False) %}
  78. {%- if cipher.name is defined %}
  79. {%- do _ciphers.append(cipher.name) %}
  80. {%- else %}
  81. {%- do _ciphers.append(cipher_name) %}
  82. {%- endif %}
  83. {%- endif %}
  84. {%- endfor %}
  85. ssl_cipher={{ ':'.join(_ciphers) }}
  86. {%- endif %}
  87. ssl-ca={{ service.ssl.ca_file }}
  88. ssl-cert={{ service.ssl.cert_file }}
  89. ssl-key={{ service.ssl.key_file }}
  90. {% endif %}
  91. [xtrabackup]
  92. parallel={{ service.get('xtrabackup_parallel', 4) }}
  93. [sst]
  94. streamfmt=xbstream
  95. transferfmt=socat
  96. sockopt=,nodelay,sndbuf=1048576,rcvbuf=1048576