blob: 0d86e0d1a05ede91d4f48f0d97869445f3250a41 [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 +030059
60Enable TLS support:
61
62.. code-block:: yaml
63
64 galera:
65 slave or master:
66 ssl:
67 enabled: True
68
69 # path
70 cert_file: /etc/mysql/ssl/cert.pem
71 key_file: /etc/mysql/ssl/key.pem
72 ca_file: /etc/mysql/ssl/ca.pem
73
74 # content (not required if files already exists)
75 key: << body of key >>
76 cert: << body of cert >>
77 cacert_chain: << body of ca certs chain >>
78
79
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +040080Configurable soft parameters
81============================
Kirill Bespalov162a4d42017-06-21 02:26:19 +030082
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +040083- **galera_innodb_buffer_pool_size** - the default value is 3138M
84- **galera_max_connections** - the default value is 20000
Kirill Bespalov162a4d42017-06-21 02:26:19 +030085
86Usage:
87
88.. code-block:: yaml
89
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +040090 _param:
91 galera_innodb_buffer_pool_size: 1024M
Kirill Bespalov5f0c1d62017-08-15 15:29:32 +030092 galera_max_connections: 200
Kirill Bespalov162a4d42017-06-21 02:26:19 +030093
Ales Komarekcba48ac2015-04-30 11:40:44 +020094Usage
95=====
96
97MySQL Galera check sripts
98
99.. code-block:: bash
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300100
Ales Komarekcba48ac2015-04-30 11:40:44 +0200101 mysql> SHOW STATUS LIKE 'wsrep%';
102
103 mysql> SHOW STATUS LIKE 'wsrep_cluster_size' ;"
104
105Galera monitoring command, performed from extra server
106
107.. code-block:: bash
108
109 garbd -a gcomm://ipaddrofone:4567 -g my_wsrep_cluster -l /tmp/1.out -d
110
1111. salt-call state.sls mysql
1122. Comment everything starting wsrep* (wsrep_provider, wsrep_cluster, wsrep_sst)
1133. service mysql start
1144. run on each node mysql_secure_install and filling root password.
115
116.. code-block:: bash
117
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300118 Enter current password for root (enter for none):
Ales Komarekcba48ac2015-04-30 11:40:44 +0200119 OK, successfully used password, moving on...
120
121 Setting the root password ensures that nobody can log into the MySQL
122 root user without the proper authorisation.
123
124 Set root password? [Y/n] y
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300125 New password:
126 Re-enter new password:
Ales Komarekcba48ac2015-04-30 11:40:44 +0200127 Password updated successfully!
128 Reloading privilege tables..
129 ... Success!
130
131 By default, a MySQL installation has an anonymous user, allowing anyone
132 to log into MySQL without having to have a user account created for
133 them. This is intended only for testing, and to make the installation
134 go a bit smoother. You should remove them before moving into a
135 production environment.
136
137 Remove anonymous users? [Y/n] y
138 ... Success!
139
140 Normally, root should only be allowed to connect from 'localhost'. This
141 ensures that someone cannot guess at the root password from the network.
142
143 Disallow root login remotely? [Y/n] n
144 ... skipping.
145
146 By default, MySQL comes with a database named 'test' that anyone can
147 access. This is also intended only for testing, and should be removed
148 before moving into a production environment.
149
150 Remove test database and access to it? [Y/n] y
151 - Dropping test database...
152 ... Success!
153 - Removing privileges on test database...
154 ... Success!
155
156 Reloading the privilege tables will ensure that all changes made so far
157 will take effect immediately.
158
159 Reload privilege tables now? [Y/n] y
160 ... Success!
161
162 Cleaning up...
163
1645. service mysql stop
Kirill Bespalov162a4d42017-06-21 02:26:19 +03001656. uncomment all wsrep* lines except first server, where leave only in my.cnf wsrep_cluster_address='gcomm://';
Ales Komarekcba48ac2015-04-30 11:40:44 +02001667. start first node
1678. Start third node which is connected to first one
1689. Start second node which is connected to third one
16910. After starting cluster, it must be change cluster address at first starting node without restart database and change config my.cnf.
170
171.. code-block:: bash
172
173 mysql> SET GLOBAL wsrep_cluster_address='gcomm://10.0.0.2';
174
175Read more
176=========
177
178* https://github.com/CaptTofu/ansible-galera
179* http://www.sebastien-han.fr/blog/2012/04/15/active-passive-failover-cluster-on-a-mysql-galera-cluster-with-haproxy-lsb-agent/
180* http://opentodo.net/2012/12/mysql-multi-master-replication-with-galera/
181* http://www.codership.com/wiki/doku.php
182* Best one: - http://www.sebastien-han.fr/blog/2012/04/01/mysql-multi-master-replication-with-galera/
Filip Pytloun5b356a72017-02-02 13:02:03 +0100183
184Documentation and Bugs
185======================
186
187To learn how to install and update salt-formulas, consult the documentation
188available online at:
189
190 http://salt-formulas.readthedocs.io/
191
192In the unfortunate event that bugs are discovered, they should be reported to
193the appropriate issue tracker. Use Github issue tracker for specific salt
194formula:
195
196 https://github.com/salt-formulas/salt-formula-galera/issues
197
198For feature requests, bug reports or blueprints affecting entire ecosystem,
199use Launchpad salt-formulas project:
200
201 https://launchpad.net/salt-formulas
202
203You can also join salt-formulas-users team and subscribe to mailing list:
204
205 https://launchpad.net/~salt-formulas-users
206
207Developers wishing to work on the salt-formulas projects should always base
208their work on master branch and submit pull request against specific formula.
209
210 https://github.com/salt-formulas/salt-formula-galera
211
212Any questions or feedback is always welcome so feel free to join our IRC
213channel:
214
215 #salt-formulas @ irc.freenode.net