WEB开发网
开发学院数据库MySQL MySQL备份和同步时使用LVM 阅读

MySQL备份和同步时使用LVM

 2007-02-14 10:53:23 来源:WEB开发网   
核心提示: 1) Connect to MySQL and run FLUSH TABLES WITH READ LOCKNote - this command may take a while to complete if you have long running queries. The cat

1) Connect to MySQL and run FLUSH TABLES WITH READ LOCK

Note - this command may take a while to complete if you have long running queries. The catch here is FLUSH TABLES WITH READ LOCK actually waits for all statements to complete, even selects. So be careful if you have any long running queries. If you're using only Innodb tables and do not need to synchronize binary log position with backup you can skip this step.

1) 连接到MySQL上,运行 FLUSH TABLES WITH READ LOCK

注意 -- 如果你当前正在执行一个较长时间的查询,那么这个命令可能需要较长时间才能完成。在这里 FLUSH TABLES WITH READ LOCK 需要捕获所有的语句都完成了,甚至是 SELECT。因此如果有较长时间的查询时要小心。如果你只使用到Innodb表,就无需同步二进制日志可直接略过这个步骤。

2) While holding connection open run: lvcreate -L16G -s -n dbbackup /dev/Main/Data - This will create snapshot named dbbackup for Logical Volume Main/Data . You should specify enough of undo space to hold modifications during backup process - I've specified 16GB in this case. If your undo size is not large enough snapshot will get invalidated and backup will be aborted.

2) 保持连接,运行 lvcreate -L16G -s -n dbbackup /dev/Main/Data -- 它会创建本地卷 Main/Data 的快照,命名为 dbbackup。备份过程中务必指定足够大的撤销空间用于保存发生变化的东西 -- 我指定了16GB。如果撤销空间不够大,快照就会无效并且备份就终止了。

Sometimes you might run into the errors on this step, The most common one I've resently seen is: snapshot: Required device-mapper target(s) not detected in your kernel - This means snapshot module is not loaded in your kernel by default and you need to load it, which is done by running modprobe dm-snapshot

上一页  1 2 3 4 5 6 7  下一页

Tags:MySQL 备份 同步

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接