1. 参见《高性能mysql》的第8章;
2. 在第一步的基础上,然后借助https://tools.percona.com/来创建。
以下是通过tools.percona.com生成的mysql.cnf配置文件,基于16c,32G的配置
[mysql]
# CLIENT #
port = 3306socket = /var/lib/mysql/mysql.sock[mysqld]
# GENERAL #
user = mysqldefault-storage-engine = InnoDBsocket = /var/lib/mysql/mysql.sockpid-file = /var/lib/mysql/mysql.pid# MyISAM #
key-buffer-size = 32Mmyisam-recover-options = FORCE,BACKUP# SAFETY #
max-allowed-packet = 16Mmax-connect-errors = 1000000innodb = FORCE# DATA STORAGE #
datadir = /var/lib/mysql/# BINARY LOGGING #
log-bin = /var/lib/mysql/mysql-binexpire-logs-days = 14sync-binlog = 1# CACHES AND LIMITS #
tmp-table-size = 32Mmax-heap-table-size = 32Mquery-cache-type = 0query-cache-size = 0max-connections = 5000thread-cache-size = 100open-files-limit = 65535table-definition-cache = 4096table-open-cache = 4096# INNODB #
innodb-flush-method = O_DIRECTinnodb-log-files-in-group = 2innodb-log-file-size = 512Minnodb-flush-log-at-trx-commit = 1innodb-file-per-table = 1innodb-buffer-pool-size = 26G# LOGGING #
log-error = /var/lib/mysql/mysql-error.loglog-queries-not-using-indexes = 1slow-query-log = 1slow-query-log-file = /var/lib/mysql/mysql-slow.log