Saltstack Official Galera Formula
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

README.rst 7.5KB

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