Galera Cluster is a popular choice for achieving high availability using synchronous replication. Though if you are planning to run huge sites with many DB objects (tables), a few tweaks are necessary.
Yes, you might have been successful in loading your 1000s of databases and 1000s of tables, but what happens if you have a node failure and Galera recovery fails?
In this blog post we will show you how to determine one common error related to the open_files_limit that MySQL imposes, and also to spot another potential pitfall.
Open_files_limit
If you are using wsrep_sst_method=xtrabackup or wsrep_sst_method=xtrabackup-v2 then you will find a log file in the data directory of the donor node. This log file is called innobackup.backup.log.
140912 19:10:15 innobackupex: Done. IMPORTANT: Please check that the backup run completes successfully. At the end of a successful backup run innobackupex prints "completed OK!". innobackupex: Using mysql server version 5.6.16 ... innobackupex: Created backup directory /tmp ... 140912 19:10:16 innobackupex: Starting ibbackup with command: xtrabackup --defaults-file="/etc/mysql/my.cnf" --defaults-group="mysqld" --backup --suspend-at-end --target-dir=/tmp --tmpdir=/tmp --extra-lsndir='/tmp' --stream=tar innobackupex: Waiting for ibbackup (pid=4274) to suspend innobackupex: Suspend file '/tmp/xtrabackup_suspended_2' ... xtrabackup: open files limit requested 65535, set to 65535 ... >> log scanned up to (2145319596) >> log scanned up to (2145319596) 2014-09-12 19:24:09 7f5d2080a740 InnoDB: Operating system error number 24 in a file operation. InnoDB: Error number 24 means 'Too many open files'. InnoDB: Some operating system error numbers are described at InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html InnoDB: Error: could not open single-table tablespace file ./db_2760/t_0.ibd
In this case the DONOR failed because of the error:
2014-09-12 19:24:09 7f5d2080a740 InnoDB: Operating system error number 24 in a file operation
At this point you have to increase the open_files_limit in your my.cnf file. Unfortunately, open_files_limit is not a global variable, and you must restart the MySQL server in order for the change to be effective.