mysql my.cnf 适用于 50GB RAM 服务器

发布于 2024-09-24 12:33:34 字数 1380 浏览 3 评论 0原文

我的数据库服务器(双四核 50 GB RAM)遇到负载问题

,平均负载:4.26、6.78、11.25

这是当前的 my.cnf,我可以优化它吗?

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

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

[mysqld]
user            = mysql
pid-file        = /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

该网站约有2000名在线用户。

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        = /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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

纵性 2024-10-01 12:33:34

我总是从watch“mysqladmin pr -vv”开始,看看哪些语句是最糟糕的......然后你应该知道要调整什么变量......大多数时候它是缺失的指数。

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.

末骤雨初歇 2024-10-01 12:33:34

您使用mytopmysqltuner来分析mysql资源(RAM和CPU)的使用情况。

也启用记录慢速查询的选项:

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

并查看这篇关于ntpd服务的文章:

MySQL 高 CPU 使用率

我有一个用于高事务率的专用服务器:

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

此致。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文