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.2KB

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