Mysql不释放内存

时间:2015-10-10 18:54:10

标签: php mysql linux cron

我有一个使用5个不同数据库的项目(oracle,mssql,ibm Informix等,......和...... mysql)

每次超时cron都会将数据导入MySQL。不幸的是,我们有一个非常庞大的cron脚本,可以导入近400 k行。我通过小包导入数据,但是当cron运行这个脚本时,MySQL需要大约2 GB的内存,并等待下一个调用。比需要多2 GB,这在MySQL崩溃之前会重复。

我们已经遇到了MySQL innodb损坏并从1到4运行恢复模式以重启数据库的问题。

服务器总内存为12 GB。

我们对/etc/my.cnf.d/server.cnf的配置如下所示:

    #
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]
default_storage_engine=innodb
character-set-server=utf8

back_log = 50
max_connections = 100
max_connect_errors = 10
table_open_cache = 2048

max_allowed_packet = 64M
binlog_cache_size = 16M
max_heap_table_size = 1G


read_buffer_size = 8M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M

thread_cache_size = 32
# You should try [number of CPUs]*(2..4) for thread_concurrency
thread_concurrency = 8

query_cache_size = 64M
query_cache_limit = 1M

tmp_table_size = 1G

thread_stack = 240K

transaction_isolation = REPEATABLE-READ
ft_min_word_len = 4

log-bin=mysql-bin
binlog_format=mixed

#slow_query_log
#long_query_time = 10
group_concat_max_len = 10000


#*** MyISAM Specific options
key_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 64M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover

# *** INNODB Specific options ***
innodb_file_per_table
innodb_buffer_pool_size=8G
#innodb_data_file_path = ibdata1:10M:autoextend

innodb_write_io_threads = 8
innodb_read_io_threads = 8

innodb_thread_concurrency = 16

innodb_flush_log_at_trx_commit = 1

innodb_log_buffer_size = 8M
innodb_log_file_size = 512M
innodb_log_files_in_group = 3

innodb_max_dirty_pages_pct = 90

innodb_lock_wait_timeout = 120

expire_logs_days=5

[mysqldump]
# Do not buffer the whole result set in memory before writing it to
# file. Required for dumping very large tables
quick

max_allowed_packet = 256M


[mysql]
no-auto-rehash

# Only allow UPDATEs and DELETEs that use keys.
safe-updates

[myisamchk]
key_buffer_size = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M

[mysqlhotcopy]
interactive-timeout

[mysqld_safe]
# Increase the amount of open files allowed per process. Warning: Make
# sure you have set the global system limit high enough! The high value
# is required for a large number of opened tables
open-files-limit = 8192

如果需要任何信息来找出发生这种情况的原因,我会提供。

请!帮我找出解决方案!我应该重新安装MySQL,还是仍然可以通过配置修改解决???

0 个答案:

没有答案