MysqlDump长加载时间


2

mysqldump database > output.sql用来转储数据库中的所有数据。输出文件的大小约为3.3 GB。我正在使用mysql < output.sql它导入它,但它已运行超过24小时仍然没有完成。

这是正常的吗?有没有办法加快进口?

mysql> SHOW VARIABLES LIKE '%innodb%';
+-----------------------------------------+------------------------+
| Variable_name                           | Value                  |
+-----------------------------------------+------------------------+
| have_innodb                             | YES                    |
| ignore_builtin_innodb                   | OFF                    |
| innodb_adaptive_hash_index              | ON                     |
| innodb_additional_mem_pool_size         | 1048576                |
| innodb_autoextend_increment             | 8                      |
| innodb_autoinc_lock_mode                | 1                      |
| innodb_buffer_pool_size                 | 8388608                |
| innodb_checksums                        | ON                     |
| innodb_commit_concurrency               | 0                      |
| innodb_concurrency_tickets              | 500                    |
| innodb_data_file_path                   | ibdata1:10M:autoextend |
| innodb_data_home_dir                    |                        |
| innodb_doublewrite                      | ON                     |
| innodb_fast_shutdown                    | 1                      |
| innodb_file_io_threads                  | 4                      |
| innodb_file_per_table                   | OFF                    |
| innodb_flush_log_at_trx_commit          | 1                      |
| innodb_flush_method                     |                        |
| innodb_force_recovery                   | 0                      |
| innodb_lock_wait_timeout                | 50                     |
| innodb_locks_unsafe_for_binlog          | OFF                    |
| innodb_log_buffer_size                  | 1048576                |
| innodb_log_file_size                    | 5242880                |
| innodb_log_files_in_group               | 2                      |
| innodb_log_group_home_dir               | ./                     |
| innodb_max_dirty_pages_pct              | 90                     |
| innodb_max_purge_lag                    | 0                      |
| innodb_mirrored_log_groups              | 1                      |
| innodb_open_files                       | 300                    |
| innodb_rollback_on_timeout              | OFF                    |
| innodb_stats_on_metadata                | ON                     |
| innodb_support_xa                       | ON                     |
| innodb_sync_spin_loops                  | 20                     |
| innodb_table_locks                      | ON                     |
| innodb_thread_concurrency               | 8                      |
| innodb_thread_sleep_delay               | 10000                  |
| innodb_use_legacy_cardinality_algorithm | ON                     |
+-----------------------------------------+------------------------+
37 rows in set (0.12 sec)

mysql> SHOW VARIABLES LIKE '%key_buffer%';
+-----------------+----------+
| Variable_name   | Value    |
+-----------------+----------+
| key_buffer_size | 16777216 |
+-----------------+----------+
1 row in set (0.03 sec)

mysql> SHOW VARIABLES LIKE '%table%';
+----------------------------+----------+
| Variable_name              | Value    |
+----------------------------+----------+
| big_tables                 | OFF      |
| innodb_file_per_table      | OFF      |
| innodb_table_locks         | ON       |
| lower_case_table_names     | 0        |
| max_heap_table_size        | 16777216 |
| max_tmp_tables             | 32       |
| old_alter_table            | OFF      |
| sql_big_tables             | OFF      |
| table_definition_cache     | 256      |
| table_lock_wait_timeout    | 50       |
| table_open_cache           | 64       |
| table_type                 | MyISAM   |
| tmp_table_size             | 16777216 |
| updatable_views_with_limit | YES      |
+----------------------------+----------+
14 rows in set (0.00 sec)

此外,这些表格是InnoDB
Gordon 2010年

Answers:


1

我无法想象在合理的现代机器上花费超过一两个小时的数据。我使用MySQL Administrator(在MySQL GUI工具中找到)或mtop来确保它不仅仅是挂起。


1

可能您的mysqld设置已被调整为包含太低的内存使用设置。

对于MyISAM表,请确保已正确调整key_buffer_size和table_cache。

对于InnoDB表,请确保正确调整innodb_buffer_pool_size。使用InnoDB,将insert语句包装在事务中也很有帮助。

请在此处发布以下命令的输出:

SHOW VARIABLES LIKE '%innodb%';
SHOW VARIABLES LIKE '%key_buffer%';
SHOW VARIABLES LIKE '%table%';

输出添加到post
Gordon 2010年

0

随着
show full processlist;
你可以看到所有进程都在运行,所以如果它仍在插入数据,你应该看到它。

显示打开的表
显示表状态

还应该给你一些信息。尝试一下,向我们展示结果。

不应该超过2小时。我同意。


0

这实际上是我最终的磁盘空间问题。这没东西看。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.