0

専用サーバー (最大 8Gb RAM のクアッド コア i7) で DirectAdmin を使用して CentOS を実行していますが、MySQL で重大な問題が発生しまし

問題の原因を特定するために、この Web サイトから perl MySQL Tuner スクリプトを実行しました。

悲しいことに、出力は私にはあまり意味がありません:

 >>  MySQLTuner 1.2.0 - Major Hayden <major@mhtx.net>
 >>  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 を超える RAM が必要であることを示唆していますか?

私のサーバーのメイン Web サイトには、1 週間あたり約 30,000 のユニークな訪問者がいますが、それでも、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 のインストールを最適化する方法についてアドバイスはありますか?

4

1 に答える 1

0

InnoDB を使用すると仮定すると、一見したところ、RAM を使用して DB をハミングしていないように見えます。これはどう:

innodb_buffer_pool_size = 4G 
innodb_log_file_size = 1G
于 2013-03-06T22:39:25.243 に答える