Saltstack Official Galera Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

152 lines
3.9KB

  1. {% set mysql_version = pillar.galera.get('version', {}).get('mysql', '5.6') %}
  2. {% set galera_version = pillar.galera.get('version', {}).get('galera', '3') %}
  3. {% set engine = pillar.galera.get('engine', 'mysql') %}
  4. {%- load_yaml as master %}
  5. default:
  6. max_connections: 20000
  7. innodb_buffer_pool_size: '3138M'
  8. Debian:
  9. pkgs:
  10. {%- if engine == 'mysql' %}
  11. - mysql-wsrep-{{ mysql_version }}
  12. - python-mysqldb
  13. - libdbd-mysql
  14. - percona-xtrabackup
  15. {%- else %}
  16. - mariadb-server
  17. - mariadb-client
  18. {%- endif %}
  19. - galera-{{ galera_version }}
  20. - rsync
  21. - psmisc
  22. - netcat
  23. - socat
  24. - python-pymysql
  25. service: {{ engine }}
  26. wsrep_provider: /usr/lib/galera/libgalera_smm.so
  27. log_file: /var/log/mysql.log
  28. socket: /var/run/mysqld/mysqld.sock
  29. config: /etc/mysql/my.cnf
  30. RedHat:
  31. pkgs:
  32. - galera
  33. - mariadb-galera-server
  34. - mariadb
  35. - MySQL-python
  36. - rsync
  37. - percona-xtrabackup
  38. - psmisc
  39. - socat
  40. xtrabackup_repo: http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm
  41. service: mariadb
  42. wsrep_provider: /usr/lib64/galera/libgalera_smm.so
  43. log_file: /var/log/mariadb/mariadb.log
  44. socket: /var/run/mariadb/mysqld.sock
  45. config: /etc/my.cnf
  46. {%- endload %}
  47. {%- set _pillar = pillar.galera.get('master', {}) %}
  48. {%- if _pillar|length > 1 %}
  49. {%- set master = salt['grains.filter_by'](master, merge=_pillar, base='default') %}
  50. {%- else %}
  51. {%- set master = salt['grains.filter_by'](master, base='default') %}
  52. {%- endif %}
  53. {%- load_yaml as slave %}
  54. default:
  55. max_connections: 20000
  56. innodb_buffer_pool_size: '3138M'
  57. Debian:
  58. pkgs:
  59. {%- if engine == 'mysql' %}
  60. - mysql-wsrep-{{ mysql_version }}
  61. - python-mysqldb
  62. - libdbd-mysql
  63. - libmysqlclient18
  64. - percona-xtrabackup
  65. {%- else %}
  66. - mariadb-server
  67. - mariadb-client
  68. {%- endif %}
  69. - galera-{{ galera_version }}
  70. - rsync
  71. - psmisc
  72. - netcat
  73. - socat
  74. - python-pymysql
  75. service: {{ engine }}
  76. wsrep_provider: /usr/lib/galera/libgalera_smm.so
  77. log_file: /var/log/mysql.log
  78. socket: /var/run/mysqld/mysqld.sock
  79. config: /etc/mysql/my.cnf
  80. RedHat:
  81. pkgs:
  82. - galera
  83. - mariadb-galera-server
  84. - mariadb
  85. - MySQL-python
  86. - rsync
  87. - percona-xtrabackup
  88. - psmisc
  89. - socat
  90. xtrabackup_repo: http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm
  91. service: mariadb
  92. wsrep_provider: /usr/lib64/galera/libgalera_smm.so
  93. log_file: /var/log/mariadb/mariadb.log
  94. socket: /var/run/mariadb/mysqld.sock
  95. config: /etc/my.cnf
  96. {%- endload %}
  97. {%- load_yaml as slave_oscodename %}
  98. trusty:
  99. pkgs:
  100. - mysql-wsrep-{{ mysql_version }}
  101. - galera-{{ galera_version }}
  102. - rsync
  103. - python-mysqldb
  104. - libmysqlclient18
  105. - psmisc
  106. - netcat
  107. - percona-xtrabackup
  108. - socat
  109. - libdbd-mysql
  110. - python-pymysql
  111. xenial:
  112. pkgs:
  113. - mysql-wsrep-{{ mysql_version }}
  114. - galera-{{ galera_version }}
  115. - rsync
  116. - python-mysqldb
  117. - libmysqlclient-dev
  118. - psmisc
  119. - netcat
  120. - percona-xtrabackup
  121. - socat
  122. - libdbd-mysql
  123. - python-pymysql
  124. {%- endload %}
  125. {%- set _pillar = pillar.galera.get('slave', {}) %}
  126. {%- if _pillar|length > 1 %}
  127. {%- set _oscodename = salt['grains.filter_by'](slave_oscodename, grain='oscodename', merge=_pillar) %}
  128. {%- else %}
  129. {%- set _oscodename = salt['grains.filter_by'](slave_oscodename, grain='oscodename') %}
  130. {%- endif %}
  131. {%- set slave = salt['grains.filter_by'](slave, merge=_oscodename, base='default') %}
  132. {% set clustercheck = salt['grains.filter_by']({
  133. 'Debian': {
  134. 'config': '/etc/mysql/my.cnf',
  135. 'enabled': False,
  136. 'user': clustercheck,
  137. 'password': clustercheck,
  138. 'port': '9200'
  139. },
  140. 'RedHat': {
  141. 'config': '/etc/my.cnf',
  142. 'enabled': False,
  143. 'user': clustercheck,
  144. 'password': clustercheck,
  145. 'port': '9200'
  146. },
  147. }, merge=pillar.galera.get('clustercheck', {})) %}