Saltstack Official Galera Formula
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

111 行
3.5KB

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