2013-02-09 45 views
0

我的專用服務器(四核i7與〜8GB RAM)上運行CentOS的有管理嚮導和我遇到與MySQL的重大問題,其上更多的細節可以發現hereMySQL配置:內存使用「危險高」?

我剛從this website運行一個Perl的MySQL調諧器腳本,試圖確定是什麼問題。

可悲的是,輸出不使一個很大的意義對我說:

>> MySQLTuner 1.2.0 - Major Hayden <[email protected]> 
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/ 
>> Run with '--help' for additional options and output filtering 
Please enter your MySQL administrative login: root 
Please enter your MySQL administrative password: 

-------- General Statistics -------------------------------------------------- 
[--] Skipped version check for MySQLTuner script 
[OK] Currently running supported MySQL version 5.5.20-log 
[OK] Operating on 64-bit architecture 

-------- Storage Engine Statistics ------------------------------------------- 
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster 
[--] Data in MyISAM tables: 236M (Tables: 686) 
[--] Data in InnoDB tables: 226M (Tables: 199) 
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17) 
[!!] Total fragmented tables: 312 

-------- Security Recommendations ------------------------------------------- 
[OK] All database users have passwords assigned 

-------- Performance Metrics ------------------------------------------------- 
[--] Up for: 18h 42m 34s (1M q [18.265 qps], 49K conn, TX: 3B, RX: 835M) 
[--] Reads/Writes: 60%/40% 
[--] Total buffers: 528.0M global + 7.0M per thread (1500 max threads) 
[!!] Maximum possible memory usage: 10.8G (138% of installed RAM) 
[OK] Slow queries: 0% (3/1M) 
[OK] Highest usage of available connections: 2% (37/1500) 
[OK] Key buffer size/total MyISAM indexes: 64.0M/74.1M 
[OK] Key buffer hit rate: 99.9% (8M cached/5K reads) 
[OK] Query cache efficiency: 66.9% (529K cached/792K selects) 
[!!] Query cache prunes per day: 83513 
[OK] Sorts requiring temporary tables: 0% (0 temp sorts/42K sorts) 
[!!] Joins performed without indexes: 5962 
[OK] Temporary tables created on disk: 5% (5K on disk/97K total) 
[OK] Thread cache hit rate: 99% (37 created/49K connections) 
[OK] Table cache hit rate: 42% (512 open/1K opened) 
[OK] Open file limit used: 10% (756/7K) 
[OK] Table locks acquired immediately: 99% (513K immediate/513K locks) 
[!!] InnoDB data size/buffer pool: 226.7M/128.0M 

-------- Recommendations ----------------------------------------------------- 
General recommendations: 
    Run OPTIMIZE TABLE to defragment tables for better performance 
    MySQL started within last 24 hours - recommendations may be inaccurate 
    Reduce your overall MySQL memory footprint for system stability 
    Adjust your join queries to always utilize indexes 
Variables to adjust: 
    *** MySQL's maximum memory usage is dangerously high *** 
    *** Add RAM before increasing MySQL buffer variables *** 
    query_cache_size (> 64M) 
    join_buffer_size (> 2.0M, or always use indexes with joins) 
    innodb_buffer_pool_size (>= 226M) 

是調諧器提示我安裝MySQL需要比8GB的內存嗎?

我的服務器上的主網站每個星期有大約30K個獨立訪問者,但即使如此,當然MySQL並沒有受到攻擊很難?

中的設置我的my.cnf有:

[mysqld] 
local-infile=0 
bind-address=127.0.0.1 
max_connections=1500 
long_query_time=2 
log-slow-queries=/var/log/mysql_slow.log 
expire_logs_days=14 
external-locking 

open_files_limit=1536 
key_buffer_size=64M 
innodb_buffer_pool_size=128M 
innodb_additional_mem_pool_size=8M 
innodb_log_buffer_size=8M 
group_concat_max_len=16k 
max_sort_length=16k 
max_length_for_sort_data=16k 
query_cache_type=1 
query_cache_limit=4M 
query_cache_size=64M 
innodb_thread_concurrency=16 
thread_concurrency=16 
thread_cache=128 
thread_stack=1M 
read_buffer_size=1M 
join_buffer_size=2M 
read_rnd_buffer_size=1M 
table_cache=512 
tmp_table_size=256M 
max_heap_table_size=256M 
log-warnings 

[mysqld_safe] 
log-error=/var/log/mysqld.log 

有沒有人有任何意見,我怎麼可以優化我的MySQL安裝?

+0

這在我的書中看起來不正常。我想知道是否有錯誤的應用程序在兩個表上創建了一個'MxN'大小的結果集,這是錯誤的連接。 – 2013-02-09 19:15:22

+0

我在哪裏可以開始與診斷這樣的問題@ ClemensKlein,Robbenhaar? – dunc 2013-02-09 21:32:44

+1

或許真的是在'在/ var /日誌/ mysql_slow.log'(雖然它僅影響三個查詢,它說)。除非你可以努力的空間和時間,通過一個大的日誌文件來打開查詢日誌記錄和韋德(通常是一個不走生產系統)的下一站將是看使用MySQL的應用程序,並談談可能性開發商消耗大量內存的查詢以及他們使用的連接狀態。 – 2013-02-09 21:56:19

回答

0

假設你使用InnoDB它看起來在您不使用RAM,以獲得DB嗡嗡的第一眼。這個怎麼樣:

innodb_buffer_pool_size = 4G 
innodb_log_file_size = 1G