blob: a378905544424529dc55a5441680b1c74c30b5bf [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:
83
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
95
Ales Komarekcba48ac2015-04-30 11:40:44 +020096Usage
97=====
98
99MySQL Galera check sripts
100
101.. code-block:: bash
Petr Michalec89c8c3f2017-05-22 17:19:22 +0200102
Ales Komarekcba48ac2015-04-30 11:40:44 +0200103 mysql> SHOW STATUS LIKE 'wsrep%';
104
105 mysql> SHOW STATUS LIKE 'wsrep_cluster_size' ;"
106
107Galera monitoring command, performed from extra server
108
109.. code-block:: bash
110
111 garbd -a gcomm://ipaddrofone:4567 -g my_wsrep_cluster -l /tmp/1.out -d
112
1131. salt-call state.sls mysql
1142. Comment everything starting wsrep* (wsrep_provider, wsrep_cluster, wsrep_sst)
1153. service mysql start
1164. run on each node mysql_secure_install and filling root password.
117
118.. code-block:: bash
119
120 Enter current password for root (enter for none):
121 OK, successfully used password, moving on...
122
123 Setting the root password ensures that nobody can log into the MySQL
124 root user without the proper authorisation.
125
126 Set root password? [Y/n] y
127 New password:
128 Re-enter new password:
129 Password updated successfully!
130 Reloading privilege tables..
131 ... Success!
132
133 By default, a MySQL installation has an anonymous user, allowing anyone
134 to log into MySQL without having to have a user account created for
135 them. This is intended only for testing, and to make the installation
136 go a bit smoother. You should remove them before moving into a
137 production environment.
138
139 Remove anonymous users? [Y/n] y
140 ... Success!
141
142 Normally, root should only be allowed to connect from 'localhost'. This
143 ensures that someone cannot guess at the root password from the network.
144
145 Disallow root login remotely? [Y/n] n
146 ... skipping.
147
148 By default, MySQL comes with a database named 'test' that anyone can
149 access. This is also intended only for testing, and should be removed
150 before moving into a production environment.
151
152 Remove test database and access to it? [Y/n] y
153 - Dropping test database...
154 ... Success!
155 - Removing privileges on test database...
156 ... Success!
157
158 Reloading the privilege tables will ensure that all changes made so far
159 will take effect immediately.
160
161 Reload privilege tables now? [Y/n] y
162 ... Success!
163
164 Cleaning up...
165
1665. service mysql stop
1676. uncomment all wsrep* lines except first server, where leave only in my.cnf wsrep_cluster_address='gcomm://';
1687. start first node
1698. Start third node which is connected to first one
1709. Start second node which is connected to third one
17110. After starting cluster, it must be change cluster address at first starting node without restart database and change config my.cnf.
172
173.. code-block:: bash
174
175 mysql> SET GLOBAL wsrep_cluster_address='gcomm://10.0.0.2';
176
177Read more
178=========
179
180* https://github.com/CaptTofu/ansible-galera
181* http://www.sebastien-han.fr/blog/2012/04/15/active-passive-failover-cluster-on-a-mysql-galera-cluster-with-haproxy-lsb-agent/
182* http://opentodo.net/2012/12/mysql-multi-master-replication-with-galera/
183* http://www.codership.com/wiki/doku.php
184* Best one: - http://www.sebastien-han.fr/blog/2012/04/01/mysql-multi-master-replication-with-galera/
Filip Pytloun5b356a72017-02-02 13:02:03 +0100185
186Documentation and Bugs
187======================
188
189To learn how to install and update salt-formulas, consult the documentation
190available online at:
191
192 http://salt-formulas.readthedocs.io/
193
194In the unfortunate event that bugs are discovered, they should be reported to
195the appropriate issue tracker. Use Github issue tracker for specific salt
196formula:
197
198 https://github.com/salt-formulas/salt-formula-galera/issues
199
200For feature requests, bug reports or blueprints affecting entire ecosystem,
201use Launchpad salt-formulas project:
202
203 https://launchpad.net/salt-formulas
204
205You can also join salt-formulas-users team and subscribe to mailing list:
206
207 https://launchpad.net/~salt-formulas-users
208
209Developers wishing to work on the salt-formulas projects should always base
210their work on master branch and submit pull request against specific formula.
211
212 https://github.com/salt-formulas/salt-formula-galera
213
214Any questions or feedback is always welcome so feel free to join our IRC
215channel:
216
217 #salt-formulas @ irc.freenode.net