mysql5.6/5.7 配置文件参考(内存大于32G)

回复 收藏
[mysqld]
#misc
port            = 3306
socket          = /tmp/mysql.sock
datadir         = /data/mysql
default-storage-engine = InnoDB
#skip-locking
explicit_defaults_for_timestamp = true

# connection
skip-name-resolve
#skip-networking
bind-address = 192.168.11.11
max_connections = 1024
max_connect_errors = 100000000000
wait_timeout = 15
sql_mode = NO_ENGINE_SUBSTITUTION

# buffer & cache
back_log = 300
key_buffer_size = 256M
max_allowed_packet = 32M
sort_buffer_size = 8M
read_buffer_size = 4M
join_buffer_size = 4M
#record_buffer = 2M
read_rnd_buffer_size = 2M
thread_cache_size = 128
tmp_table_size = 128M
query_cache_size = 0
query_cache_type = 0
max_heap_table_size = 96M

# logs
#log-output="FILE"
#log-error = /data/mysql/error.log
#log_warnings = 2
slow_query_log = 1
slow_query_log_file = /data/mysql/slow.log

#relay log (角色:从库)
skip_slave_start = 1
max_relay_log_size = 1G
relay_log_purge = 1
relay_log_recovery = 1
#slave_parallel_workers = 2
master_verify_checksum = 1
master_info_repository = "TABLE"
relay_log_info_repository = "TABLE"
slave_sql_verify_checksum = 1
slave_allow_batching = 1
log_slave_updates

# myisam
myisam_sort_buffer_size = 64M

# binlog
log-bin=mysql-bin
expire-logs-days  = 7
max_binlog_size = 1G
max_binlog_cache_size = 2G
binlog_format = MIXED
binlog_cache_size = 4M
sync_binlog = 1
server-id = 3307

#(从库)
replicate_wild_do_table = discuz.%
replicate_wild_do_table = wordpress.%
replicate_ignore_table = discuz.cdb_sessions
replicate_ignore_table = discuz.cdb_client_sessions
replicate_ignore_table = discuz.cdb_ajax_crons
replicate_wild_ignore_table = mysql.%
replicate_wild_ignore_table = test.%
replicate_wild_ignore_table = information_schema.%

# innodb
# innodb_buffer_pool_size 不超过内存的70%
innodb_buffer_pool_size = 20G
#innodb_data_file_path = ibdata:512M:autoextend
innodb_data_home_dir = /data/mysql
innodb_log_group_home_dir = /data/mysql/
innodb_file_io_threads = 4
innodb_thread_concurrency =  8
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 8M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table=1
innodb_rollback_on_timeout
innodb_status_file = 1
innodb_read_io_threads = 2
innodb_write_io_threads = 8
innodb_io_capacity = 2000
innodb_adaptive_flushing = 1
transaction_isolation = READ-COMMITTED

#
#SSD优化
#修改内核 /sys/block/sdx/queue/read_ahead_kb, 提高预读为 16KB
#修改多核中断绑定,让每个CPU核心的中断分配更均衡,避免瓶颈
innodb_flush_neighbors = 0
innodb_flush_method = O_DIRECT
#SSD优化结束


2016-08-18 10:16 举报
已邀请:
0

标哥

赞同来自:

学习了

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: