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.

README.rst 7.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. =====
  2. Usage
  3. =====
  4. Galera Cluster for MySQL is a true Multimaster Cluster based on synchronous
  5. replication. Galera Cluster is an easy-to-use, high-availability solution,
  6. which provides high system uptime, no data loss and scalability for future
  7. growth.
  8. Sample pillars
  9. ==============
  10. Galera cluster master node
  11. .. code-block:: yaml
  12. galera:
  13. version:
  14. mysql: 5.6
  15. galera: 3
  16. master:
  17. enabled: true
  18. name: openstack
  19. bind:
  20. address: 192.168.0.1
  21. port: 3306
  22. members:
  23. - host: 192.168.0.1
  24. port: 4567
  25. - host: 192.168.0.2
  26. port: 4567
  27. admin:
  28. user: root
  29. password: pass
  30. database:
  31. name:
  32. encoding: 'utf8'
  33. users:
  34. - name: 'username'
  35. password: 'password'
  36. host: 'localhost'
  37. rights: 'all privileges'
  38. Galera cluster slave node
  39. .. code-block:: yaml
  40. galera:
  41. slave:
  42. enabled: true
  43. name: openstack
  44. bind:
  45. address: 192.168.0.2
  46. port: 3306
  47. members:
  48. - host: 192.168.0.1
  49. port: 4567
  50. - host: 192.168.0.2
  51. port: 4567
  52. admin:
  53. user: root
  54. password: pass
  55. Enable TLS support:
  56. .. code-block:: yaml
  57. galera:
  58. slave or master:
  59. ssl:
  60. enabled: True
  61. ciphers:
  62. DHE-RSA-AES128-SHA:
  63. enabled: True
  64. DHE-RSA-AES256-SHA:
  65. enabled: True
  66. EDH-RSA-DES-CBC3-SHA:
  67. name: EDH-RSA-DES-CBC3-SHA
  68. enabled: True
  69. AES128-SHA:AES256-SHA:
  70. name: AES128-SHA:AES256-SHA
  71. enabled: True
  72. DES-CBC3-SHA:
  73. enabled: True
  74. # path
  75. cert_file: /etc/mysql/ssl/cert.pem
  76. key_file: /etc/mysql/ssl/key.pem
  77. ca_file: /etc/mysql/ssl/ca.pem
  78. # content (not required if files already exists)
  79. key: << body of key >>
  80. cert: << body of cert >>
  81. cacert_chain: << body of ca certs chain >>
  82. Additional mysql users:
  83. .. code-block:: yaml
  84. mysql:
  85. server:
  86. users:
  87. - name: clustercheck
  88. password: clustercheck
  89. database: '*.*'
  90. grants: PROCESS
  91. - name: inspector
  92. host: 127.0.0.1
  93. password: password
  94. databases:
  95. mydb:
  96. - database: mydb
  97. - table: mytable
  98. - grant_option: True
  99. - grants:
  100. - all privileges
  101. Additional mysql SSL grants:
  102. .. code-block:: yaml
  103. mysql:
  104. server:
  105. users:
  106. - name: clustercheck
  107. password: clustercheck
  108. database: '*.*'
  109. grants: PROCESS
  110. ssl_option:
  111. - SSL: True
  112. - X509: True
  113. - SUBJECT: <subject>
  114. - ISSUER: <issuer>
  115. - CIPHER: <cipher>
  116. Additional check params:
  117. ========================
  118. .. code-block:: yaml
  119. galera:
  120. clustercheck:
  121. - enabled: True
  122. - user: clustercheck
  123. - password: clustercheck
  124. - available_when_donor: 0
  125. - available_when_readonly: 1
  126. - port 9200
  127. Configurable soft parameters
  128. ============================
  129. - ``galera_innodb_buffer_pool_size``
  130. Default is ``3138M``
  131. - ``galera_max_connections``
  132. Default is ``20000``
  133. - ``galera_innodb_read_io_threads``
  134. Default is ``8``
  135. - ``galera_innodb_write_io_threads``
  136. Default is ``8``
  137. - ``galera_wsrep_slave_threads``
  138. Default is ``8``
  139. - ``galera_xtrabackup_parallel``
  140. Default is 4
  141. - ``galera_error_log_enabled``
  142. Default is ``false``
  143. Usage:
  144. .. code-block:: yaml
  145. _param:
  146. galera_innodb_buffer_pool_size: 1024M
  147. galera_max_connections: 200
  148. galera_innodb_read_io_threads: 16
  149. galera_innodb_write_io_threads: 16
  150. galera_wsrep_slave_threads: 8
  151. galera_xtrabackup_parallel: 2
  152. galera_error_log_enabled: true
  153. Usage
  154. =====
  155. MySQL Galera check sripts
  156. .. code-block:: bash
  157. mysql> SHOW STATUS LIKE 'wsrep%';
  158. mysql> SHOW STATUS LIKE 'wsrep_cluster_size' ;"
  159. Galera monitoring command, performed from extra server
  160. .. code-block:: bash
  161. garbd -a gcomm://ipaddrofone:4567 -g my_wsrep_cluster -l /tmp/1.out -d
  162. #. salt-call state.sls mysql
  163. #. Comment everything starting wsrep* (wsrep_provider, wsrep_cluster, wsrep_sst)
  164. #. service mysql start
  165. #. run on each node mysql_secure_install and filling root password.
  166. .. code-block:: bash
  167. Enter current password for root (enter for none):
  168. OK, successfully used password, moving on...
  169. Setting the root password ensures that nobody can log into the MySQL
  170. root user without the proper authorisation.
  171. Set root password? [Y/n] y
  172. New password:
  173. Re-enter new password:
  174. Password updated successfully!
  175. Reloading privilege tables..
  176. ... Success!
  177. By default, a MySQL installation has an anonymous user, allowing anyone
  178. to log into MySQL without having to have a user account created for
  179. them. This is intended only for testing, and to make the installation
  180. go a bit smoother. You should remove them before moving into a
  181. production environment.
  182. Remove anonymous users? [Y/n] y
  183. ... Success!
  184. Normally, root should only be allowed to connect from 'localhost'. This
  185. ensures that someone cannot guess at the root password from the network.
  186. Disallow root login remotely? [Y/n] n
  187. ... skipping.
  188. By default, MySQL comes with a database named 'test' that anyone can
  189. access. This is also intended only for testing, and should be removed
  190. before moving into a production environment.
  191. Remove test database and access to it? [Y/n] y
  192. - Dropping test database...
  193. ... Success!
  194. - Removing privileges on test database...
  195. ... Success!
  196. Reloading the privilege tables will ensure that all changes made so far
  197. will take effect immediately.
  198. Reload privilege tables now? [Y/n] y
  199. ... Success!
  200. Cleaning up...
  201. #. service mysql stop
  202. #. uncomment all wsrep* lines except first server, where leave only in
  203. my.cnf wsrep_cluster_address='gcomm://';
  204. #. start first node
  205. #. Start third node which is connected to first one
  206. #. Start second node which is connected to third one
  207. #. After starting cluster, it must be change cluster address at first starting node
  208. without restart database and change config my.cnf.
  209. .. code-block:: bash
  210. mysql> SET GLOBAL wsrep_cluster_address='gcomm://10.0.0.2';
  211. Read more
  212. =========
  213. * https://github.com/CaptTofu/ansible-galera
  214. * http://www.sebastien-han.fr/blog/2012/04/15/active-passive-failover-cluster-on-a-mysql-galera-cluster-with-haproxy-lsb-agent/
  215. * http://opentodo.net/2012/12/mysql-multi-master-replication-with-galera/
  216. * http://www.codership.com/wiki/doku.php
  217. * http://www.sebastien-han.fr/blog/2012/04/01/mysql-multi-master-replication-with-galera/
  218. Documentation and bugs
  219. ======================
  220. * http://salt-formulas.readthedocs.io/
  221. Learn how to install and update salt-formulas
  222. * https://github.com/salt-formulas/salt-formula-galera/issues
  223. In the unfortunate event that bugs are discovered, report the issue to the
  224. appropriate issue tracker. Use the Github issue tracker for a specific salt
  225. formula
  226. * https://launchpad.net/salt-formulas
  227. For feature requests, bug reports, or blueprints affecting the entire
  228. ecosystem, use the Launchpad salt-formulas project
  229. * https://launchpad.net/~salt-formulas-users
  230. Join the salt-formulas-users team and subscribe to mailing list if required
  231. * https://github.com/salt-formulas/salt-formula-galera
  232. Develop the salt-formulas projects in the master branch and then submit pull
  233. requests against a specific formula
  234. * #salt-formulas @ irc.freenode.net
  235. Use this IRC channel in case of any questions or feedback which is always
  236. welcome