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