2011-10-24 198 views
1

我有一個問題。我在我的一臺服務器(eAthena)上運行開源遊戲軟件,他們使用MySQL作爲他們的首選數據庫。然而,每一次我運行mysqldump的mysqldump掛起服務器

mysqldump -u backup -p*** eathena > test-backup.sql

它結束了掛在服務器上。 eAthena軟件掛起,並在完成後關閉。這是一個尺寸問題?看到數據庫是如何4.7gb,我不知道應該責怪什麼。有一些類型的替代我的mysqldump?

我正在運行CentOS 6 64bit,MySQL版本5.1.52。

+0

假設這是一個64位的MySQL,4.7GB應該是(長)眨眼的-的眼吧。什麼類型的表?如果他們是myisam,您可以嘗試使用「check table」和「repairs tables」來檢查損壞情況。 –

回答

2

看來你的mysql安裝內存不足了。請檢查/etc/my.cnf或/etc/mysql/my.cnf(或在CentOS上的任何位置)。

增加table_cache和key_buffer_size。請參閱mysql安裝附帶的confs示例:my-huge.cnf’, my-large.cnf',my-medium.cnf’, and my-small.cnf'。與此對比您confs:

[mysqld] 
# Reduced to 200 as memory will not be enough for 500 connections. 
# memory=key_buffer+sort_buffer_size+read_buffer_size)*max_connections 
# which is now: 64 + (1 + 1) * 200 = 464 MB 
# max_connections = approx. MaxClients setting in httpd.conf file 
# Default set to 100. 
max_connections = 100 
max_allowed_packet = 1M 
max_connect_errors = 10 
key_buffer = 512M # 128M for 1GB, 256M for 2GB, 512 for 4GB 
join_buffer_size = 4M # 1M for 1GB, 2M for 2GB, 4M for 4GB 
read_buffer_size = 4M # 1M for 1GB, 2M for 2GB, 4M for 4GB 
sort_buffer_size = 2M # 1M for 1GB, 2M for 2GB, 4M for 4GB 
# myisam_sort_buffer_size used for ALTER, OPTIMIZE, REPAIR TABLE commands. 
myisam_sort_buffer_size = 32M 
# Checked opened tables and adjusted accordingly after running for a while. 
table_cache = 1024 
# thread_concurrency = 2 * (no. of CPU) 
thread_concurrency=4 
thread_cache_size = 286 
# log slow queries is a must. Many queries that take more than 2 seconds. 
# If so, then your tables need enhancement. 
log_slow_queries=/var/log/mysqld.slow.log 
long_query_time=2 
# Reduced wait_timeout to prevent idle clients holding connections. 
wait_timeout = 10 
connect_timeout = 10 
interactive_timeout = 10 
# Enable it for vast improvement and it may be all you need to tweak. 
query_cache_limit = 1M 
query_cache_size = 128M 
query_cache_type = 1 
[mysqld_safe] 
open_files_limit = 8192 
[mysqldump] 
quick 
max_allowed_packet = 16M 
[myisamchk] 
key_buffer = 256M # 64M for 1GB, 128M for 2GB, 256 for 4GB 
sort_buffer = 256M # 64M for 1GB, 128M for 2GB, 256 for 4GB 
read_buffer = 64M # 16M for 1GB, 32M for 2GB, 64M for 4GB 
write_buffer = 64M # 16M for 1GB, 32M for 2GB, 64M for 4GB 
[mysqlhotcopy] 
interactive-timeout 

不要忘記之前重新啓動MySQL服務器再試

+0

這確實奏效,但我認爲節省空間/帶寬我只是不會去備份不必要的日誌/表(這也解決了我的問題)。 – Ivan