Saltstack Official Galera Formula
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
9 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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.master is defined %}
  5. {%- from "galera/map.jinja" import master with context %}
  6. {%- set service = master %}
  7. {%- endif %}
  8. {%- if pillar.galera.slave is defined %}
  9. {%- from "galera/map.jinja" import slave with context %}
  10. {%- set service = slave %}
  11. {%- endif %}
  12. #{% set host1 = salt['pillar.get']('galera:master:members:host1') -%}
  13. # MariaDB database server configuration file.
  14. #
  15. # You can copy this file to one of:
  16. # - "/etc/mysql/my.cnf" to set global options,
  17. # - "~/.my.cnf" to set user-specific options.
  18. #
  19. # One can use all long options that the program supports.
  20. # Run program with --help to get a list of available options and with
  21. # --print-defaults to see which it would actually understand and use.
  22. #
  23. # For explanations see
  24. # http://dev.mysql.com/doc/mysql/en/server-system-variables.html
  25. # This will be passed to all mysql clients
  26. # It has been reported that passwords should be enclosed with ticks/quotes
  27. # escpecially if they contain "#" chars...
  28. # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
  29. [client]
  30. port = 3306
  31. socket = /var/run/mysqld/mysqld.sock
  32. #character_set_server = utf8
  33. # Here is entries for some specific programs
  34. # The following values assume you have at least 32M ram
  35. # This was formally known as [safe_mysqld]. Both versions are currently parsed.
  36. [mysqld_safe]
  37. socket = /var/run/mysqld/mysqld.sock
  38. nice = 0
  39. [mysqld]
  40. #
  41. # * Basic Settings
  42. #
  43. user = mysql
  44. pid-file = /var/run/mysqld/mysqld.pid
  45. socket = /var/run/mysqld/mysqld.sock
  46. port = 3306
  47. basedir = /usr
  48. datadir = /var/lib/mysql
  49. tmpdir = /tmp
  50. lc_messages_dir = /usr/share/mysql
  51. lc_messages = en_US
  52. skip-external-locking
  53. character_set_server = utf8
  54. skip-host-cache
  55. skip-name-resolve
  56. #
  57. # Instead of skip-networking the default is now to listen only on
  58. # localhost which is more compatible and is not less secure.
  59. #
  60. # * Fine Tuning
  61. #
  62. max_connections = 2000
  63. connect_timeout = 5
  64. wait_timeout = 600
  65. max_allowed_packet = 16M
  66. thread_cache_size = 128
  67. sort_buffer_size = 4M
  68. bulk_insert_buffer_size = 16M
  69. tmp_table_size = 320M
  70. max_heap_table_size = 320M
  71. #
  72. # * MyISAM
  73. #
  74. # This replaces the startup script and checks MyISAM tables if needed
  75. # the first time they are touched. On error, make copy and try a repair.
  76. myisam_recover = BACKUP
  77. key_buffer_size = 64K
  78. #open-files-limit = 2000
  79. table_open_cache = 400
  80. myisam_sort_buffer_size = 512M
  81. concurrent_insert = 2
  82. read_buffer_size = 2M
  83. read_rnd_buffer_size = 1M
  84. #
  85. # * Query Cache Configuration
  86. #
  87. # Cache only tiny result sets, so we can fit more in the query cache.
  88. query_cache_limit = 128K
  89. query_cache_size = 0
  90. # for more write intensive setups, set to DEMAND or OFF
  91. #query_cache_type = DEMAND
  92. #
  93. # * Logging and Replication
  94. #
  95. # Both location gets rotated by the cronjob.
  96. # Be aware that this log type is a performance killer.
  97. # As of 5.1 you can enable the log at runtime!
  98. #general_log_file = /var/log/mysql/mysql.log
  99. #general_log = 1
  100. #
  101. # Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
  102. #
  103. # we do want to know about network errors and such
  104. log_warnings = 2
  105. #
  106. # Enable the slow query log to see queries with especially long duration
  107. slow_query_log=1
  108. slow_query_log_file = /var/log/mysql/mariadb-slow.log
  109. long_query_time = 5
  110. #log_slow_rate_limit = 1000
  111. log_slow_verbosity = query_plan
  112. #log-queries-not-using-indexes
  113. #log_slow_admin_statements
  114. #
  115. # The following can be used as easy to replay backup logs or for replication.
  116. # note: if you are setting up a replication slave, see README.Debian about
  117. # other settings you may need to change.
  118. #server-id = 1
  119. #report_host = master1
  120. #auto_increment_increment = 2
  121. #auto_increment_offset = 1
  122. log_bin = /var/log/mysql/mariadb-bin
  123. log_bin_index = /var/log/mysql/mariadb-bin.index
  124. # not fab for performance, but safer
  125. #sync_binlog = 1
  126. expire_logs_days = 10
  127. max_binlog_size = 100M
  128. # slaves
  129. #relay_log = /var/log/mysql/relay-bin
  130. #relay_log_index = /var/log/mysql/relay-bin.index
  131. #relay_log_info_file = /var/log/mysql/relay-bin.info
  132. #log_slave_updates
  133. #read_only
  134. #
  135. # If applications support it, this stricter sql_mode prevents some
  136. # mistakes like inserting invalid dates etc.
  137. #sql_mode = NO_ENGINE_SUBSTITUTION,TRADITIONAL
  138. #
  139. # * InnoDB
  140. #
  141. # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
  142. # Read the manual for more InnoDB related options. There are many!
  143. default_storage_engine = InnoDB
  144. # you can't just change log file size, requires special procedure
  145. #innodb_log_file_size = 50M
  146. innodb_buffer_pool_size = 12G
  147. innodb_log_buffer_size = 8M
  148. innodb_file_per_table = 1
  149. innodb_open_files = 400
  150. innodb_io_capacity = 4000
  151. innodb_flush_method = O_DIRECT
  152. #
  153. # * Security Features
  154. #
  155. # Read the manual, too, if you want chroot!
  156. # chroot = /var/lib/mysql/
  157. #
  158. # For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
  159. #
  160. # ssl-ca=/etc/mysql/cacert.pem
  161. # ssl-cert=/etc/mysql/server-cert.pem
  162. # ssl-key=/etc/mysql/server-key.pem
  163. #
  164. # * Galera-related settings
  165. #
  166. [galera]
  167. wsrep_on=ON
  168. wsrep_provider=/usr/lib/galera/libgalera_smm.so
  169. binlog_format=ROW
  170. default_storage_engine=InnoDB
  171. innodb_autoinc_lock_mode={{ service.get('innodb_autoinc_lock_mode', 2) }}
  172. innodb_doublewrite=1
  173. query_cache_size=0
  174. bind-address={{ service.bind.address }}
  175. #wsrep_cluster_address=gcomm://
  176. wsrep_cluster_address=gcomm://{% for member in service.members %}{{ member.host}}{% if not loop.last %},{% endif %}{% endfor %}?pc.wait_prim=no
  177. wsrep_provider_options="gcache.size=8192M"
  178. #wsrep_provider_options="pc.bootstrap=true"
  179. # Mandatory settings
  180. #wsrep_provider=
  181. #wsrep_cluster_address=
  182. #binlog_format=row
  183. #default_storage_engine=InnoDB
  184. #innodb_autoinc_lock_mode=2
  185. #bind-address=0.0.0.0
  186. #
  187. # Optional setting
  188. #wsrep_slave_threads=1
  189. innodb_flush_log_at_trx_commit={{ service.get('innodb_flush_log_at_trx_commit', 2) }}
  190. # Note Warning: Setting innodb_flush_log_at_trx_commit to 2 improves performance, it also introduces certain dangers.
  191. # Operating system crashes or power outages can erase the last second of transaction. Although normally you can recover this data from another node,
  192. # it can still be lost entirely in the event that the cluster goes down at the same time, (e.g. a data center power outage).
  193. character_set_server = utf8
  194. [mysqldump]
  195. quick
  196. quote-names
  197. max_allowed_packet = 16M
  198. [mysql]
  199. #no-auto-rehash # faster start of mysql but no tab completition
  200. [isamchk]
  201. key_buffer = 16M
  202. #
  203. # * IMPORTANT: Additional settings that can override those from this file!
  204. # The files must end with '.cnf', otherwise they'll be ignored.
  205. #
  206. !includedir /etc/mysql/conf.d/