Saltstack Official Galera Formula
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

README.rst 7.0KB

il y a 9 ans
il y a 9 ans
il y a 7 ans
il y a 7 ans
il y a 9 ans
il y a 9 ans
il y a 9 ans
il y a 9 ans
il y a 9 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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 mysql SSL grants:
  86. .. code-block:: yaml
  87. mysql:
  88. server:
  89. users:
  90. - name: clustercheck
  91. password: clustercheck
  92. database: '*.*'
  93. grants: PROCESS
  94. ssl_option:
  95. - SSL: True
  96. - X509: True
  97. - SUBJECT: <subject>
  98. - ISSUER: <issuer>
  99. - CIPHER: <cipher>
  100. Additional check params:
  101. ========================
  102. .. code-block:: yaml
  103. galera:
  104. clustercheck:
  105. - enabled: True
  106. - user: clustercheck
  107. - password: clustercheck
  108. - available_when_donor: 0
  109. - available_when_readonly: 1
  110. - port 9200
  111. Configurable soft parameters
  112. ============================
  113. - **galera_innodb_buffer_pool_size** - the default value is 3138M
  114. - **galera_max_connections** - the default value is 20000
  115. Usage:
  116. .. code-block:: yaml
  117. _param:
  118. galera_innodb_buffer_pool_size: 1024M
  119. galera_max_connections: 200
  120. Usage
  121. =====
  122. MySQL Galera check sripts
  123. .. code-block:: bash
  124. mysql> SHOW STATUS LIKE 'wsrep%';
  125. mysql> SHOW STATUS LIKE 'wsrep_cluster_size' ;"
  126. Galera monitoring command, performed from extra server
  127. .. code-block:: bash
  128. garbd -a gcomm://ipaddrofone:4567 -g my_wsrep_cluster -l /tmp/1.out -d
  129. 1. salt-call state.sls mysql
  130. 2. Comment everything starting wsrep* (wsrep_provider, wsrep_cluster, wsrep_sst)
  131. 3. service mysql start
  132. 4. run on each node mysql_secure_install and filling root password.
  133. .. code-block:: bash
  134. Enter current password for root (enter for none):
  135. OK, successfully used password, moving on...
  136. Setting the root password ensures that nobody can log into the MySQL
  137. root user without the proper authorisation.
  138. Set root password? [Y/n] y
  139. New password:
  140. Re-enter new password:
  141. Password updated successfully!
  142. Reloading privilege tables..
  143. ... Success!
  144. By default, a MySQL installation has an anonymous user, allowing anyone
  145. to log into MySQL without having to have a user account created for
  146. them. This is intended only for testing, and to make the installation
  147. go a bit smoother. You should remove them before moving into a
  148. production environment.
  149. Remove anonymous users? [Y/n] y
  150. ... Success!
  151. Normally, root should only be allowed to connect from 'localhost'. This
  152. ensures that someone cannot guess at the root password from the network.
  153. Disallow root login remotely? [Y/n] n
  154. ... skipping.
  155. By default, MySQL comes with a database named 'test' that anyone can
  156. access. This is also intended only for testing, and should be removed
  157. before moving into a production environment.
  158. Remove test database and access to it? [Y/n] y
  159. - Dropping test database...
  160. ... Success!
  161. - Removing privileges on test database...
  162. ... Success!
  163. Reloading the privilege tables will ensure that all changes made so far
  164. will take effect immediately.
  165. Reload privilege tables now? [Y/n] y
  166. ... Success!
  167. Cleaning up...
  168. 5. service mysql stop
  169. 6. uncomment all wsrep* lines except first server, where leave only in my.cnf wsrep_cluster_address='gcomm://';
  170. 7. start first node
  171. 8. Start third node which is connected to first one
  172. 9. Start second node which is connected to third one
  173. 10. After starting cluster, it must be change cluster address at first starting node without restart database and change config my.cnf.
  174. .. code-block:: bash
  175. mysql> SET GLOBAL wsrep_cluster_address='gcomm://10.0.0.2';
  176. Read more
  177. =========
  178. * https://github.com/CaptTofu/ansible-galera
  179. * http://www.sebastien-han.fr/blog/2012/04/15/active-passive-failover-cluster-on-a-mysql-galera-cluster-with-haproxy-lsb-agent/
  180. * http://opentodo.net/2012/12/mysql-multi-master-replication-with-galera/
  181. * http://www.codership.com/wiki/doku.php
  182. * Best one: - http://www.sebastien-han.fr/blog/2012/04/01/mysql-multi-master-replication-with-galera/
  183. Documentation and Bugs
  184. ======================
  185. To learn how to install and update salt-formulas, consult the documentation
  186. available online at:
  187. http://salt-formulas.readthedocs.io/
  188. In the unfortunate event that bugs are discovered, they should be reported to
  189. the appropriate issue tracker. Use Github issue tracker for specific salt
  190. formula:
  191. https://github.com/salt-formulas/salt-formula-galera/issues
  192. For feature requests, bug reports or blueprints affecting entire ecosystem,
  193. use Launchpad salt-formulas project:
  194. https://launchpad.net/salt-formulas
  195. You can also join salt-formulas-users team and subscribe to mailing list:
  196. https://launchpad.net/~salt-formulas-users
  197. Developers wishing to work on the salt-formulas projects should always base
  198. their work on master branch and submit pull request against specific formula.
  199. https://github.com/salt-formulas/salt-formula-galera
  200. Any questions or feedback is always welcome so feel free to join our IRC
  201. channel:
  202. #salt-formulas @ irc.freenode.net