主配置
[mysqld] #主数据库端ID号 server_id = 1 #开启二进制日志 log-bin=mysql-bin #需要复制的数据库名,如果复制多个数据库,重复设置这个选项即可 binlog-do-db = base binlog-do-db = temp1 binlog-do-db = temp2 binlog-do-db = temp3 binlog-do-db = temp4 binlog-do-db = temp5 binlog-do-db = temp6 binlog-do-db = nacos_config binlog-do-db = xxl_job binlog-ignore-db = mysql binlog-ignore-db = performance_schema binlog-ignore-db = information_schema binlog-ignore-db = sys #将从服务器从主服务器收到的更新记入到从服务器自己的二进制日志文件中 log-slave-updates #这个参数一般用在主主同步中,用来错开自增值, 防止键值冲突 auto_increment_offset = 1 #这个参数一般用在主主同步中,用来错开自增值, 防止键值冲突 auto_increment_increment = 1 #二进制日志自动删除的天数,默认值为0,表示“没有自动删除”,启动时和二进制日志循环时可能删除 expire_logs_days = 15 #将函数复制到slave log_bin_trust_function_creators = 1 skip-name-resolve max_allowed_packet = 1G max_connections=1000 max_user_connections=500 wait_timeout=12000
从配置
[mysqld] server_id = 2 log-bin = mysql-bin log-slave-updates #log buffer将每秒一次地写入log file中,并且log file的flush(刷到磁盘)操作同时进行。该模式下在事务提交的时候,不会主动触发写入磁盘的操作 innodb_flush_log_at_trx_commit = 0 #指定slave要复制哪个库 replicate-do-db = base replicate-do-db = temp1 replicate-do-db = temp2 replicate-do-db = temp3 replicate-do-db = temp4 replicate-do-db = temp5 replicate-do-db = temp6 replicate-do-db = xxl_job replicate-do-db = nacos_config #MySQL主从复制的时候,当Master和Slave之间的网络中断,但是Master和Slave无法察觉的情况下(比如防火墙或者路由问题)。Slave会等待slave_net_timeout设置的秒数后,才能认为网络出现故障,然后才会重连并且追赶这段时间主库的数据 slave-net-timeout = 60 log_bin_trust_function_creators = 1 skip-name-resolve max_allowed_packet = 1G max_connections=1000 max_user_connections=500 wait_timeout=12000 max_connect_errors = 100
标签:do,主从复制,log,binlog,max,db,replicate,mysql From: https://www.cnblogs.com/aidaminiu/p/16626174.html