我有点希望有人可以提供一些帮助来优化 my.cnf 文件以用于超大容量的 mysql 数据库服务器。
Our architecture is as follows:
Memory : 96GB
CPUs : 12
OS & Mysql : 64-bit
Disk Space : 1.2 TB
DB Engine : MyISAM
我们的 Web 应用程序同时被大约 300 个客户使用。我们需要对 my.cnf 进行调整,以便为该基础架构提供最佳性能。
我完全知道索引和优化查询是其中的一个主要因素,但我们希望从一个配置正确的系统开始,然后相应地系统地重新设计我们的查询。
Here is our current my.cnf file content:
[mysqld]
datadir=/home/mysql
socket=/home/mysql/mysql.sock
user=mysql
log-bin=mysql-bin
server-id=1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=1
log-slow-queries = /var/log/mysqld_slow_queries.log
long_query_time = 10
max_connections = 500
key_buffer_size = 32768M
#max_allowed_packet = 2M
#table_open_cache = 128
#sort_buffer_size = 1024K
#net_buffer_length = 64K
#read_buffer_size = 1024K
#read_rnd_buffer_size = 1024K
#myisam_sort_buffer_size = 8M
query_cache_size = 128M
query_cache_limit = 128M
interactive_timeout = 300
wait_timeout = 300
# Added values after load testing
thread_cache_size = 8
#tmp_table_size = 256M
#max_heap_table_size = 256M
#table_cache = 512
#join_buffer_size = 512
log-error=/var/log/mysqld.log
innodb_buffer_pool_size=128M
#innodb_file_per_table
#innodb_log_file_size=250M
##innodb_buffer_pool_size=64M
#innodb_buffer_pool_size=1024M
#innodb_log_buffer_size=4M
##log-bin=mysql-bin
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
#[myisamchk]
#key_buffer = 64M
#sort_buffer = 64M
#read_buffer = 16M
#write_buffer = 16M
有什么建议么?谢谢各位。
由 RolandoMySQLDBA 编辑
由于您的所有数据都是 MyISAM,请运行此查询并显示输出
SELECT CONCAT(ROUND(KBS/POWER(1024,
IF(PowerOf1024<0,0,IF(PowerOf1024>3,0,PowerOf1024)))+0.4999),
SUBSTR(' KMG',IF(PowerOf1024<0,0,
IF(PowerOf1024>3,0,PowerOf1024))+1,1))
recommended_key_buffer_size FROM
(SELECT LEAST(POWER(2,32),KBS1) KBS
FROM (SELECT SUM(index_length) KBS1
FROM information_schema.tables
WHERE engine='MyISAM' AND
table_schema NOT IN ('information_schema','mysql')) AA ) A,
(SELECT 3 PowerOf1024) B;
@ Rolando - 谢谢...该查询的结果是 4G。