![](/img/trans.png)
[英]Mysql my.cnf setup for a server with 8gb ram, 2 processors and 1000 concurrent connections
[英]mysql my.cnf for a 50gb of RAM server
我的數據庫服務器上出現負載問題(雙四核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個在線用戶。
您可以使用mytop和mysqltuner來分析使用mysql資源(RAM和CPU)的情況。
啟用日志記錄慢查詢的選項:
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 3
並查看有關ntpd服務的帖子:
我有專用的服務器來進行高交易率:
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
問候。
我總是從watch "mysqladmin pr -vv"
,看看哪個語句最糟糕……然后您應該知道要調整的變量……大多數情況下,它是缺少索引的地方。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.