Mysql 5.7.38 32G服务器生产环境配置

[mysqld]

sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

transaction_isolation=READ-COMMITTED

datadir=/data/mysql

pid_file=/opt/mysql/mysqld.pid

socket=/opt/mysql/mysql.sock

user=mysql

port=3306

character_set_server= utf8

default_storage_engine = InnoDB

bind_address = 0.0.0.0

log_timestamps=SYSTEM

secure_file_priv =

lower_case_table_names=1

#cluster

server-id=2

auto-increment-offset=1

auto-increment-increment=2

gtid_mode=on

enforce_gtid_consistency=on

#binlog

log_bin=/data/binlog/mysql-bin

binlog_format=ROW

expire_logs_days=7

#relaylog

relay-log=/data/relaylog/relay-bin

#read-only=on

#log

log_error='/data/log/mysql.log'

slow_query_log=on

slow_query_log_file='/data/log/slow.log'

#general_log = 1

general_log_file = /data/log/general.log

#connect

max_connect_errors=100000

max_connections = 3000

max_allowed_packet = 20M

#interactive_timeout = 1800

#wait_timeout = 1800

open_files_limit = 20000

#cache

tmp_table_size = 64M

max_heap_table_size = 64M

thread_cache_size = 256

table_definition_cache =4096

table_open_cache = 4096

sort_buffer_size = 1M

read_buffer_size = 1M

read_rnd_buffer_size = 1M

join_buffer_size = 1M

thread_stack = 512K

#innodb

innodb_flush_log_at_trx_commit =2

innodb_buffer_pool_size = 24G

innodb_buffer_pool_instances = 4

innodb_read_io_threads = 4

innodb_write_io_threads = 26

innodb_io_capacity = 300

innodb_use_native_aio = on

innodb_log_file_size = 512M

[mysqld_safe]

log-error =/data/mysql/mysql_err.log

pid-file =/data/mysql/mysqld.pid

[mysql]

auto-rehash

你可能感兴趣的:(linux)