[client]
port = 3309
socket = /tmp/mysql3401.sock

[mysql]
prompt=”\U \R:\m:\s [\d]> “
no-auto-rehash

[mysqld]
user = mysql
port = 3401
basedir = /usr/local/mysql57
datadir = /opt/mysql3401/data
socket = /tmp/mysql3401.sock
pid-file = mysqld.pid
character-set-server = gbk
skip_name_resolve = 1 //检查客户端连接时是否解析主机名。如果此变量为OFF,则 mysqld在检查客户端连接时解析主机名。如果为ON,则 mysqld仅使用IP编号;否则为。在这种情况下,Host授权表中的所有列值都必须是IP地址

server-id = 611043401
default_time_zone = “+8:00” // 默认时间

open_files_limit = 65535 // 打开最大文件数量
back_log = 1024 //
MySQL可以拥有的未完成连接请求数。当主要的MySQL线程在很短的时间内收到很多连接请求时,就会发挥作用。然后,主线程需要花费一些时间(尽管很少)来检查连接并启动新线程。该 back_log值指示在MySQL暂时停止回答新请求之前的短时间内可以堆叠多少个请求。仅当您期望在短时间内有大量连接时,才需要增加此数量。

max_connections = 3000 //最大连接数
max_connect_errors = 1000000 //系统变量确定在发生阻塞之前允许的连续错误数
table_open_cache = 5000 //所有线程的打开表数。增大该值将增加mysqld所需的文件描述符的数量 。
table_definition_cache = 5000 //frm可以存储在定义高速缓存中 的表定义(来自文件)的数量 。如果使用大量表,则可以创建大表定义缓存以加快表的打开速度。与普通表高速缓存不同,表定义高速缓存占用的空间更少,并且不使用文件描述符。最小值是400。
table_open_cache_instances = 64 // 打开表缓存实例的数量。为了通过减少会话之间的争用来提高可伸缩性,可以将打开的表缓存划分为几个较小的大小为table_open_cache/的 缓存实例 table_open_cache_instances。会话只需要锁定一个实例即可访问它以获取DML语句。这可以在实例之间细分缓存访问,从而在有许多会话访问表时为使用缓存的操作提供更高的性能。(DDL语句仍然需要锁定整个缓存,但是这种语句的频率要比DML语句低得多。)
thread_stack = 256K //每个线程的堆栈大小。默认值足够大,可以正常运行。如果线程堆栈大小太小,则会限制服务器可以处理的SQL语句的复杂性,存储过程的递归深度以及其他消耗内存的操作。
external-locking = FALSE
max_allowed_packet = 16M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 256
interactive_timeout = 3600
wait_timeout = 3600
tmp_table_size = 32M
max_heap_table_size = 32M
slow_query_log = 1
log_timestamps = SYSTEM
slow_query_log_file = /opt/slowsql/slow3401
log-error = /opt/mysql3401/data/error.log
long_query_time = 1
log_queries_not_using_indexes =1
log_throttle_queries_not_using_indexes = 60
min_examined_row_limit = 100
log_slow_admin_statements = 1
log_slow_slave_statements = 1
log-bin = /opt/mysql3401/logs/mysql-bin
sync_binlog = 1
binlog_cache_size = 4M
max_binlog_cache_size = 2G
max_binlog_size = 1G
expire_logs_days = 3
master_info_repository = TABLE
relay_log_info_repository = TABLE
gtid_mode = on
enforce_gtid_consistency = 1
log_slave_updates

slave parallel
slave_parallel_type=LOGICAL_CLOCK
slave_parallel_workers=4

slave-rows-search-algorithms = ‘INDEX_SCAN,HASH_SCAN’
slave_net_timeout=10
binlog_format = row
binlog_checksum = 1
relay_log_recovery = 1
relay-log-purge = 1
relay-log=relay-bin
key_buffer_size = 32M
read_buffer_size = 8M
read_rnd_buffer_size = 4M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
lock_wait_timeout = 3600
explicit_defaults_for_timestamp = 1
innodb_thread_concurrency = 0
max_length_for_sort_data = 4096
skip-slave-start

percona thread pool
thread_handling = pool-of-threads
thread_pool_max_threads = 10000
thread_pool_oversubscribe = 900
thread_pool_size = 20
thread_pool_stall_limit = 10

audit log
server_audit_file_path = /opt/slowsql/server_audit.3401.log
server_audit_file_rotate_now = ON
server_audit_file_rotate_size = 1G
server_audit_events = QUERY_DDL,QUERY_DML_NO_SELECT,TABLE
server_audit_logging = ON

transaction_isolation = REPEATABLE-READ
innodb_buffer_pool_size = 8G
innodb_buffer_pool_instances = 4
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_data_file_path = ibdata1:1G:autoextend
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 32M
innodb_log_file_size = 2G
innodb_log_files_in_group = 2
innodb_max_undo_log_size = 4G
innodb_undo_directory = /opt/mysql3401/data/undolog
innodb_undo_tablespaces = 95

innodb_io_capacity = 4000
#innodb_io_capacity_max = 8000
innodb_flush_sync = 0
innodb_flush_neighbors = 0
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_purge_threads = 4
innodb_page_cleaners = 4
innodb_open_files = 65535
innodb_max_dirty_pages_pct = 50
innodb_flush_method = O_DIRECT
#innodb_lru_scan_depth = 4000
innodb_checksum_algorithm = crc32
innodb_lock_wait_timeout = 10
innodb_rollback_on_timeout = 1
innodb_print_all_deadlocks = 1
innodb_file_per_table = 1
innodb_online_alter_log_max_size = 4G
innodb_stats_on_metadata = 0
innodb_undo_log_truncate = 1
internal_tmp_disk_storage_engine = InnoDB

some var for MySQL 5.7
innodb_checksums = 1
#innodb_file_format = Barracuda
#innodb_file_format_max = Barracuda
query_cache_size = 0
query_cache_type = 0
#innodb_undo_logs = 128

innodb_status_file = 1
innodb_status_output = 0
innodb_status_output_locks = 1

innodb_sort_buffer_size = 67108864
innodb_autoinc_lock_mode = 1

performance_schema
performance_schema = 1
#performance_schema_instrument = ‘%memory%=on’
#performance_schema_instrument = ‘%lock%=on’

innodb monitor
innodb_monitor_enable=”module_innodb”
innodb_monitor_enable=”module_server”
innodb_monitor_enable=”module_dml”
innodb_monitor_enable=”module_ddl”
innodb_monitor_enable=”module_trx”
innodb_monitor_enable=”module_os”
innodb_monitor_enable=”module_purge”
innodb_monitor_enable=”module_log”
innodb_monitor_enable=”module_lock”
innodb_monitor_enable=”module_buffer”
innodb_monitor_enable=”module_index”
innodb_monitor_enable=”module_ibuf_system”
innodb_monitor_enable=”module_buffer_page”
innodb_monitor_enable=”module_adaptive_hash”

group commit
binlog_group_commit_sync_delay=100
binlog_group_commit_sync_no_delay_count=10
binlog_order_commits=off

rpl_semi_sync
#rpl_semi_sync_master_enabled=1 # 0
#rpl_semi_sync_slave_enabled=1 # 0
#rpl_semi_sync_master_timeout=1000 # 10000
#rpl_semi_sync_master_wait_point=AFTER_COMMIT # AFTER_SYNC

sql_mode=’’

[mysqldump]
quick
max_allowed_packet = 32M