blob: 6221894c3ac4489276da26548e42694a891f6d76 [file] [log] [blame]
Ales Komarekcba48ac2015-04-30 11:40:44 +02001
OlgaGusarenko43e99902018-07-30 17:18:32 +03002=====
3Usage
4=====
Ales Komarekcba48ac2015-04-30 11:40:44 +02005
OlgaGusarenko43e99902018-07-30 17:18:32 +03006Galera Cluster for MySQL is a true Multimaster Cluster based on synchronous
7replication. Galera Cluster is an easy-to-use, high-availability solution,
8which provides high system uptime, no data loss and scalability for future
9growth.
Ales Komarekcba48ac2015-04-30 11:40:44 +020010
11Sample pillars
12==============
13
14Galera cluster master node
15
16.. code-block:: yaml
17
18 galera:
Petr Michalec5ff575c2017-11-06 15:37:05 +010019 version:
20 mysql: 5.6
21 galera: 3
Ales Komarekcba48ac2015-04-30 11:40:44 +020022 master:
23 enabled: true
24 name: openstack
25 bind:
26 address: 192.168.0.1
27 port: 3306
28 members:
29 - host: 192.168.0.1
30 port: 4567
31 - host: 192.168.0.2
32 port: 4567
33 admin:
34 user: root
35 password: pass
36 database:
37 name:
38 encoding: 'utf8'
39 users:
40 - name: 'username'
41 password: 'password'
42 host: 'localhost'
43 rights: 'all privileges'
44
45Galera cluster slave node
46
47.. code-block:: yaml
48
49 galera:
50 slave:
51 enabled: true
52 name: openstack
53 bind:
54 address: 192.168.0.2
55 port: 3306
56 members:
57 - host: 192.168.0.1
58 port: 4567
59 - host: 192.168.0.2
60 port: 4567
61 admin:
62 user: root
63 password: pass
64
Kirill Bespalov5f0c1d62017-08-15 15:29:32 +030065Enable TLS support:
66
67.. code-block:: yaml
68
69 galera:
70 slave or master:
71 ssl:
72 enabled: True
Dzmitry Stremkouskif8433bf2018-10-23 11:29:03 +020073 ciphers:
74 DHE-RSA-AES128-SHA:
75 enabled: True
76 DHE-RSA-AES256-SHA:
77 enabled: True
78 EDH-RSA-DES-CBC3-SHA:
79 name: EDH-RSA-DES-CBC3-SHA
80 enabled: True
81 AES128-SHA:AES256-SHA:
82 name: AES128-SHA:AES256-SHA
83 enabled: True
84 DES-CBC3-SHA:
85 enabled: True
Kirill Bespalov5f0c1d62017-08-15 15:29:32 +030086 # path
87 cert_file: /etc/mysql/ssl/cert.pem
88 key_file: /etc/mysql/ssl/key.pem
89 ca_file: /etc/mysql/ssl/ca.pem
90
91 # content (not required if files already exists)
92 key: << body of key >>
93 cert: << body of cert >>
94 cacert_chain: << body of ca certs chain >>
95
96
Petr Michalecbca6ffa2017-05-22 13:10:20 +020097Additional mysql users:
98
99.. code-block:: yaml
100
101 mysql:
102 server:
103 users:
104 - name: clustercheck
105 password: clustercheck
106 database: '*.*'
107 grants: PROCESS
Petr Michalecbca6ffa2017-05-22 13:10:20 +0200108 - name: inspector
109 host: 127.0.0.1
110 password: password
111 databases:
112 mydb:
113 - database: mydb
114 - table: mytable
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200115 - grant_option: True
Petr Michalecbca6ffa2017-05-22 13:10:20 +0200116 - grants:
117 - all privileges
118
Vasyl Saienko79f69062018-01-29 11:04:58 +0200119Additional mysql SSL grants:
120
121.. code-block:: yaml
122
123 mysql:
124 server:
125 users:
126 - name: clustercheck
127 password: clustercheck
128 database: '*.*'
129 grants: PROCESS
130 ssl_option:
131 - SSL: True
132 - X509: True
133 - SUBJECT: <subject>
134 - ISSUER: <issuer>
135 - CIPHER: <cipher>
136
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200137Additional check params:
Petr Michalec518b8342017-08-04 11:23:03 +0200138========================
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200139
140.. code-block:: yaml
141
142 galera:
143 clustercheck:
144 - enabled: True
145 - user: clustercheck
146 - password: clustercheck
147 - available_when_donor: 0
148 - available_when_readonly: 1
149 - port 9200
150
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +0400151Configurable soft parameters
152============================
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300153
OlgaGusarenko43e99902018-07-30 17:18:32 +0300154- ``galera_innodb_buffer_pool_size``
155 Default is ``3138M``
156- ``galera_max_connections``
157 Default is ``20000``
158- ``galera_innodb_read_io_threads``
159 Default is ``8``
160- ``galera_innodb_write_io_threads``
161 Default is ``8``
162- ``galera_wsrep_slave_threads``
163 Default is ``8``
164- ``galera_xtrabackup_parallel``
165 Default is 4
166- ``galera_error_log_enabled``
Michal Kobus6a33c422018-09-28 14:32:57 +0200167 Default is ``true``
168- ``galera_error_log_path``
169 Default is ``/var/log/mysql/error.log``
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300170
171Usage:
OlgaGusarenko43e99902018-07-30 17:18:32 +0300172
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300173.. code-block:: yaml
174
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +0400175 _param:
176 galera_innodb_buffer_pool_size: 1024M
Kirill Bespalov5f0c1d62017-08-15 15:29:32 +0300177 galera_max_connections: 200
Dennis Dmitriev2c572892018-03-05 23:32:34 +0200178 galera_innodb_read_io_threads: 16
179 galera_innodb_write_io_threads: 16
180 galera_wsrep_slave_threads: 8
181 galera_xtrabackup_parallel: 2
182 galera_error_log_enabled: true
Michal Kobus6a33c422018-09-28 14:32:57 +0200183 galera_error_log_path: /var/log/mysql/error.log
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300184
Ales Komarekcba48ac2015-04-30 11:40:44 +0200185Usage
186=====
187
188MySQL Galera check sripts
189
190.. code-block:: bash
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200191
Ales Komarekcba48ac2015-04-30 11:40:44 +0200192 mysql> SHOW STATUS LIKE 'wsrep%';
193
194 mysql> SHOW STATUS LIKE 'wsrep_cluster_size' ;"
195
196Galera monitoring command, performed from extra server
197
198.. code-block:: bash
199
200 garbd -a gcomm://ipaddrofone:4567 -g my_wsrep_cluster -l /tmp/1.out -d
201
OlgaGusarenko43e99902018-07-30 17:18:32 +0300202#. salt-call state.sls mysql
203#. Comment everything starting wsrep* (wsrep_provider, wsrep_cluster, wsrep_sst)
204#. service mysql start
205#. run on each node mysql_secure_install and filling root password.
Ales Komarekcba48ac2015-04-30 11:40:44 +0200206
OlgaGusarenko43e99902018-07-30 17:18:32 +0300207 .. code-block:: bash
Ales Komarekcba48ac2015-04-30 11:40:44 +0200208
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300209 Enter current password for root (enter for none):
Ales Komarekcba48ac2015-04-30 11:40:44 +0200210 OK, successfully used password, moving on...
211
212 Setting the root password ensures that nobody can log into the MySQL
213 root user without the proper authorisation.
214
215 Set root password? [Y/n] y
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300216 New password:
217 Re-enter new password:
Ales Komarekcba48ac2015-04-30 11:40:44 +0200218 Password updated successfully!
219 Reloading privilege tables..
220 ... Success!
221
222 By default, a MySQL installation has an anonymous user, allowing anyone
223 to log into MySQL without having to have a user account created for
224 them. This is intended only for testing, and to make the installation
225 go a bit smoother. You should remove them before moving into a
226 production environment.
227
228 Remove anonymous users? [Y/n] y
229 ... Success!
230
231 Normally, root should only be allowed to connect from 'localhost'. This
232 ensures that someone cannot guess at the root password from the network.
233
234 Disallow root login remotely? [Y/n] n
235 ... skipping.
236
237 By default, MySQL comes with a database named 'test' that anyone can
238 access. This is also intended only for testing, and should be removed
239 before moving into a production environment.
240
241 Remove test database and access to it? [Y/n] y
242 - Dropping test database...
243 ... Success!
244 - Removing privileges on test database...
245 ... Success!
246
247 Reloading the privilege tables will ensure that all changes made so far
248 will take effect immediately.
249
250 Reload privilege tables now? [Y/n] y
251 ... Success!
252
253 Cleaning up...
254
OlgaGusarenko43e99902018-07-30 17:18:32 +0300255#. service mysql stop
256#. uncomment all wsrep* lines except first server, where leave only in
257 my.cnf wsrep_cluster_address='gcomm://';
258#. start first node
259#. Start third node which is connected to first one
260#. Start second node which is connected to third one
261#. After starting cluster, it must be change cluster address at first starting node
262 without restart database and change config my.cnf.
Ales Komarekcba48ac2015-04-30 11:40:44 +0200263
OlgaGusarenko43e99902018-07-30 17:18:32 +0300264 .. code-block:: bash
Ales Komarekcba48ac2015-04-30 11:40:44 +0200265
OlgaGusarenko43e99902018-07-30 17:18:32 +0300266 mysql> SET GLOBAL wsrep_cluster_address='gcomm://10.0.0.2';
Ales Komarekcba48ac2015-04-30 11:40:44 +0200267
268Read more
269=========
270
271* https://github.com/CaptTofu/ansible-galera
272* http://www.sebastien-han.fr/blog/2012/04/15/active-passive-failover-cluster-on-a-mysql-galera-cluster-with-haproxy-lsb-agent/
273* http://opentodo.net/2012/12/mysql-multi-master-replication-with-galera/
274* http://www.codership.com/wiki/doku.php
OlgaGusarenko43e99902018-07-30 17:18:32 +0300275* http://www.sebastien-han.fr/blog/2012/04/01/mysql-multi-master-replication-with-galera/
Filip Pytloun5b356a72017-02-02 13:02:03 +0100276
OlgaGusarenko43e99902018-07-30 17:18:32 +0300277Documentation and bugs
Filip Pytloun5b356a72017-02-02 13:02:03 +0100278======================
279
OlgaGusarenko43e99902018-07-30 17:18:32 +0300280* http://salt-formulas.readthedocs.io/
281 Learn how to install and update salt-formulas
Filip Pytloun5b356a72017-02-02 13:02:03 +0100282
OlgaGusarenko43e99902018-07-30 17:18:32 +0300283* https://github.com/salt-formulas/salt-formula-galera/issues
284 In the unfortunate event that bugs are discovered, report the issue to the
285 appropriate issue tracker. Use the Github issue tracker for a specific salt
286 formula
Filip Pytloun5b356a72017-02-02 13:02:03 +0100287
OlgaGusarenko43e99902018-07-30 17:18:32 +0300288* https://launchpad.net/salt-formulas
289 For feature requests, bug reports, or blueprints affecting the entire
290 ecosystem, use the Launchpad salt-formulas project
Filip Pytloun5b356a72017-02-02 13:02:03 +0100291
OlgaGusarenko43e99902018-07-30 17:18:32 +0300292* https://launchpad.net/~salt-formulas-users
293 Join the salt-formulas-users team and subscribe to mailing list if required
Filip Pytloun5b356a72017-02-02 13:02:03 +0100294
OlgaGusarenko43e99902018-07-30 17:18:32 +0300295* https://github.com/salt-formulas/salt-formula-galera
296 Develop the salt-formulas projects in the master branch and then submit pull
297 requests against a specific formula
Filip Pytloun5b356a72017-02-02 13:02:03 +0100298
OlgaGusarenko43e99902018-07-30 17:18:32 +0300299* #salt-formulas @ irc.freenode.net
300 Use this IRC channel in case of any questions or feedback which is always
301 welcome
Filip Pytloun5b356a72017-02-02 13:02:03 +0100302