• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

INFO_SRCH A D10-Feb-2022173 96

INSTALL-BINARYH A D10-Feb-20228.6 KiB195162

README-wsrepH A D10-Feb-202219.1 KiB486355

mysql.infoH A D10-Feb-2022364 128

README-wsrep

1Codership Oy
2http://www.codership.com
3<info@codership.com>
4
5DISCLAIMER
6
7THIS SOFTWARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
8EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
9OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10IN NO EVENT SHALL CODERSHIP OY BE HELD LIABLE TO ANY PARTY FOR ANY DAMAGES
11RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE.
12
13Trademark Information.
14
15MySQL is a trademark or registered trademark of Oracle and/or its affiliates.
16Other trademarks are the property of their respective owners.
17
18Licensing Information.
19
20Please see file COPYING that came with this distribution
21
22Source code can be found at
23wsrep API:    https://launchpad.net/wsrep
24MySQL patch:  https://launchpad.net/codership-mysql
25
26
27ABOUT THIS DOCUMENT
28
29This document covers installation and configuration issues specific to this
30wsrep-patched MySQL distribution by Codership. It does not cover the use or
31administration of MySQL server per se. The reader is assumed to know how to
32install, configure, administer and use standard MySQL server version 5.1.xx.
33
34
35                        MYSQL-5.5.x/wsrep-23.x
36
37CONTENTS:
38=========
391. WHAT IS WSREP PATCH FOR MYSQL
402. INSTALLATION
413. FIRST TIME SETUP
42   3.1 CONFIGURATION FILES
43   3.2 DATABASE PRIVILEGES
44   3.3 CHECK AND CORRECT FIREWALL SETTINGS
45   3.4 SELINUX
46   3.5 APPARMOR
47   3.6 CONNECT TO CLUSTER
484. UPGRADING FROM MySQL 5.1.x
495. CONFIGURATION OPTIONS
50   5.1 MANDATORY MYSQL OPTIONS
51   5.2 WSREP OPTIONS
526. ONLINE SCHEMA UPGRADE
53   6.1 TOTAL ORDER ISOLATION (TOI)
54   6.2 ROLLING SCHEMA UPGRADE (RSU)
557. LIMITATIONS
56
57
581. WHAT IS WSREP PATCH FOR MYSQL/INNODB
59
60Wsrep API developed by Codership Oy is a modern generic (database-agnostic)
61replication API for transactional databases with a goal to make database
62replication/logging subsystem completely modular and pluggable. It is developed
63with flexibility and completeness in mind to satisfy a broad range of modern
64replication scenarios. It is equally suitable for synchronous and asynchronous,
65master-slave and multi-master replication.
66
67wsrep stands for Write Set REPlication.
68
69Wsrep patch for MySQL/InnoDB allows MySQL server to load and use various wsrep
70API implementations ("wsrep providers") with different qualities of service.
71Without wsrep provider MySQL-wsrep server will function like a regular
72standalone server.
73
74
752. INSTALLATION
76
77In the examples below mysql authentication options are omitted for brevity.
78
792.1 Download and install mysql-wsrep package.
80
81Download binary package for your Linux distribution from
82https://launchpad.net/codership-mysql/
83
842.1.1 On Debian and Debian-derived distributions.
85
86Upgrade from mysql-server-5.0 to mysql-wsrep is not supported yet, please
87upgrade to mysql-server-5.1 first.
88
89If you're installing over an existing mysql installation, mysql-server-wsrep
90will conflict with the mysql-server-5.1 package, so remove it first:
91
92$ sudo apt-get remove mysql-server-5.1 mysql-server-core-5.1
93
94mysql-server-wsrep requires psmisc and mysql-client-5.1.47 (or later).
95MySQL 5.1 packages can be found from backports repositories.
96For further information about configuring and using Debian or Ubuntu
97backports, see:
98
99* http://backports.debian.org
100
101* https://help.ubuntu.com/community/UbuntuBackports
102
103For example, installation of required packages on Debian Lenny:
104
105$ sudo apt-get install psmisc
106$ sudo apt-get -t lenny-backports install mysql-client-5.1
107
108Now you should be able to install the mysql-wsrep package:
109
110$ sudo dpkg -i <mysql-server-wsrep DEB>
111
1122.1.2 On CentOS and similar RPM-based distributions.
113
114If you're migrating from existing MySQL installation, there are two variants:
115
116  a) If you're already using official MySQL-server-community 5.1.x RPM from
117     Oracle:
118
119     # rpm -e mysql-server
120
121  b) If you're upgrading from the stock mysql-5.0.77 on CentOS:
122
123     1) Make sure that the following packages are not installed:
124     # rpm --nodeps --allmatches -e mysql-server mysql-test mysql-bench
125
126     2) Install *official* MySQL-shared-compat-5.1.x from
127        http://dev.mysql.com/downloads/mysql/5.1.html
128
129Actual installation:
130
131   # rpm -Uvh <MySQL-server-wsrep RPM>
132
133   If this fails due to unsatisfied dependencies, install missing packages
134   (e.g. yum install perl-DBI) and retry.
135
136Additional packages to consider (if not yet installed):
137   * galera (multi-master replication provider, https://launchpad.net/galera)
138   * MySQL-client-community (for connecting to server and mysqldump-based SST)
139   * rsync (for rsync-based SST)
140   * mariabackup and nc (for mariabackup-based SST)
141
1422.2 Upgrade system tables.
143
144If you're upgrading a previous MySQL installation, it might be advisable to
145upgrade system tables. To do that start mysqld and run mysql_upgrade command.
146Consult MySQL documentation in case of errors. Normally they are not critical
147and can be ignored unless specific functionality is needed.
148
149
1503. FIRST TIME SETUP
151
152Unless you're upgrading an already installed mysql-wsrep package, you will need
153to set up a few things to prepare the server for operation.
154
1553.1 CONFIGURATION FILES
156
157* Make sure system-wide my.cnf does not bind mysqld to 127.0.0.1. That is, if
158  you have the following line in [mysqld] section, comment it out:
159
160  #bind-address = 127.0.0.1
161
162* Make sure system-wide my.cnf contains "!includedir /etc/mysql/conf.d/" line.
163
164* Edit /etc/mysql/conf.d/wsrep.cnf and set wsrep_provider option by specifying
165  a path to the provider library. If you don't have a provider, leave it as it is.
166
167* When a new node joins the cluster it'll have to receive a state snapshot from
168  one of the peers. This requires a privileged MySQL account with access from
169  the rest of the cluster. Edit /etc/mysql/conf.d/wsrep.cnf and set mysql
170  login/password pair for SST, for example:
171
172  wsrep_sst_auth=wsrep_sst:wspass
173
174* See CONFIGURATION section below about other configuration parameters that you
175  might want to change at this point.
176
1773.2 DATABASE PRIVILEGES
178
179Restart MySQL server and connect to it as root to grant privileges to SST
180account (empty users confuse MySQL authentication matching rules, we need to
181delete them too):
182
183$ mysql -e "SET wsrep_on=OFF; DELETE FROM mysql.user WHERE user='';"
184$ mysql -e "SET wsrep_on=OFF; GRANT ALL ON *.* TO wsrep_sst@'%' IDENTIFIED BY 'wspass'";
185
1863.3 CHECK AND CORRECT FIREWALL SETTINGS.
187
188MySQL-wsrep server needs to be accessible from other cluster members through
189its client listening socket and through wsrep provider socket. See your
190distribution and wsrep provider documentation for details. For example on
191CentOS you might need to do something along these lines:
192
193# iptables --insert RH-Firewall-1-INPUT 1 --proto tcp --source <my IP>/24 --destination <my IP>/32 --dport 3306 -j ACCEPT
194# iptables --insert RH-Firewall-1-INPUT 1 --proto tcp --source <my IP>/24 --destination <my IP>/32 --dport 4567 -j ACCEPT
195
196If there is a NAT firewall between the nodes, it must be configured to allow
197direct connections between the nodes (e.g. via port forwarding).
198
1993.4 SELINUX
200
201If you have SELinux enabled, it may block mysqld from doing required operations.
202You'll need to either disable it or configure to allow mysqld to run external
203programs and open listen sockets at unprivileged ports (i.e. things that
204an unprivileged user can do). See SELinux documentation about it.
205
206To quickly disable SELinux:
2071) run 'setenforce 0' as root.
2082) set 'SELINUX=permissive' in  /etc/selinux/config
209
2103.5 APPARMOR
211
212AppArmor automatically comes with Ubuntu and may also prevent mysqld to from
213opening additional ports or run scripts. See AppArmor documentation about its
214configuration. To disable AppArmor for mysqld:
215
216$ cd /etc/apparmor.d/disable/
217$ sudo ln -s /etc/apparmor.d/usr.sbin.mysqld
218$ sudo service apparmor restart
219
220
2213.6 CONNECT TO CLUSTER
222
223Now you're ready to connect to cluster by setting wsrep_cluster_address variable
224and monitor status of wsrep provider:
225
226mysql> SET GLOBAL wsrep_cluster_address='<cluster address string>';
227mysql> SHOW STATUS LIKE 'wsrep%';
228
229
2304 UPGRADING FROM MySQL 5.1.x
231
232!!! THESE INSTRUCTIONS ARE PRELIMINARY AND INCOMPLETE !!!
233
2341) BEFORE UPGRADE (while running 5.1.x):
235   - comment out 'wsrep_provider' setting from configuration files
236     (my.cnf and/or wsrep.cnf)
237   - If performing a rolling upgrade on a running cluster, set
238     wsrep_sst_method=mysqldump.
239     You might also need to configure wsrep_sst_receive_address and
240     wsrep_sst_auth appropriately. mysqldump is the only way to transfer data
241     from 5.1.x to 5.5.x reliably.
242   - remove innodb_plugin settings from configuration files.
243
2442) Perform upgrade as usual:
245   http://dev.mysql.com/doc/refman/5.5/en/upgrading-from-previous-series.html
246   Don't forget to run 'mysql_upgrade' command.
247
2483) AFTER UPGRADING individual node:
249   - uncomment 'wsrep_provider' line in configuration file.
250   - restart the server and join the cluster.
251
2524) AFTER UPGRADING the whole cluster:
253   - revert to usual wsrep SST settings if not 'mysqldump'.
254
255
2565. CONFIGURATION OPTIONS
257
2585.1 MANDATORY MYSQL OPTIONS
259
260binlog_format=ROW
261   This option is required to use row-level replication as opposed to
262   statement-level. For performance and consistency considerations don't change
263   that. As a side effect, binlog, if turned on, can be ROW only. In future this
264   option won't have special meaning.
265
266innodb_autoinc_lock_mode=2
267   This is a required parameter. Without it INSERTs into tables with
268   AUTO_INCREMENT column may fail.
269   autoinc lock modes 0 and 1 can cause unresolved deadlock, and make
270   the system unresponsive.
271
2725.2 WSREP OPTIONS
273
274All options are optional except for wsrep_provider, wsrep_cluster_address, and
275wsrep_sst_auth.
276
277wsrep_provider=none
278   A full path to the library that implements WSREP interface. If none is
279   specified, the server behaves like a regular mysqld.
280
281wsrep_provider_options=
282   Provider-specific option string. Check wsrep provider documentation or
283   http://www.codership.com/wiki
284
285wsrep_cluster_address=
286   Provider-specific cluster address string. This is used to connect a node to
287   the desired cluster. This option can be given either on mysqld startup or set
288   during runtime. See wsrep provider documentation for possible values.
289
290wsrep_cluster_name="my_wsrep_cluster"
291   Logical cluster name, must be the same for all nodes of the cluster.
292
293wsrep_node_address=
294   An option to explicitly specify the network address of the node in the form
295   <address>[:port] if autoguessing for some reason does not produce desirable
296   results (multiple network interfaces, NAT, etc.)
297   If not explicitly overridden by wsrep_sst_receive_address, the <address> part
298   will be used to listen for SST (see below). And the whole <address>[:port]
299   will be passed to the wsrep provider to be used as a base address in its
300   communications.
301
302wsrep_node_name=
303   Human readable node name (for easier log reading only). Defaults to hostname.
304
305wsrep_slave_threads=1
306   The number of threads dedicated to the processing of writesets from other nodes.
307   For best performance should be few per CPU core.
308
309wsrep_dbug_option
310   Options for the built-in DBUG library (independent from what MySQL uses).
311   Empty by default. Not currently in use.
312
313wsrep_debug=0
314   Enable debug-level logging.
315
316wsrep_convert_LOCK_to_trx=0
317   Implicitly convert locking sessions into transactions inside mysqld. By
318   itself it does not mean support for locking sessions, but it prevents the
319   database from going into logically inconsistent state. Note however, that
320   loading large database dump with LOCK statements might result in abnormally
321   large transactions and cause an out-of-memory condition
322
323wsrep_retry_autocommit=1
324   Retry autocommit queries and single statement transactions should they fail
325   certification test. This is analogous to rescheduling an autocommit query
326   should it go into a deadlock with other transactions in the database lock
327   manager.
328
329wsrep_auto_increment_control=1
330   Automatically adjust auto_increment_increment and auto_increment_offset
331   variables based on the number of nodes in the cluster. Significantly reduces
332   certification conflict rate for INSERTS.
333
334wsrep_drupal_282555_workaround=1
335   MySQL seems to have an obscure bug when INSERT into table with
336   AUTO_INCREMENT column with NULL value for that column can fail with a
337   duplicate key error. When this option is on, it retries such INSERTs.
338   Required for stable Drupal operation. Documented at:
339      http://bugs.mysql.com/bug.php?id=41984
340      http://drupal.org/node/282555
341
342wsrep_causal_reads=0
343   Enforce strict READ COMMITTED semantics on reads and transactions. May
344   result in additional latencies. It is a session variable.
345
346wsrep_OSU_method=TOI
347   Online Schema Upgrade (OSU) can be performed with two alternative  methods:
348   Total Order Isolation (TOI) runs DDL statement in all cluster nodes in
349   same total order sequence locking the affected table for the duration of the
350   operation. This may result in the whole cluster being blocked for the
351   duration of the operation.
352   Rolling Schema Upgrade (RSU) executes the DDL statement only locally, thus
353   blocking only one cluster node. During the DDL processing, the node
354   is not replicating and may be unable to process replication events (due to
355   table lock). Once DDL operation is complete, the node will catch up and sync
356   with the cluster to become fully operational again. The DDL statement or
357   its effects are not replicated, so it is the user's responsibility to manually
358   perform this operation on each of the nodes.
359
360wsrep_forced_binlog_format=none
361   Force every transaction to use given binlog format. When this variable is
362   set to something else than NONE, all transactions will use the given forced
363   format, regardless of what the client session has specified in binlog_format.
364   Valid choices for wsrep_forced_binlog_format are: ROW, STATEMENT, MIXED and
365   special value NONE, meaning that there is no forced binlog format in effect.
366   This variable was introduced to support STATEMENT format replication during
367   rolling schema upgrade processing. However, in most cases ROW replication
368   is valid for asymmetrict schema replication.
369
370State snapshot transfer options.
371
372When a new node joins the cluster it has to synchronize its initial state with
373the other cluster members by transferring state snapshot from one of them.
374The options below govern how this happens and should be set up before attempting
375to join or start a cluster.
376
377wsrep_sst_method=rsync
378   What method to use to copy database state to a newly joined node. Supported
379   methods:
380   - mysqldump:   slow (except for small datasets) but allows for upgrade
381                  between major MySQL versions or InnoDB features.
382   - rsync:       much faster on large datasets (default).
383   - rsync_wan:   same as rsync but with deltaxfer to minimize network traffic.
384   - mariabackup: very fast and practically non-blocking SST method based on
385                  mariabackup tool (enhanced version of Percona's xtrabackup).
386
387   (for mariabackup to work the following settings must be present in my.cnf
388    on all nodes:
389      [mysqld]
390      wsrep_sst_auth=root:<root password>
391      datadir=<path to data dir>
392      [client]
393      socket=<path to socket>
394   )
395
396wsrep_sst_receive_address=
397   Address (hostname:port) at which this node wants to receive state snapshot.
398   Defaults to mysqld bind address, and if that is not specified (0.0.0.0) -
399   to the first IP of eth0 + mysqld bind port.
400   NOTE: check that your firewall allows connections to this address from other
401         cluster nodes.
402
403wsrep_sst_auth=
404   Authentication information needed for state transfer. Depends on the state
405   transfer method. For mysqldump-based SST it is
406   <mysql_root_user>:<mysql_root_password>
407   and should be the same on all nodes - it is used to authenticate with both
408   state snapshot receiver and state snapshot donor.
409
410wsrep_sst_donor=
411   A name of the node which should serve as state snapshot donor. This allows
412   controlling which node will serve the state snapshot request. By default the
413   most suitable node is chosen by the wsrep provider. This is the same as given in
414   wsrep_node_name.
415
416
4176. ONLINE SCHEMA UPGRADE
418
419   Schema upgrades mean any data definition statements (DDL statemnents) run
420   for the database. They change the database structure and are non-
421   transactional.
422
423   Release 22.3 brings a new method for performing schema upgrades. A user can
424   now choose whether to use the traditional total order isolation or new
425   rolling schema upgrade method. The OSU method choice is done by global
426   parameter: 'wsrep_OSU_method'.
427
4286.1 Total Order Isolation (TOI)
429
430   With earlier releases, DDL processing happened always by Total Order
431   Isolation (TOI) method. With TOI, the DDL was scheduled to be processed in
432   same transaction seqeuncing 'slot' in each cluster node.
433   The processing is secured by locking the affected table from any other use.
434   With TOI method, the whole cluster has part of the database locked for the
435   duration of the DDL processing.
436
4376.2 Rolling Schema Upgrade (RSU)
438
439   Rolling schema upgrade is a new DDL processing method, where DDL will be
440   processed locally for the node. The node is disconnected of the replication
441   for the duration of the DDL processing, so that there is only DDL statement
442   processing in the node and it does not block the rest of the cluster. When
443   the DDL processing is complete, the node applies delayed replication events
444   and synchronizes back with the cluster.
445   The DDL can then be executed cluster-wide by running the same DDL statement
446   for each node in turn. When this rolling schema upgrade proceeds, part of
447   the cluster will have old schema structure and part of the cluster will have
448   new schema structure.
449
450
4517. LIMITATIONS
452
4531) Currently replication works only with InnoDB storage engine. Any writes to
454   tables of other types, including system (mysql.*) tables are not replicated.
455   However, DDL statements are replicated in statement level, and changes
456   to mysql.* tables will get replicated that way.
457   So, you can safely issue: CREATE USER...,
458   but issuing: INSERT INTO mysql.user..., will not be replicated.
459
4602) DELETE operation is unsupported on tables without primary key. Also rows in
461   tables without primary key may appear in different order on different nodes.
462   As a result SELECT...LIMIT... may return slightly different sets.
463
4643) Unsupported queries:
465    * LOCK/UNLOCK TABLES cannot be supported in multi-master setups.
466    * lock functions (GET_LOCK(), RELEASE_LOCK()... )
467
4684) Query log cannot be directed to a table. If you enable query logging,
469   you must forward the log to a file:
470       log_output = FILE
471   Use general_log and general_log_file to choose query logging and the
472   log file name
473
4745) Maximum allowed transaction size is defined by wsrep_max_ws_rows and
475   wsrep_max_ws_size. Anything bigger (e.g. huge LOAD DATA) will be rejected.
476
4776) Due to cluster level optimistic concurrency control, transaction issuing
478   COMMIT may still be aborted at that stage. There can be two transactions.
479   writing to same rows and committing in separate cluster nodes, and only one
480   of them can successfully commit. The failing one will be aborted.
481   For cluster level aborts, MySQL/galera cluster gives back deadlock error.
482   code (Error: 1213 SQLSTATE: 40001  (ER_LOCK_DEADLOCK)).
483
4847) XA transactions can not be supported due to possible rollback on commit.
485
486