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 6.7KB

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