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 7.9KB

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