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

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