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

my.cnf.bootstrap 6.6KB

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