blob: 872aca0dc14b10cb230c8e569f7e4c4c71bbe131 [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
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300142
143Usage:
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300144.. code-block:: yaml
145
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +0400146 _param:
147 galera_innodb_buffer_pool_size: 1024M
Kirill Bespalov5f0c1d62017-08-15 15:29:32 +0300148 galera_max_connections: 200
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300149
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200150
Ales Komarekcba48ac2015-04-30 11:40:44 +0200151Usage
152=====
153
154MySQL Galera check sripts
155
156.. code-block:: bash
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200157
Ales Komarekcba48ac2015-04-30 11:40:44 +0200158 mysql> SHOW STATUS LIKE 'wsrep%';
159
160 mysql> SHOW STATUS LIKE 'wsrep_cluster_size' ;"
161
162Galera monitoring command, performed from extra server
163
164.. code-block:: bash
165
166 garbd -a gcomm://ipaddrofone:4567 -g my_wsrep_cluster -l /tmp/1.out -d
167
1681. salt-call state.sls mysql
1692. Comment everything starting wsrep* (wsrep_provider, wsrep_cluster, wsrep_sst)
1703. service mysql start
1714. run on each node mysql_secure_install and filling root password.
172
173.. code-block:: bash
174
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300175 Enter current password for root (enter for none):
Ales Komarekcba48ac2015-04-30 11:40:44 +0200176 OK, successfully used password, moving on...
177
178 Setting the root password ensures that nobody can log into the MySQL
179 root user without the proper authorisation.
180
181 Set root password? [Y/n] y
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300182 New password:
183 Re-enter new password:
Ales Komarekcba48ac2015-04-30 11:40:44 +0200184 Password updated successfully!
185 Reloading privilege tables..
186 ... Success!
187
188 By default, a MySQL installation has an anonymous user, allowing anyone
189 to log into MySQL without having to have a user account created for
190 them. This is intended only for testing, and to make the installation
191 go a bit smoother. You should remove them before moving into a
192 production environment.
193
194 Remove anonymous users? [Y/n] y
195 ... Success!
196
197 Normally, root should only be allowed to connect from 'localhost'. This
198 ensures that someone cannot guess at the root password from the network.
199
200 Disallow root login remotely? [Y/n] n
201 ... skipping.
202
203 By default, MySQL comes with a database named 'test' that anyone can
204 access. This is also intended only for testing, and should be removed
205 before moving into a production environment.
206
207 Remove test database and access to it? [Y/n] y
208 - Dropping test database...
209 ... Success!
210 - Removing privileges on test database...
211 ... Success!
212
213 Reloading the privilege tables will ensure that all changes made so far
214 will take effect immediately.
215
216 Reload privilege tables now? [Y/n] y
217 ... Success!
218
219 Cleaning up...
220
2215. service mysql stop
Kirill Bespalov162a4d42017-06-21 02:26:19 +03002226. uncomment all wsrep* lines except first server, where leave only in my.cnf wsrep_cluster_address='gcomm://';
Ales Komarekcba48ac2015-04-30 11:40:44 +02002237. start first node
2248. Start third node which is connected to first one
2259. Start second node which is connected to third one
22610. After starting cluster, it must be change cluster address at first starting node without restart database and change config my.cnf.
227
228.. code-block:: bash
229
230 mysql> SET GLOBAL wsrep_cluster_address='gcomm://10.0.0.2';
231
232Read more
233=========
234
235* https://github.com/CaptTofu/ansible-galera
236* http://www.sebastien-han.fr/blog/2012/04/15/active-passive-failover-cluster-on-a-mysql-galera-cluster-with-haproxy-lsb-agent/
237* http://opentodo.net/2012/12/mysql-multi-master-replication-with-galera/
238* http://www.codership.com/wiki/doku.php
239* Best one: - http://www.sebastien-han.fr/blog/2012/04/01/mysql-multi-master-replication-with-galera/
Filip Pytloun5b356a72017-02-02 13:02:03 +0100240
241Documentation and Bugs
242======================
243
244To learn how to install and update salt-formulas, consult the documentation
245available online at:
246
247 http://salt-formulas.readthedocs.io/
248
249In the unfortunate event that bugs are discovered, they should be reported to
250the appropriate issue tracker. Use Github issue tracker for specific salt
251formula:
252
253 https://github.com/salt-formulas/salt-formula-galera/issues
254
255For feature requests, bug reports or blueprints affecting entire ecosystem,
256use Launchpad salt-formulas project:
257
258 https://launchpad.net/salt-formulas
259
260You can also join salt-formulas-users team and subscribe to mailing list:
261
262 https://launchpad.net/~salt-formulas-users
263
264Developers wishing to work on the salt-formulas projects should always base
265their work on master branch and submit pull request against specific formula.
266
267 https://github.com/salt-formulas/salt-formula-galera
268
269Any questions or feedback is always welcome so feel free to join our IRC
270channel:
271
272 #salt-formulas @ irc.freenode.net