mysqldump 运行极其缓慢

mysqldump 运行极其缓慢

我把这个发布在 stackoverflow 上但它被正确地移动了(对于重复表示歉意!)

我正在运行 esx5.5 的 dell m820s 上测试一组新的数据库服务器,其中 debian wheezy 使用 ext4 作为每台服务器上的 VM。每台服务器在 raid 10 配置中都有 4 x 400gb SSD(虚拟机存储在本地 raid 10 磁盘上)

我们主数据库的总数据库大小为 47953 MB(innodb 引擎)。

我们使用 mysqldump 脚本在当前物理服务器(使用 debian lenny 和 ext3 并使用 LVM 的较低规格)上进行备份,在同一个数据库上,此转储到本地 nfs 存储大约需要 15 分钟。

以下是备份脚本的 mysqldump 部分供您查看:

mysqldump --opt --triggers --events --routines

在新服务器上,相同的备份到相同的 nfs 存储大约需要 45 分钟(两个服务器在本地写入时产生相同的结果)

我们尝试了以下方法来加快该过程(均未提高转储速度):

mysqldump --quick and --single-transction

减少了 innodb_log_file_size(这是不同的变量之一,所以我认为这可能是导致的原因)

我们已经要求我们的托管公司检查 RAID 和磁盘一致性,以防万一,我仍在等待结果。

这是当前/新服务器的 cnf:

当前的:

[mysqld]
federated
innodb_buffer_pool_size=40G
innodb_log_file_size=256M
innodb_log_buffer_size=6M
innodb_flush_log_at_trx_commit=2
innodb_flush_method=O_DIRECT
innodb_file_per_table
transaction-isolation=READ-COMMITTED
max_connections=1000
log-bin=mysql.bin
binlog-format=MIXED
server-id=1
default-storage-engine=InnoDB
thread_cache_size=24
tmp_table_size=128M
max_heap_table_size=128M
long_query_time=3
expire_logs_days=5
net_read_timeout=5000
net_write_timeout=5000
max_allowed_packet=3G
group_concat_max_len=32M
binlog_cache_size=1M
table_open_cache=2048
table_definition_cache=1024
join_buffer_size=1M
innodb_lock_wait_timeout=700
skip-name-resolve
query_cache_size=256M
bind_address=0.0.0.0

新的

[mysqld]
socket=/tmp/mysql.sock
pid-file=/tmp/mysqld.pid
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
innodb_buffer_pool_size=216G
innodb_io_capacity=200
innodb_log_file_size=256M
innodb_log_buffer_size=12M
innodb_flush_log_at_trx_commit=2
innodb_flush_method=O_DIRECT
innodb_file_per_table
transaction-isolation=READ-COMMITTED
max_connections=2000
log-bin=mysql.bin
binlog-format=MIXED
server-id=1
default-storage-engine=InnoDB
thread_cache_size=48
tmp_table_size=384M
max_heap_table_size=384M
long_query_time=3
expire_logs_days=5
net_read_timeout=5000
net_write_timeout=5000
max_allowed_packet=3G
group_concat_max_len=32M
binlog_cache_size=1M
table_open_cache=4728
open_files_limit=9456
table_definition_cache=1024
join_buffer_size=1M
innodb_lock_wait_timeout=700
skip-name-resolve
query_cache_size=128M
bind_address=0.0.0.0

现在我认为它可能归结为 ext4 FS,并且在 /etc/fstab 中设置 barrier=0 可能会有所帮助(但这有其注意事项)。

我还想知道我的缓冲池是否对于数据大小来说太高了(我采用的事实标准是缓冲池大小为可用内存的 70-80%)。

我对这个问题有点困惑,所以如果能提供任何建议我将非常感激!

编辑

忘记说了,我们在两台服务器上都使用 mysql 5.5.21

答案1

使用max_allowed_packet下面的[mysqldump]指令。解决了我的问题一次。

[mysqldump] quick max_allowed_packet = 3G

相关内容