blob: 609ec3d5247d5936cc91220925d7c61086e40161 [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
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +040059Configurable soft parameters
60============================
Kirill Bespalov162a4d42017-06-21 02:26:19 +030061
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +040062- **galera_innodb_buffer_pool_size** - the default value is 3138M
63- **galera_max_connections** - the default value is 20000
Kirill Bespalov162a4d42017-06-21 02:26:19 +030064
65Usage:
66
67.. code-block:: yaml
68
Dmitry Kalashnikd4e5f472017-08-09 14:28:17 +040069 _param:
70 galera_innodb_buffer_pool_size: 1024M
71 galera_max_connections: 200
Kirill Bespalov162a4d42017-06-21 02:26:19 +030072
Ales Komarekcba48ac2015-04-30 11:40:44 +020073Usage
74=====
75
76MySQL Galera check sripts
77
78.. code-block:: bash
Kirill Bespalov162a4d42017-06-21 02:26:19 +030079
Ales Komarekcba48ac2015-04-30 11:40:44 +020080 mysql> SHOW STATUS LIKE 'wsrep%';
81
82 mysql> SHOW STATUS LIKE 'wsrep_cluster_size' ;"
83
84Galera monitoring command, performed from extra server
85
86.. code-block:: bash
87
88 garbd -a gcomm://ipaddrofone:4567 -g my_wsrep_cluster -l /tmp/1.out -d
89
901. salt-call state.sls mysql
912. Comment everything starting wsrep* (wsrep_provider, wsrep_cluster, wsrep_sst)
923. service mysql start
934. run on each node mysql_secure_install and filling root password.
94
95.. code-block:: bash
96
Kirill Bespalov162a4d42017-06-21 02:26:19 +030097 Enter current password for root (enter for none):
Ales Komarekcba48ac2015-04-30 11:40:44 +020098 OK, successfully used password, moving on...
99
100 Setting the root password ensures that nobody can log into the MySQL
101 root user without the proper authorisation.
102
103 Set root password? [Y/n] y
Kirill Bespalov162a4d42017-06-21 02:26:19 +0300104 New password:
105 Re-enter new password:
Ales Komarekcba48ac2015-04-30 11:40:44 +0200106 Password updated successfully!
107 Reloading privilege tables..
108 ... Success!
109
110 By default, a MySQL installation has an anonymous user, allowing anyone
111 to log into MySQL without having to have a user account created for
112 them. This is intended only for testing, and to make the installation
113 go a bit smoother. You should remove them before moving into a
114 production environment.
115
116 Remove anonymous users? [Y/n] y
117 ... Success!
118
119 Normally, root should only be allowed to connect from 'localhost'. This
120 ensures that someone cannot guess at the root password from the network.
121
122 Disallow root login remotely? [Y/n] n
123 ... skipping.
124
125 By default, MySQL comes with a database named 'test' that anyone can
126 access. This is also intended only for testing, and should be removed
127 before moving into a production environment.
128
129 Remove test database and access to it? [Y/n] y
130 - Dropping test database...
131 ... Success!
132 - Removing privileges on test database...
133 ... Success!
134
135 Reloading the privilege tables will ensure that all changes made so far
136 will take effect immediately.
137
138 Reload privilege tables now? [Y/n] y
139 ... Success!
140
141 Cleaning up...
142
1435. service mysql stop
Kirill Bespalov162a4d42017-06-21 02:26:19 +03001446. uncomment all wsrep* lines except first server, where leave only in my.cnf wsrep_cluster_address='gcomm://';
Ales Komarekcba48ac2015-04-30 11:40:44 +02001457. start first node
1468. Start third node which is connected to first one
1479. Start second node which is connected to third one
14810. After starting cluster, it must be change cluster address at first starting node without restart database and change config my.cnf.
149
150.. code-block:: bash
151
152 mysql> SET GLOBAL wsrep_cluster_address='gcomm://10.0.0.2';
153
154Read more
155=========
156
157* https://github.com/CaptTofu/ansible-galera
158* http://www.sebastien-han.fr/blog/2012/04/15/active-passive-failover-cluster-on-a-mysql-galera-cluster-with-haproxy-lsb-agent/
159* http://opentodo.net/2012/12/mysql-multi-master-replication-with-galera/
160* http://www.codership.com/wiki/doku.php
161* Best one: - http://www.sebastien-han.fr/blog/2012/04/01/mysql-multi-master-replication-with-galera/
Filip Pytloun5b356a72017-02-02 13:02:03 +0100162
163Documentation and Bugs
164======================
165
166To learn how to install and update salt-formulas, consult the documentation
167available online at:
168
169 http://salt-formulas.readthedocs.io/
170
171In the unfortunate event that bugs are discovered, they should be reported to
172the appropriate issue tracker. Use Github issue tracker for specific salt
173formula:
174
175 https://github.com/salt-formulas/salt-formula-galera/issues
176
177For feature requests, bug reports or blueprints affecting entire ecosystem,
178use Launchpad salt-formulas project:
179
180 https://launchpad.net/salt-formulas
181
182You can also join salt-formulas-users team and subscribe to mailing list:
183
184 https://launchpad.net/~salt-formulas-users
185
186Developers wishing to work on the salt-formulas projects should always base
187their work on master branch and submit pull request against specific formula.
188
189 https://github.com/salt-formulas/salt-formula-galera
190
191Any questions or feedback is always welcome so feel free to join our IRC
192channel:
193
194 #salt-formulas @ irc.freenode.net