开发者

mysql my.cnf for a 50gb of RAM server

I am having load problems on my database server (dual quad core 50 gb ram)

load average: 4.26, 6.78, 11.25

here is the current my.cnf, can i optimize it?

[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

[mysqld_safe]
socket          = /var/run/mysqld/mysqld.sock
nice            = 0

[mysqld]
user            = mysql
pid-file       开发者_如何学C = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
language        = /usr/share/mysql/english
skip-external-locking

key_buffer              = 150M
key_buffer_size = 512M
max_allowed_packet      = 16M
thread_stack            = 128K
thread_cache_size       = 128
open-files              = 8192

myisam-recover          = BACKUP
max_connections        = 1000
table_cache            = 8096
join_buffer_size        = 2M
tmp_table_size          = 10G
max_heap_table_size     = 10G
innodb_buffer_pool_size = 10G
innodb_additional_mem_pool_size = 128M
innodb_log_file_size = 100M
log-slow-queries        = /var/log/mysql/slow.log
sort_buffer_size        = 5M
net_buffer_length       = 5M
read_buffer_size        = 2M
read_rnd_buffer_size    = 12M
thread_concurrency     = 16
ft_max_word_len = 30
ft_min_word_len = 2
#thread_concurrency     = 10

query_cache_limit       = 4M
query_cache_size        = 512M

The website has about 2000 users online.


I always start out with a watch "mysqladmin pr -vv" to see which statements are the worst... then you should get an idea what variable to adjust ... most of the time it's a missing index.


You use mytop and mysqltuner to analyze using mysql resources (RAM and CPU).

Too enable the option to log slow queries:

log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 3

And check out this post about ntpd service:

MySQL high CPU usage

I have a dedicated server for a high rate of transactions:

max_allowed_packet=16M
key_buffer_size=8M
innodb_additional_mem_pool_size=10M
innodb_buffer_pool_size=512M
join_buffer_size=40M
table_open_cache=1024
query_cache_size=40M
table_definition_cache=256
innodb_additional_mem_pool_size=10M
key_buffer_size=16M
max_allowed_packet=32M
max_connections = 300
query_cache_limit = 10M
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 3

Regards.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜