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