Mysql Crash Recovery: Difference between revisions
No edit summary |
(Moving content from misspelled title page to correctly spelled title page) |
||
Line 1: | Line 1: | ||
''' | '''Mysql Crash Recovery''' | ||
BUG "http://bugzilla.zimbra.com/show_bug.cgi?id=15797" | |||
Mysql Crash recovery is performed when Mysql stops responding and there is error in the /opt/zimbra/db/data/hostname.err [Please check the BUG above for more information] | |||
Steps to perform Recovery: | |||
* Edit /opt/zimbra/conf/my.cnf: Put an entry :- '''innodb_force_recovery = 3''' | |||
* Dump the database:- mysqldump zimbra and mboxgroup DB's | |||
* Drop all Database's. | |||
* Create all Database's. | |||
* Restore dump data. | |||
1) Edit the my.cnf file and put '''innodb_force_recovery = 3''' : save the file and start mysql. [mysql.server start] | |||
2) mysql -NB -e "show databases" | grep mbox > /tmp/mysql.db.list [Make a list of the existing database] | |||
3) mkdir /tmp/mysql.sql | |||
4) mysqldump zimbra -S /opt/zimbra/db/mysql.sock -u root -p AOJTGukheoAar080cauxqOyVt0khuUI > /tmp/mysql.sql/zimbra.sql | |||
["AOJTGukheoAar080cauxqOyVt0khuUI" is the '''Mysql Root Password'''] | |||
5) Dumping Databases: Run the following command from the prompt: | |||
for db in `< /tmp/mysql.db.list`; \do /opt/zimbra/mysql/bin/mysqldump $db -S /opt/zimbra/db/mysql.sock -u zimbra -ppvbaAlDCHQ8UtMcY2oqNo91kyyqdX0 > | |||
/tmp/mysql.sql/$db.sql; \echo -e "Dumped $db\n"; \done; | |||
["-ppvbaAlDCHQ8UtMcY2oqNo91kyyqdX0" is the '''Mysql Zimbra Password'''] | |||
6) Drp the Database: | |||
for db in `< /tmp/mysql.db.list`; \ do mysql -e "drop database $db"; \echo -e "Dropped $db"; \done; | |||
7) mysql -e "drop database zimbra" | |||
8) Run Mysql in Non-Recovery Mode: | |||
Remove the '''innodb_force_recovery = 3''' from the my.cnf file. | |||
Stop Mysql Server and Start again. | |||
9) Create Database: | |||
mysql -e "create database zimbra character set utf8" | |||
10) Create the existed Database: | |||
for db in `< /tmp/mysql.db.list`; \ do mysql -e "create database $db character set utf8"; \ | |||
echo -e "Created $db \n";done; | |||
11) mysql zimbra < /tmp/mysql.sql/zimbra.sql | |||
12) Update Mboxgroup: | |||
for sql in /tmp/mysql.sql/mbox*; \ do mysql `basename $sql .sql` < $sql; \echo -e "Updated `basename $sql .sql` \n"; \done; | |||
13) zmcontrol start | |||
14) Check if everything is up and running. | |||
{{Article Footer|Zimbra Collaboration Suite 4.5.6|8/13/2007}} | |||
[[Category:MySQL]] | |||
[[Category:Troubleshooting]] |
Revision as of 20:37, 13 August 2007
Mysql Crash Recovery
BUG "http://bugzilla.zimbra.com/show_bug.cgi?id=15797"
Mysql Crash recovery is performed when Mysql stops responding and there is error in the /opt/zimbra/db/data/hostname.err [Please check the BUG above for more information]
Steps to perform Recovery:
- Edit /opt/zimbra/conf/my.cnf: Put an entry :- innodb_force_recovery = 3
- Dump the database:- mysqldump zimbra and mboxgroup DB's
- Drop all Database's.
- Create all Database's.
- Restore dump data.
1) Edit the my.cnf file and put innodb_force_recovery = 3 : save the file and start mysql. [mysql.server start]
2) mysql -NB -e "show databases" | grep mbox > /tmp/mysql.db.list [Make a list of the existing database]
3) mkdir /tmp/mysql.sql
4) mysqldump zimbra -S /opt/zimbra/db/mysql.sock -u root -p AOJTGukheoAar080cauxqOyVt0khuUI > /tmp/mysql.sql/zimbra.sql
["AOJTGukheoAar080cauxqOyVt0khuUI" is the Mysql Root Password]
5) Dumping Databases: Run the following command from the prompt:
for db in `< /tmp/mysql.db.list`; \do /opt/zimbra/mysql/bin/mysqldump $db -S /opt/zimbra/db/mysql.sock -u zimbra -ppvbaAlDCHQ8UtMcY2oqNo91kyyqdX0 >
/tmp/mysql.sql/$db.sql; \echo -e "Dumped $db\n"; \done;
["-ppvbaAlDCHQ8UtMcY2oqNo91kyyqdX0" is the Mysql Zimbra Password]
6) Drp the Database:
for db in `< /tmp/mysql.db.list`; \ do mysql -e "drop database $db"; \echo -e "Dropped $db"; \done;
7) mysql -e "drop database zimbra"
8) Run Mysql in Non-Recovery Mode:
Remove the innodb_force_recovery = 3 from the my.cnf file.
Stop Mysql Server and Start again.
9) Create Database:
mysql -e "create database zimbra character set utf8"
10) Create the existed Database:
for db in `< /tmp/mysql.db.list`; \ do mysql -e "create database $db character set utf8"; \
echo -e "Created $db \n";done;
11) mysql zimbra < /tmp/mysql.sql/zimbra.sql
12) Update Mboxgroup:
for sql in /tmp/mysql.sql/mbox*; \ do mysql `basename $sql .sql` < $sql; \echo -e "Updated `basename $sql .sql` \n"; \done;
13) zmcontrol start
14) Check if everything is up and running.