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.

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