Tim Smith
2006-06-18 22:01:59 UTC
Given a database with MyISAM tables, that one does not want to take offline
for more than is absolutely necessary, what's the quickest (in terms of
offline time) way to convert those tables to InnoDB?
The database I'm contemplating doing this on takes about 6 hours to load
into InnoDB tables from a mysqldump dump.
Is there anything faster/better than this method?
1. Get a snapshot of the database with mysqldump. Note the position in the
binary logs.
2. For each table foo, create an InnoDB table, new_foo, and restore new_foo
from the snapshot of foo.
3. Stop clients from accessing the database (either by unplugging the
network connection, or by restarting mysql on a port other then 3306).
4. For each table foo, rename foo to old_foo, and new_foo to foo.
5. Use mysqlbinlog to play back the binary logs from the time of step #1.
6. Plug the network cable back in, or restart mysql on the normal port
(depending on what was done in #3).
7. Drop old_foo, for each table foo.
Total unavailable time this way is about 10 minutes to get the snapshot, and
another few minutes to swap the tables and play back the logs, which beats
the heck out of 6 hours. Is there something even faster, or easier without
being much longer?
for more than is absolutely necessary, what's the quickest (in terms of
offline time) way to convert those tables to InnoDB?
The database I'm contemplating doing this on takes about 6 hours to load
into InnoDB tables from a mysqldump dump.
Is there anything faster/better than this method?
1. Get a snapshot of the database with mysqldump. Note the position in the
binary logs.
2. For each table foo, create an InnoDB table, new_foo, and restore new_foo
from the snapshot of foo.
3. Stop clients from accessing the database (either by unplugging the
network connection, or by restarting mysql on a port other then 3306).
4. For each table foo, rename foo to old_foo, and new_foo to foo.
5. Use mysqlbinlog to play back the binary logs from the time of step #1.
6. Plug the network cable back in, or restart mysql on the normal port
(depending on what was done in #3).
7. Drop old_foo, for each table foo.
Total unavailable time this way is about 10 minutes to get the snapshot, and
another few minutes to swap the tables and play back the logs, which beats
the heck out of 6 hours. Is there something even faster, or easier without
being much longer?
--
--Tim Smith
--Tim Smith