我正在使用具有 32GB RAM 和 8 核服务器的专用服务器,使用 Maria DB 10.1,大多数表都是 InnoDB。总 DB 大小小于 2GB,但我认为性能很慢。
以下是my.cnf
我正在使用的文件:
[mysqld]
log-error=/home/MySQL_Server/mysql/dedi.server.co.err
datadir=/home/MySQL_Server/mysql
pid-file=/home/MySQL_Server/mysqlmysqld.pid
innodb_file_per_table=1
skip-name-resolve=1
bind-address=127.0.0.1
#skip-networking=1
#query_cache_type=0
query_cache_type=1
innodb_file_per_table=1
default-storage-engine=InnoDB
#query_cache_size=0
query_cache_size=128M
query_cache_limit=256K
query_cache_min_res_unit = 2k
performance_schema=ON
innodb_buffer_pool_size = 1536M
innodb_log_file_size = 140M
innodb_log_files_in_group=2
sort_buffer_size=256k
join_buffer_size=256k
read_buffer_size=256k
read_rnd_buffer_size=256k
thread_stack=256k
mrr_buffer_size=256k
join_cache_level=8
tmp_table_size=64M
max_heap_table_size=64M
table_open_cache=1024
thread_cache_size=32
innodb_buffer_pool_instances=1
innodb_use_sys_malloc = 1
max_connections=500
wait_timeout=300
interactive_timeout=360
#tmpdir=/var/mysqltmp
#max_allowed_packet=268435456
MySQL Tuner 建议如下:
General recommendations:
Control warning line(s) into /home/MySQL_Server/mysql/dedi.niresh.co.err file
Control error line(s) into /home/MySQL_Server/mysql/dedi.niresh.co.err file
Increasing the query_cache size over 128M may reduce performance
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries which have no LIMIT clause
Consider installing Sys schema from https://github.com/mysql/mysql-sys
Variables to adjust:
query_cache_size (=0)
query_cache_type (=0)
query_cache_size (> 128M) [see warning above]
tmp_table_size (> 64M)
max_heap_table_size (> 64M)
innodb_log_file_size should be (=192M) if possible, so InnoDB total log files size equals to 25% of buffer pool size.
我应该关闭查询缓存吗?
有什么额外的建议吗?