mysql 5.6 gtid复制

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql 5.6 gtid复制相关的知识,希望对你有一定的参考价值。

grant replication slave on *.* to [email protected]‘ip‘ identified by ‘xxx‘;

flush privileges;


change master to master_host=‘192.168.1.103‘,master_port=3306,master_user=‘repl‘,master_password=‘ffffff‘,master_auto_position=1;

start slave;

show slave status\G


my.cnf文件

# For advice on how to change settings please see

# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

[client]

port = 3306

socket = /tmp/mysqld1.sock


[mysqld]


# Remove leading # and set to the amount of RAM for the most important data

# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.

# innodb_buffer_pool_size = 128M


# Remove leading # to turn on a very important data integrity option: logging

# changes to the binary log between backups.

# log_bin


# These are commonly set, remove the # and set as required.

basedir = /usr/local/mysql1

datadir = /data/mysql1

port = 3306

socket = /tmp/mysqld1.sock


server-id = 1


#binlog

log-bin = /data/mysql1/logs/mysql1-bin

binlog_format = row

binlog-row-image = minimal

binlog_cache_size = 512K

max_binlog_size = 100M

gtid-mode=on

enforce-gtid-consistency=true

log-slave-updates=true

slave_parallel_workers = 2


sync_binlog = 1


#relay log

relay-log = /data/mysql1/logs/relay1-log

max_relay_log_size = 100M


#check binlog

binlog_checksum = CRC32

slave_allow_batching = 1

master_verify_checksum = 1

slave_sql_verify_checksum = 1


binlog_rows_query_log_events = 1

master-info-repository=TABLE

relay-log-info-repository=TABLE

sync-master-info=1


binlog-ignore-db=mysql

binlog-ignore-db=information_schema

binlog-ignore-db=performance_schema

replicate-ignore-db=mysql

replicate-ignore-db=information_schema

replicate-ignore-db=performance_schema

auto-increment-increment=10

auto-increment-offset=1



# Remove leading # to set options mainly useful for reporting servers.

# The server defaults are faster for transactions and fast SELECTs.

# Adjust sizes as needed, experiment to find the optimal values.

# join_buffer_size = 128M

# sort_buffer_size = 2M

# read_rnd_buffer_size = 2M 


以上是关于mysql 5.6 gtid复制的主要内容,如果未能解决你的问题,请参考以下文章

mysql 5.6 gtid复制

(5.6)mysql高可用系列——MySQL中的GTID异步复制

5.6版本GTID复制异常处理一例(转)

mysql之 mysql 5.6不停机主从搭建(一主一从基于GTID复制)

MySQL的GTID复制

MySQL 5.6 GTID+MHA