blob: 9d59c82274840ebd2c76e0144222b9abb5864bca [file] [log] [blame]
Ales Komarekcba48ac2015-04-30 11:40:44 +02001
2======
3Galera
4======
5
6Galera 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.
7
8Sample pillars
9==============
10
11Galera cluster master node
12
13.. code-block:: yaml
14
15 galera:
Petr Michalec5ff575c2017-11-06 15:37:05 +010016 version:
17 mysql: 5.6
18 galera: 3
Ales Komarekcba48ac2015-04-30 11:40:44 +020019 master:
20 enabled: true
21 name: openstack
22 bind:
23 address: 192.168.0.1
24 port: 3306
25 members:
26 - host: 192.168.0.1
27 port: 4567
28 - host: 192.168.0.2
29 port: 4567
30 admin:
31 user: root
32 password: pass
33 database:
34 name:
35 encoding: 'utf8'
36 users:
37 - name: 'username'
38 password: 'password'
39 host: 'localhost'
40 rights: 'all privileges'
41
42Galera cluster slave node
43
44.. code-block:: yaml
45
46 galera:
47 slave:
48 enabled: true
49 name: openstack
50 bind:
51 address: 192.168.0.2
52 port: 3306
53 members:
54 - host: 192.168.0.1
55 port: 4567
56 - host: 192.168.0.2
57 port: 4567
58 admin:
59 user: root
60 password: pass
61
Kirill Bespalov5f0c1d62017-08-15 15:29:32 +030062Enable TLS support:
63
64.. code-block:: yaml
65
66 galera:
67 slave or master:
68 ssl:
69 enabled: True
70
71 # path
72 cert_file: /etc/mysql/ssl/cert.pem
73 key_file: /etc/mysql/ssl/key.pem
74 ca_file: /etc/mysql/ssl/ca.pem
75
76 # content (not required if files already exists)
77 key: << body of key >>
78 cert: << body of cert >>
79 cacert_chain: << body of ca certs chain >>
80
81
Petr Michalecbca6ffa2017-05-22 13:10:20 +020082Additional mysql users:
83
84.. code-block:: yaml
85
86 mysql:
87 server:
88 users:
89 - name: clustercheck
90 password: clustercheck
91 database: '*.*'
92 grants: PROCESS
Petr Michalecbca6ffa2017-05-22 13:10:20 +020093 - name: inspector
94 host: 127.0.0.1
95 password: password
96 databases:
97 mydb:
98 - database: mydb
99 - table: mytable
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200100 - grant_option: True
Petr Michalecbca6ffa2017-05-22 13:10:20 +0200101 - grants:
102 - all privileges
103
Vasyl Saienko79f69062018-01-29 11:04:58 +0200104Additional mysql SSL grants:
105
106.. code-block:: yaml
107
108 mysql:
109 server:
110 users:
111 - name: clustercheck
112 password: clustercheck
113 database: '*.*'
114 grants: PROCESS
115 ssl_option:
116 - SSL: True
117 - X509: True
118 - SUBJECT: <subject>
119 - ISSUER: <issuer>
120 - CIPHER: <cipher>
121
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200122Additional check params:
Petr Michalec518b8342017-08-04 11:23:03 +0200123========================
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200124
125.. code-block:: yaml
126
127 galera:
128 clustercheck:
129 - enabled: True
130 - user: clustercheck
131 - password: clustercheck
132 - available_when_donor: 0
133 - available_when_readonly: 1
134 - port 9200
135
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +0400136Configurable soft parameters
137============================
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300138
Petr Michalecc5ca6e82017-09-01 10:10:48 +0200139
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +0400140- **galera_innodb_buffer_pool_size** - the default value is 3138M
141- **galera_max_connections** - the default value is 20000
Dennis Dmitriev2c572892018-03-05 23:32:34 +0200142- **galera_innodb_read_io_threads** - the default value is 8
143- **galera_innodb_write_io_threads** - the default value is 8
144- **galera_wsrep_slave_threads** - the default value is 8
145- **galera_xtrabackup_parallel** - the default value is 4
146- **galera_error_log_enabled** - the default value is 'false'
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300147
148Usage:
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300149.. code-block:: yaml
150
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +0400151 _param:
152 galera_innodb_buffer_pool_size: 1024M
Kirill Bespalov5f0c1d62017-08-15 15:29:32 +0300153 galera_max_connections: 200
Dennis Dmitriev2c572892018-03-05 23:32:34 +0200154 galera_innodb_read_io_threads: 16
155 galera_innodb_write_io_threads: 16
156 galera_wsrep_slave_threads: 8
157 galera_xtrabackup_parallel: 2
158 galera_error_log_enabled: true
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300159
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200160
Ales Komarekcba48ac2015-04-30 11:40:44 +0200161Usage
162=====
163
164MySQL Galera check sripts
165
166.. code-block:: bash
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200167
Ales Komarekcba48ac2015-04-30 11:40:44 +0200168 mysql> SHOW STATUS LIKE 'wsrep%';
169
170 mysql> SHOW STATUS LIKE 'wsrep_cluster_size' ;"
171
172Galera monitoring command, performed from extra server
173
174.. code-block:: bash
175
176 garbd -a gcomm://ipaddrofone:4567 -g my_wsrep_cluster -l /tmp/1.out -d
177
1781. salt-call state.sls mysql
1792. Comment everything starting wsrep* (wsrep_provider, wsrep_cluster, wsrep_sst)
1803. service mysql start
1814. run on each node mysql_secure_install and filling root password.
182
183.. code-block:: bash
184
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300185 Enter current password for root (enter for none):
Ales Komarekcba48ac2015-04-30 11:40:44 +0200186 OK, successfully used password, moving on...
187
188 Setting the root password ensures that nobody can log into the MySQL
189 root user without the proper authorisation.
190
191 Set root password? [Y/n] y
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300192 New password:
193 Re-enter new password:
Ales Komarekcba48ac2015-04-30 11:40:44 +0200194 Password updated successfully!
195 Reloading privilege tables..
196 ... Success!
197
198 By default, a MySQL installation has an anonymous user, allowing anyone
199 to log into MySQL without having to have a user account created for
200 them. This is intended only for testing, and to make the installation
201 go a bit smoother. You should remove them before moving into a
202 production environment.
203
204 Remove anonymous users? [Y/n] y
205 ... Success!
206
207 Normally, root should only be allowed to connect from 'localhost'. This
208 ensures that someone cannot guess at the root password from the network.
209
210 Disallow root login remotely? [Y/n] n
211 ... skipping.
212
213 By default, MySQL comes with a database named 'test' that anyone can
214 access. This is also intended only for testing, and should be removed
215 before moving into a production environment.
216
217 Remove test database and access to it? [Y/n] y
218 - Dropping test database...
219 ... Success!
220 - Removing privileges on test database...
221 ... Success!
222
223 Reloading the privilege tables will ensure that all changes made so far
224 will take effect immediately.
225
226 Reload privilege tables now? [Y/n] y
227 ... Success!
228
229 Cleaning up...
230
2315. service mysql stop
Kirill Bespalov162a4d42017-06-21 02:26:19 +03002326. uncomment all wsrep* lines except first server, where leave only in my.cnf wsrep_cluster_address='gcomm://';
Ales Komarekcba48ac2015-04-30 11:40:44 +02002337. start first node
2348. Start third node which is connected to first one
2359. Start second node which is connected to third one
23610. After starting cluster, it must be change cluster address at first starting node without restart database and change config my.cnf.
237
238.. code-block:: bash
239
240 mysql> SET GLOBAL wsrep_cluster_address='gcomm://10.0.0.2';
241
242Read more
243=========
244
245* https://github.com/CaptTofu/ansible-galera
246* http://www.sebastien-han.fr/blog/2012/04/15/active-passive-failover-cluster-on-a-mysql-galera-cluster-with-haproxy-lsb-agent/
247* http://opentodo.net/2012/12/mysql-multi-master-replication-with-galera/
248* http://www.codership.com/wiki/doku.php
249* Best one: - http://www.sebastien-han.fr/blog/2012/04/01/mysql-multi-master-replication-with-galera/
Filip Pytloun5b356a72017-02-02 13:02:03 +0100250
251Documentation and Bugs
252======================
253
254To learn how to install and update salt-formulas, consult the documentation
255available online at:
256
257 http://salt-formulas.readthedocs.io/
258
259In the unfortunate event that bugs are discovered, they should be reported to
260the appropriate issue tracker. Use Github issue tracker for specific salt
261formula:
262
263 https://github.com/salt-formulas/salt-formula-galera/issues
264
265For feature requests, bug reports or blueprints affecting entire ecosystem,
266use Launchpad salt-formulas project:
267
268 https://launchpad.net/salt-formulas
269
270You can also join salt-formulas-users team and subscribe to mailing list:
271
272 https://launchpad.net/~salt-formulas-users
273
274Developers wishing to work on the salt-formulas projects should always base
275their work on master branch and submit pull request against specific formula.
276
277 https://github.com/salt-formulas/salt-formula-galera
278
279Any questions or feedback is always welcome so feel free to join our IRC
280channel:
281
282 #salt-formulas @ irc.freenode.net