Académique Documents
Professionnel Documents
Culture Documents
Contents
[hide]
1
Mysql
Crash
Recove
ry
2
Overvie
w of
Recove
ry
Process
3
Details
of
Recove
ry
Process
3
.
1
1
.
C
o
n
f
i
g
u
r
e
m
y
s
q
l
t
o
s
t
a
r
Before beginning a full database recovery, check to see if the corruption may be limited to a single
mboxgroup or a single user within an mboxgroup. This type of corruption frequently lets the server run
normally for extended periods of time, with crashes occurring only when an affected user attempts to
access certain mailbox items. If this is the case, it may be possible to dump, drop and recover only the
affected entries without disrupting the database as a whole. Please see the instructions in the Mysql
Crash Recovery (alternate method) article.
Note: If you encounter any mysql errors while dumping the databases, start over by re-editing
/opt/zimbra/conf/my.cnf, incrementing the value for innodb_force_recovery by one, and
restarting mysqld. The maximum recovery level is 6. Please see MySQL's Forcing InnoDB Recovery
guide for more information.
Note: An error of "bash: /tmp/mysql.sql/$db.sql: ambiguous redirect" probably indicates your
using an apostrophe or single quote ' rather than a tick ` -- which is one the same key as the tilde
~.
Note: Do not reboot the machine, as some Operating Systems will remove all contents in the /tmp
directory during the reboot sequence, i.e. your /tmp/mysql.sql will be removed.
Note: First, use with caution - this shouldn't need to be used often. Issue came about because of
some rsync issues. Can't dump db's because of 'connection' issues at this point? One could move the
/opt/zimbra/db/data directory - mv /opt/zimbra/db/data /opt/zimbra/db/data-old and then make the db mkdir /opt/zimbra/db/data w/ ownership of zimbra:zimbra . Remove the innodb_force_recovery line
from /opt/zimbra/conf/my.cnf . Then recreate a default mysql db by running
/opt/zimbra/libexec/zmmyinit --sql_root_pw $mysql_root_password and then attempt this steps over
again to confirm you can drop them. Also note that you may have to reset the zimbra password
manually in mysql, then set it again in Zimbra with the instructions from this page:
http://wiki.zimbra.com/wiki/Resetting_LDAP_%26_MySQL_Passwords
5. Repopulate the databases with the data from the SQL dumps
Import the data from the SQL dumps. Note that we import the zimbra database first because the
mboxgroup databases depend on it
mysql zimbra < /tmp/mysql.sql/zimbra.sql
for sql in /tmp/mysql.sql/mbox*
do
mysql `basename $sql .sql` < $sql
echo -e "Updated `basename $sql .sql` \n"
done
Once you are satisfied that the databases are restored intact, start the rest of the zimbra services.
zmcontrol start
Help
/opt/zimbra/mysql/bin/mysqlcheck --defaults-file=/opt/zimbra/conf/my.cnf -S
/opt/zimbra/db/mysql.sock -A -C -s -u root --password=mypass
/opt/zimbra_2/mysql-standard-5.5.28-pc-linux-gnu-i686-glibc23/bin/mysqldump
--defaults-file=/opt/zimbra/conf/my.cnf -S /opt/zimbra/db/mysql.sock
-u root --password=__RbC5aZmURqMyJBRlcGg_JfS
mboxgroup63
/opt/zimbra/mysql/bin/mysqlcheck --defaults-file=/opt/zimbra/conf/my.cnf -S
/opt/zimbra/db/mysql.sock -A -C -s -u root --password=__RbC5aZmURqMyJBRlcGg_JfS --repair
--databases mboxgroup63
/opt/zimbra/mysql/bin/mysqldump --defaults-file=/opt/zimbra/conf/my.cnf -S
/opt/zimbra/db/mysql.sock --databases mboxgroup63 -u root
--password=__RbC5aZmURqMyJBRlcGg_JfS > /tmp/zimbra_mboxgroup63_dump.sql
/opt/zimbra/mysql/bin/mysqldump --defaults-file=/opt/zimbra/conf/my.cnf -S
/opt/zimbra/db/mysql.sock --all-databases -u root --password=__RbC5aZmURqMyJBRlcGg_JfS >
/tmp/zimbra_dump_20140122213535_dump.sql
cat /tmp/zimbra_mboxgroup63_dump.sql
/opt/zimbra/mysql/bin/mysqlcheck --defaults-file=/opt/zimbra/conf/my.cnf -S
/opt/zimbra/db/mysql.sock -u root --password=__RbC5aZmURqMyJBRlcGg_JfS --repair --databases
mboxgroup63
mysql -u root --password=__RbC5aZmURqMyJBRlcGg_JfS -e "drop database mboxgroup63"
mysql -u root --password=__RbC5aZmURqMyJBRlcGg_JfS < /tmp/zimbra_mboxgroup63_dump.sql
@/tmp/zimbra_mboxgroup63_dump.sql
drop database mboxgroup63;