Home  >  Article  >  Database  >  paip.mysql备份慢的解决_MySQL

paip.mysql备份慢的解决_MySQL

WBOY
WBOYOriginal
2016-06-01 13:30:261159browse

bitsCN.com

paip.mysql备份慢的解决

 

版本5.0.45-community-nt

主数据库50W数据,备份的sql34M..压缩后5.8m

 

原来备份178 S.. 调整MY.INI  加大10倍...  而个88S... 不压缩的情况下45s

 

换成个5.6 , 还要中多时间,要不走粤慢兰..

不压缩的情况下43s...  调整MY.INI  加大10倍.  40S.....差距不明显木..

 

最终解决方案:copy备份

---------------------------

..块啊,7秒搞定..是热备份.不用关机..

 

参考其他自料儿..

====================

数据文件大约200GB,平时备份(mysqldump)压缩后的大小大约20GB,正常备份时间在2个小时内。一台服务器上,安装了多个mysql实例

 

 

,这个数据库是其中一个

 

mysql按照备份恢复方式分为逻辑备份和物理备份

 

 

逻辑备份是备份sql语句,在恢复的时候执行备份的sql语句实现数据库数据的重现

 

 

物理备份就是备份数据文件了,比较形象点就是cp下数据文件,但真正备份的时候自然不是的cp这么简单

 

 

这2种备份各有优劣,一般来说,物理备份恢复速度比较快,占用空间比较大,逻辑备份速度比较慢,占用空间比较小

mysqldump工具备份

 

 

mysqldump由于是mysql自带的备份工具,所以也是最常用的mysql数据库的备份工具。支持基于InnoDB的热备份。但由于是逻辑备份,所以

 

 

速度不是很快,适合备份数据量比较小的场景。

mysqldump完全备份+二进制日志 —>实现时间点恢复

 

 

 

看累挂CFG DEFAULT    show  VARIABLES like '%size%'

-----------------------------------------------

 

 

binlog_cache_size 32768

binlog_stmt_cache_size 32768

bulk_insert_buffer_size 8388608

delayed_queue_size 1000

host_cache_size 279

innodb_additional_mem_pool_size 8388608

innodb_buffer_pool_size 134217728

innodb_change_buffer_max_size 25

innodb_ft_cache_size 8000000

innodb_ft_max_token_size 84

innodb_ft_min_token_size 3

innodb_log_buffer_size 8388608

innodb_log_file_size 50331648

innodb_online_alter_log_max_size 134217728

innodb_page_size 16384

innodb_purge_batch_size 300

innodb_sort_buffer_size 1048576

innodb_sync_array_size 1

join_buffer_size 262144

key_buffer_size 8388608

key_cache_block_size 1024

large_page_size 0

max_binlog_cache_size 18446744073709547520

max_binlog_size 1073741824

max_binlog_stmt_cache_size 18446744073709547520

max_heap_table_size 16777216

max_join_size 18446744073709551615

max_relay_log_size 0

metadata_locks_cache_size 1024

myisam_data_pointer_size 6

myisam_max_sort_file_size 2146435072

myisam_mmap_size 4294967295

myisam_sort_buffer_size 8388608

optimizer_trace_max_mem_size 16384

performance_schema_accounts_size 100

performance_schema_digests_size 10000

performance_schema_events_stages_history_long_size  10000

performance_schema_events_stages_history_size  10

performance_schema_events_statements_history_long_size

10000

performance_schema_events_statements_history_size  10

performance_schema_events_waits_history_long_size  10000

performance_schema_events_waits_history_size  10

performance_schema_hosts_size 100

performance_schema_session_connect_attrs_size  512

performance_schema_setup_actors_size 100

performance_schema_setup_objects_size 100

performance_schema_users_size 100

preload_buffer_size 32768

profiling_history_size 15

query_alloc_block_size 8192

query_cache_size 1048576

query_prealloc_size 8192

range_alloc_block_size 4096

read_buffer_size 131072

read_rnd_buffer_size 262144

slave_pending_jobs_size_max 16777216

sort_buffer_size 262144

thread_cache_size 9

tmp_table_size 16777216

transaction_alloc_block_size 8192

transaction_prealloc_size 4096

 

 

 

 

 

加大10背

----------

 

 

 log-error=d:/MySQL56/mysql_log_err.txt

 

 

 

 

thread_cache = 128 

 

 

  query_cache_type = 1 

 

 

 query_cache_size = 128M  

 

 

  join_buffer_size = 80M  

 

 

 

 

 

 

  sort_buffer_size = 20M  

  read_buffer_size = 20M 

 read_rnd_buffer_size = 20M  

 

 

  max_heap_table_size = 128M  

 

 

 tmp_table_size = 128M  

 

 

 

  binlog_cache_size = 12M  

 

 

  max_binlog_size = 512M  

 

 

  expire_logs_days = 3 

#  innodb_buffer_pool_size = 2G 

 

 

 

 

 

 

 

  innodb_use_sys_malloc = 1 

 

 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn