问题:每当我运行mysqltuner
它时,它总是抱怨三个组件,即使我将它们的值更改为高但仍然显示需要更多,它们正在关注,我有两个表MyISAM
,我们也加入等,但我听说将值设置得更高InnoDB
是不好的join_buffer_size
,以下是盒子的详细信息,请建议我的盒子是否还有什么要调整的?
Variables to adjust:
query_cache_size (> 128M)
join_buffer_size (> 4.0M, or always use indexes with joins)
table_cache (> 512)
硬件: 40 CPUs
和64 GB Memory
MySQL: mysql-5.1.73-3.el6_5.x86_64
我的.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
symbolic-links=0
bind-address = 0.0.0.0
max_connections = 1000
max_allowed_packet=32M
join_buffer_size=4M
thread_cache_size=8
query_cache_limit=4M
query_cache_size=128M
thread_cache_size=4
table_cache=512
key_buffer_size=2G
innodb-buffer-pool-size = 16G
open-files-limit = 35535
sort_buffer_size = 6M
query-cache-type = 1
tmp_table_size=1G
innodb_log_buffer_size=1G
server-id=1
binlog-format = mixed
log-bin=mysql-bin
datadir=/var/lib/mysql
innodb_flush_log_at_trx_commit=1
sync_binlog=1
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
mysqltunner
-------- Performance Metrics -------------------------------------------------
[--] Up for: 18h 33m 52s (121M q [1K qps], 4M conn, TX: 32B, RX: 16B)
[--] Reads / Writes: 99% / 1%
[--] Total buffers: 19.1G global + 10.6M per thread (1000 max threads)
[OK] Maximum possible memory usage: 29.5G (46% of installed RAM)
[OK] Slow queries: 0% (4/121M)
[OK] Highest usage of available connections: 8% (88/1000)
[OK] Key buffer size / total MyISAM indexes: 2.0G/1.7G
[OK] Key buffer hit rate: 99.4% (15M cached / 90K reads)
[OK] Query cache efficiency: 71.1% (75M cached / 106M selects)
[!!] Query cache prunes per day: 27253282
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 21M sorts)
[!!] Joins performed without indexes: 12267
[OK] Temporary tables created on disk: 3% (1K on disk / 49K total)
[OK] Thread cache hit rate: 99% (1K created / 4M connections)
[!!] Table cache hit rate: 1% (365 open / 21K opened)
[OK] Open file limit used: 1% (449/35K)
[OK] Table locks acquired immediately: 99% (30M immediate / 30M locks)
[OK] InnoDB data size / buffer pool: 115.6M/16.0G
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Enable the slow query log to troubleshoot bad queries
Adjust your join queries to always utilize indexes
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
query_cache_size (> 128M)
join_buffer_size (> 4.0M, or always use indexes with joins)
table_cache (> 512)
地位
mysql> show status LIKE '%open_%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| Com_show_open_tables | 0 |
| Open_files | 449 |
| Open_streams | 0 |
| Open_table_definitions | 169 |
| Open_tables | 365 |
| Opened_files | 7436 |
| Opened_table_definitions | 0 |
| Opened_tables | 0 |
| Slave_open_temp_tables | 0 |
+--------------------------+-------+
9 rows in set (0.00 sec)
mysql> show status LIKE '%key_%';
+------------------------+----------+
| Variable_name | Value |
+------------------------+----------+
| Com_assign_to_keycache | 0 |
| Com_preload_keys | 0 |
| Com_show_keys | 0 |
| Key_blocks_not_flushed | 0 |
| Key_blocks_unused | 1617830 |
| Key_blocks_used | 96906 |
| Key_read_requests | 15325797 |
| Key_reads | 91041 |
| Key_write_requests | 497292 |
| Key_writes | 421837 |
+------------------------+----------+
10 rows in set (0.00 sec)
注意:我们每晚运行 mysqldump。