码迷,mamicode.com
首页 > 数据库 > 详细

mysql5.7 主从

时间:2016-06-27 12:27:39      阅读:323      评论:0      收藏:0      [点我收藏+]

标签:5.7 主从

1.主my.cnf
[client]
port = 3306
socket = /opt/3306/mysql.sock
character-set-server = utf8
  
[mysql]
no-auto-rehash
  
[mysqld]
user    = mysql
port    = 3306
character-set-server = utf8
socket  = /opt/3306/mysql.sock
basedir = /opt/mysql
datadir = /opt/3306/data
explicit_defaults_for_timestamp = true
skip-ssl
secure-file-priv = NULL
lower_case_table_names = 1
back_log = 300
max_connections = 3000
max_connect_errors = 100
table_open_cache = 4096
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 16M
join_buffer_size = 16M
thread_cache_size = 16
query_cache_size = 128M
query_cache_limit = 4M
ft_min_word_len = 8
thread_stack = 512K
transaction_isolation = REPEATABLE-READ
tmp_table_size = 128M
max_heap_table_size = 128M
  
###*** slow query parameters
long_query_time = 6
slow_query_log
slow_query_log_file = /opt/3306/slow.log
  
###*** binlog parameters
log-bin = /opt/3306/mysql-bin
binlog_cache_size = 4M
max_binlog_cache_size = 256M
max_binlog_size = 32M
#binlog_format = MIXED
binlog_format = row
expire_logs_days = 7
  
###*** relay-log parameters
#relay-log = /opt/3307/relay-bin
#relay-log-info-file = /opt/3307/relay-log.info
#master-info-repository = table
#relay-log-info-repository = table
#relay-log-recovery = 1
  
#*** MyISAM parameters
key_buffer_size = 16M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 1M
  
#skip-name-resolve
  
###*** master-slave replication parameters
server-id = 1
slave-skip-errors = all
  
#*** Innodb storage engine parameters
innodb_buffer_pool_size = 2G
innodb_data_file_path = ibdata1:10M:autoextend
#innodb_file_io_threads = 8
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 512M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = on
  

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


gtid-mode=on
enforce-gtid-consistency=true

master-info-repository=TABLE
relay-log-info-repository=TABLE
sync-master-info=1
slave-parallel-workers=2
binlog-checksum=CRC32
master-verify-checksum=1
slave-sql-verify-checksum=1
binlog-rows-query-log_events=1


report-port=3306
report-host=ip  ######填写自己的ip

connect-timeout = 60
wait-timeout = 28800
net_buffer_length = 16384
thread_stack = 192K
#thread_concurrency = 128
query_cache_min_res_unit = 2

default-time-zone = system
character-set-server = utf8
default-storage-engine = InnoDB
max_relay_log_size = 1G


[mysqldump]
quick
max_allowed_packet = 32M
  
[myisamchk]
key_buffer = 16M
sort_buffer_size = 16M
read_buffer = 8M
write_buffer = 8M
  
[mysqld_safe]
open-files-limit = 8192
log-error=/opt/3306/mysql_3306.err
pid-file=/opt/3306/mysqld.pid


本文出自 “人,要有自己的想法” 博客,请务必保留此出处http://szgb2016.blog.51cto.com/340201/1793140

mysql5.7 主从

标签:5.7 主从

原文地址:http://szgb2016.blog.51cto.com/340201/1793140

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!