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