C
C
Cyril2018-03-14 18:01:51
linux
Cyril, 2018-03-14 18:01:51

How to optimize MySQL for 6-8gb RAM?

Please help optimize the config
djcf1ropr-axpf7vvff64qc-zda.png

/etc/mysql/mysql.conf.d/mysqld.cnf

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
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
lc-messages-dir = /usr/share/mysql
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
myisam-recover-options = BACKUP
query_cache_type=2
query_cache_limit = 1M
query_cache_size = 32M
log_error = /var/log/mysql/error.log
expire_logs_days = 10
max_binlog_size = 100M
#Не используем старый хеш
old_passwords=0
#Защита сервера от кривых рук
max_join_size=1000000
#размер буфера, выделяемого под индексы
key_buffer_size = 4096M
#Полезно для запросов с сортировкой ORDER BY и группировкой GROUP BY
read_rnd_buffer_size=4M
sort_buffer_size=8M
#Память для запросов с джойнами
join_buffer_size=16M
#Память InnoDB для хранения индексов и данных
innodb_buffer_pool_size=4096M
#Размер буфера транзакций, которые не были еще закомичены
innodb_log_buffer_size=4M
#Увеличивает пропускную способность записи
innodb_flush_method=O_DSYNC
innodb_io_capacity=2000
innodb_io_capacity_max=6000
innodb_lru_scan_depth=2000
table_open_cache_instances=16
innodb_checksum_algorithm=crc32
#Увеличивает пропускную способность записи
innodb_flush_log_at_trx_commit=2
#Быстрый запуск MySQL сервера
innodb_buffer_pool_dump_at_shutdown=ON
innodb_buffer_pool_load_at_startup=ON
innodb_flush_neighbors=0

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Gorgul, 2018-03-14
@draaax

Use mysqltuner

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question