blob: 05ea8daeb506294e88491a70700915a622bdc7b1 [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:
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
39Galera cluster slave node
40
41.. code-block:: yaml
42
43 galera:
44 slave:
45 enabled: true
46 name: openstack
47 bind:
48 address: 192.168.0.2
49 port: 3306
50 members:
51 - host: 192.168.0.1
52 port: 4567
53 - host: 192.168.0.2
54 port: 4567
55 admin:
56 user: root
57 password: pass
58
Kirill Bespalov5f0c1d62017-08-15 15:29:32 +030059Enable TLS support:
60
61.. code-block:: yaml
62
63 galera:
64 slave or master:
65 ssl:
66 enabled: True
67
68 # path
69 cert_file: /etc/mysql/ssl/cert.pem
70 key_file: /etc/mysql/ssl/key.pem
71 ca_file: /etc/mysql/ssl/ca.pem
72
73 # content (not required if files already exists)
74 key: << body of key >>
75 cert: << body of cert >>
76 cacert_chain: << body of ca certs chain >>
77
78
Petr Michalecbca6ffa2017-05-22 13:10:20 +020079Additional mysql users:
80
81.. code-block:: yaml
82
83 mysql:
84 server:
85 users:
86 - name: clustercheck
87 password: clustercheck
88 database: '*.*'
89 grants: PROCESS
Petr Michalecbca6ffa2017-05-22 13:10:20 +020090 - name: inspector
91 host: 127.0.0.1
92 password: password
93 databases:
94 mydb:
95 - database: mydb
96 - table: mytable
Petr Michalec89c8c3f2017-05-22 17:19:22 +020097 - grant_option: True
Petr Michalecbca6ffa2017-05-22 13:10:20 +020098 - grants:
99 - all privileges
100
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200101Additional check params:
Petr Michalec518b8342017-08-04 11:23:03 +0200102========================
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200103
104.. code-block:: yaml
105
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
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +0400115Configurable soft parameters
116============================
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300117
Petr Michalecc5ca6e82017-09-01 10:10:48 +0200118
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +0400119- **galera_innodb_buffer_pool_size** - the default value is 3138M
120- **galera_max_connections** - the default value is 20000
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300121
122Usage:
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300123.. code-block:: yaml
124
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +0400125 _param:
126 galera_innodb_buffer_pool_size: 1024M
Kirill Bespalov5f0c1d62017-08-15 15:29:32 +0300127 galera_max_connections: 200
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300128
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200129
Ales Komarekcba48ac2015-04-30 11:40:44 +0200130Usage
131=====
132
133MySQL Galera check sripts
134
135.. code-block:: bash
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200136
Ales Komarekcba48ac2015-04-30 11:40:44 +0200137 mysql> SHOW STATUS LIKE 'wsrep%';
138
139 mysql> SHOW STATUS LIKE 'wsrep_cluster_size' ;"
140
141Galera monitoring command, performed from extra server
142
143.. code-block:: bash
144
145 garbd -a gcomm://ipaddrofone:4567 -g my_wsrep_cluster -l /tmp/1.out -d
146
1471. salt-call state.sls mysql
1482. Comment everything starting wsrep* (wsrep_provider, wsrep_cluster, wsrep_sst)
1493. service mysql start
1504. run on each node mysql_secure_install and filling root password.
151
152.. code-block:: bash
153
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300154 Enter current password for root (enter for none):
Ales Komarekcba48ac2015-04-30 11:40:44 +0200155 OK, successfully used password, moving on...
156
157 Setting the root password ensures that nobody can log into the MySQL
158 root user without the proper authorisation.
159
160 Set root password? [Y/n] y
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300161 New password:
162 Re-enter new password:
Ales Komarekcba48ac2015-04-30 11:40:44 +0200163 Password updated successfully!
164 Reloading privilege tables..
165 ... Success!
166
167 By default, a MySQL installation has an anonymous user, allowing anyone
168 to log into MySQL without having to have a user account created for
169 them. This is intended only for testing, and to make the installation
170 go a bit smoother. You should remove them before moving into a
171 production environment.
172
173 Remove anonymous users? [Y/n] y
174 ... Success!
175
176 Normally, root should only be allowed to connect from 'localhost'. This
177 ensures that someone cannot guess at the root password from the network.
178
179 Disallow root login remotely? [Y/n] n
180 ... skipping.
181
182 By default, MySQL comes with a database named 'test' that anyone can
183 access. This is also intended only for testing, and should be removed
184 before moving into a production environment.
185
186 Remove test database and access to it? [Y/n] y
187 - Dropping test database...
188 ... Success!
189 - Removing privileges on test database...
190 ... Success!
191
192 Reloading the privilege tables will ensure that all changes made so far
193 will take effect immediately.
194
195 Reload privilege tables now? [Y/n] y
196 ... Success!
197
198 Cleaning up...
199
2005. service mysql stop
Kirill Bespalov162a4d42017-06-21 02:26:19 +03002016. uncomment all wsrep* lines except first server, where leave only in my.cnf wsrep_cluster_address='gcomm://';
Ales Komarekcba48ac2015-04-30 11:40:44 +02002027. start first node
2038. Start third node which is connected to first one
2049. Start second node which is connected to third one
20510. After starting cluster, it must be change cluster address at first starting node without restart database and change config my.cnf.
206
207.. code-block:: bash
208
209 mysql> SET GLOBAL wsrep_cluster_address='gcomm://10.0.0.2';
210
211Read more
212=========
213
214* https://github.com/CaptTofu/ansible-galera
215* http://www.sebastien-han.fr/blog/2012/04/15/active-passive-failover-cluster-on-a-mysql-galera-cluster-with-haproxy-lsb-agent/
216* http://opentodo.net/2012/12/mysql-multi-master-replication-with-galera/
217* http://www.codership.com/wiki/doku.php
218* Best one: - http://www.sebastien-han.fr/blog/2012/04/01/mysql-multi-master-replication-with-galera/
Filip Pytloun5b356a72017-02-02 13:02:03 +0100219
220Documentation and Bugs
221======================
222
223To learn how to install and update salt-formulas, consult the documentation
224available online at:
225
226 http://salt-formulas.readthedocs.io/
227
228In the unfortunate event that bugs are discovered, they should be reported to
229the appropriate issue tracker. Use Github issue tracker for specific salt
230formula:
231
232 https://github.com/salt-formulas/salt-formula-galera/issues
233
234For feature requests, bug reports or blueprints affecting entire ecosystem,
235use Launchpad salt-formulas project:
236
237 https://launchpad.net/salt-formulas
238
239You can also join salt-formulas-users team and subscribe to mailing list:
240
241 https://launchpad.net/~salt-formulas-users
242
243Developers wishing to work on the salt-formulas projects should always base
244their work on master branch and submit pull request against specific formula.
245
246 https://github.com/salt-formulas/salt-formula-galera
247
248Any questions or feedback is always welcome so feel free to join our IRC
249channel:
250
251 #salt-formulas @ irc.freenode.net