blob: 5f858500e79b2b9a4312631795b8a3fedc1b2998 [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
Petr Michalecbca6ffa2017-05-22 13:10:20 +020059Additional mysql users:
60
61.. code-block:: yaml
62
63 mysql:
64 server:
65 users:
66 - name: clustercheck
67 password: clustercheck
68 database: '*.*'
69 grants: PROCESS
Petr Michalecbca6ffa2017-05-22 13:10:20 +020070 - name: inspector
71 host: 127.0.0.1
72 password: password
73 databases:
74 mydb:
75 - database: mydb
76 - table: mytable
Petr Michalec89c8c3f2017-05-22 17:19:22 +020077 - grant_option: True
Petr Michalecbca6ffa2017-05-22 13:10:20 +020078 - grants:
79 - all privileges
80
Petr Michalec89c8c3f2017-05-22 17:19:22 +020081Additional check params:
Petr Michalec518b8342017-08-04 11:23:03 +020082========================
Petr Michalec89c8c3f2017-05-22 17:19:22 +020083
84.. code-block:: yaml
85
86 galera:
87 clustercheck:
88 - enabled: True
89 - user: clustercheck
90 - password: clustercheck
91 - available_when_donor: 0
92 - available_when_readonly: 1
93 - port 9200
94
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +040095Configurable soft parameters
96============================
Kirill Bespalov162a4d42017-06-21 02:26:19 +030097
Petr Michalecc5ca6e82017-09-01 10:10:48 +020098
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +040099- **galera_innodb_buffer_pool_size** - the default value is 3138M
100- **galera_max_connections** - the default value is 20000
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300101
102Usage:
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300103.. code-block:: yaml
104
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +0400105 _param:
106 galera_innodb_buffer_pool_size: 1024M
107 galera_max_connections: 200
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300108
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200109
Ales Komarekcba48ac2015-04-30 11:40:44 +0200110Usage
111=====
112
113MySQL Galera check sripts
114
115.. code-block:: bash
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200116
Ales Komarekcba48ac2015-04-30 11:40:44 +0200117 mysql> SHOW STATUS LIKE 'wsrep%';
118
119 mysql> SHOW STATUS LIKE 'wsrep_cluster_size' ;"
120
121Galera monitoring command, performed from extra server
122
123.. code-block:: bash
124
125 garbd -a gcomm://ipaddrofone:4567 -g my_wsrep_cluster -l /tmp/1.out -d
126
1271. salt-call state.sls mysql
1282. Comment everything starting wsrep* (wsrep_provider, wsrep_cluster, wsrep_sst)
1293. service mysql start
1304. run on each node mysql_secure_install and filling root password.
131
132.. code-block:: bash
133
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300134 Enter current password for root (enter for none):
Ales Komarekcba48ac2015-04-30 11:40:44 +0200135 OK, successfully used password, moving on...
136
137 Setting the root password ensures that nobody can log into the MySQL
138 root user without the proper authorisation.
139
140 Set root password? [Y/n] y
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300141 New password:
142 Re-enter new password:
Ales Komarekcba48ac2015-04-30 11:40:44 +0200143 Password updated successfully!
144 Reloading privilege tables..
145 ... Success!
146
147 By default, a MySQL installation has an anonymous user, allowing anyone
148 to log into MySQL without having to have a user account created for
149 them. This is intended only for testing, and to make the installation
150 go a bit smoother. You should remove them before moving into a
151 production environment.
152
153 Remove anonymous users? [Y/n] y
154 ... Success!
155
156 Normally, root should only be allowed to connect from 'localhost'. This
157 ensures that someone cannot guess at the root password from the network.
158
159 Disallow root login remotely? [Y/n] n
160 ... skipping.
161
162 By default, MySQL comes with a database named 'test' that anyone can
163 access. This is also intended only for testing, and should be removed
164 before moving into a production environment.
165
166 Remove test database and access to it? [Y/n] y
167 - Dropping test database...
168 ... Success!
169 - Removing privileges on test database...
170 ... Success!
171
172 Reloading the privilege tables will ensure that all changes made so far
173 will take effect immediately.
174
175 Reload privilege tables now? [Y/n] y
176 ... Success!
177
178 Cleaning up...
179
1805. service mysql stop
Kirill Bespalov162a4d42017-06-21 02:26:19 +03001816. uncomment all wsrep* lines except first server, where leave only in my.cnf wsrep_cluster_address='gcomm://';
Ales Komarekcba48ac2015-04-30 11:40:44 +02001827. start first node
1838. Start third node which is connected to first one
1849. Start second node which is connected to third one
18510. After starting cluster, it must be change cluster address at first starting node without restart database and change config my.cnf.
186
187.. code-block:: bash
188
189 mysql> SET GLOBAL wsrep_cluster_address='gcomm://10.0.0.2';
190
191Read more
192=========
193
194* https://github.com/CaptTofu/ansible-galera
195* http://www.sebastien-han.fr/blog/2012/04/15/active-passive-failover-cluster-on-a-mysql-galera-cluster-with-haproxy-lsb-agent/
196* http://opentodo.net/2012/12/mysql-multi-master-replication-with-galera/
197* http://www.codership.com/wiki/doku.php
198* Best one: - http://www.sebastien-han.fr/blog/2012/04/01/mysql-multi-master-replication-with-galera/
Filip Pytloun5b356a72017-02-02 13:02:03 +0100199
200Documentation and Bugs
201======================
202
203To learn how to install and update salt-formulas, consult the documentation
204available online at:
205
206 http://salt-formulas.readthedocs.io/
207
208In the unfortunate event that bugs are discovered, they should be reported to
209the appropriate issue tracker. Use Github issue tracker for specific salt
210formula:
211
212 https://github.com/salt-formulas/salt-formula-galera/issues
213
214For feature requests, bug reports or blueprints affecting entire ecosystem,
215use Launchpad salt-formulas project:
216
217 https://launchpad.net/salt-formulas
218
219You can also join salt-formulas-users team and subscribe to mailing list:
220
221 https://launchpad.net/~salt-formulas-users
222
223Developers wishing to work on the salt-formulas projects should always base
224their work on master branch and submit pull request against specific formula.
225
226 https://github.com/salt-formulas/salt-formula-galera
227
228Any questions or feedback is always welcome so feel free to join our IRC
229channel:
230
231 #salt-formulas @ irc.freenode.net