MySQL5.7 关键参数配置

# general
server_id=1
max_connections=1000
skip-name-resolve
open_files_limit=65535
character-set-server=utf8mb4

# log
log_timestamps=system
binlog_format=row
log_bin=mysql01-bin
slow_query_log=1
long_query_time=2
slow_query_log_file=slow.log
relay-log=relay-bin
expire-logs-days=7

# innodb
innodb_buffer_pool_size=512M
innodb_log_file_size=1024M
innodb_log_files_in_group=3
innodb_buffer_pool_instances=4
innodb_read_io_threads=8
innodb_write_io_threads=8
sort_buffer_size=2M
read_rnd_buffer_size=2M

# master slave
gtid_mode=on
enforce_gtid_consistency=on
log_slave_updates=1
slave_parallel_type=logical_clock
slave_parallel_workers=8
innodb_flush_log_at_trx_commit=1
sync_binlog=1  #每一个transaction commit都会调用一次fsync(),此时能保证数据最安全但是性能影响较大。

从节点设置只读

read_only=on
super_read_only=on

开启binlog一定要有server-id

转载于:https://blog.51cto.com/linux10000/2154113

你可能感兴趣的:(MySQL5.7 关键参数配置)