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