muyl
5/11/2019 - 1:00 AM

my.cnf

# Generated by Percona Configuration Wizard (http://tools.percona.com/) version REL5-20120208
# Configuration name master generated for bp_2011@163.com at 2017-07-21 09:16:04

[mysql]

# CLIENT #
port                                = 3306
socket                              = /usr/local/mysql/data/mysql.sock

[mysqld]

# GENERAL #
user                                = mysql
default-storage-engine              = InnoDB
character_set_server                = utf8
socket                              = /usr/local/mysql/data/mysql.sock
pid-file                            = /usr/local/mysql/data/mysql.pid

# MyISAM #
key-buffer-size                     = 32M
myisam-recover                      = FORCE,BACKUP

# SAFETY #
max-allowed-packet                  = 16M
max-connect-errors                  = 1000000

# DATA STORAGE #
datadir                             = /usr/local/mysql/data/

# BINARY LOGGING #
log-bin                             = /usr/local/mysql/data/mysql-bin
expire-logs-days                    = 14
sync-binlog                         = 1

# REPLICATION #
log-slave-updates                   = 1
relay-log                           = /usr/local/mysql/data/relay-bin
slave-net-timeout                   = 60

auto_increment_increment 	          = 2 
auto_increment_offset               = 1
server-id 					                = 100 #从机为101
binlog_format 				              = ROW
sync_binlog 				                = 1
gtid_mode 					                = on
enforce_gtid_consistency 	          = 1 
binlog_gtid_simple_recovery         = 1 

# CACHES AND LIMITS #
tmp-table-size                      = 32M
max-heap-table-size                 = 32M
query-cache-type                    = 0
query-cache-size                    = 0
max-connections                     = 1024
thread-cache-size                   = 400
open-files-limit                    = 65535
table-definition-cache              = 1024
table-open-cache                    = 2048
wait_timeout 				                = 1800
interactive_timeout 		            = 1800

# INNODB #
innodb_io_capacity 			            = 500 # SSD 2000 ~ 20000 
innodb-flush-method                 = O_DIRECT
innodb-log-files-in-group           = 3
innodb-log-file-size                = 1G
innodb-flush-log-at-trx-commit      = 1
innodb-file-per-table               = 1
innodb-buffer-pool-size             = 12G 
innodb_lock_wait_timeout            = 5 
innodb_log_buffer_size              = 8388608 
innodb_print_all_deadlocks          = ON 
innodb_flush_log_at_trx_commit      = 2 
innodb_additional_mem_pool_size     = 32M 
innodb_data_file_path               = ibdata1:512M:autoextend 
innodb_autoextend_increment         = 64 
innodb_thread_concurrency           = 0 
innodb_old_blocks_time              = 1000 
innodb_buffer_pool_instances        = 8 
innodb_lru_scan_depth               = 512 
innodb_flush_neighbors              = 1 # SSD必须设置为0 
innodb_checksum_algorithm           = crc32 
innodb_buffer_pool_dump_at_shutdown = ON 
innodb_buffer_pool_load_at_startup  = ON 
innodb_buffer_pool_dump_pct         = 40 
innodb_read_io_threads              = 8 
innodb_write_io_threads             = 8 
innodb_purge_threads                = 4 
innodb_page_cleaners                = 4 


# LOGGING #
log-error                           = /usr/local/mysql/data/mysql-error.log
log-queries-not-using-indexes       = 1
slow-query-log                      = 1
slow-query-log-file                 = /usr/local/mysql/data/mysql-slow.log

skip-name-resolve 			            = 1 
skip_external_locking               = 1
lower_case_table_names 		          = 1
local_infile 				                = 0 

#slave crash safe#
relay_log_info_repository 	        = TABLE 
master_info_repository 		          = TABLE 
relay_log_recovery 			            = ON