# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[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 # # 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
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[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 # # 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 中的操作 =========================== #添加权限 GRANT REPLICATION SLAVE,FILE,REPLICATION CLIENT ON *.* TO 'repluser'@'%' IDENTIFIED BY '123456';
#刷新权限 FLUSH PRIVILEGES;
#退出MySQL quit; #==================== 在 MySQL 中的操作 ===========================
#退出docker容器 exit
#重启容器 docker restart mysqlm1
#查看m1的binlog信息(需要进入docker容器,然后再登录MySQL执行) show master status;
#语法 change master to master_host='通过宿主机访问master的ip',master_port=docker对外暴露的宿主机master的端口号,master_user='repluser',master_password='123456',master_log_file='master中的binlob文件',master_log_pos=master中的position位置信息; #命令 change master to master_host='192.168.2.128',master_port=10000,master_user='repluser',master_password='123456',master_log_file='mysql-bin.000001',master_log_pos=487;
change master to master_host=’192.168.2.128’,master_port=10000,master_user=’repluser’,master_password=’123456’,master_log_file=’mysql-bin.000002’,master_log_pos=154;
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld] # # Remove leading # andsetto the amount of RAM for the most important data # cache in MySQL. Startat70%of total RAM for dedicated server, else10%. # 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 # # Remove leading # toset 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
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld] # # Remove leading # andsetto the amount of RAM for the most important data # cache in MySQL. Startat70%of total RAM for dedicated server, else10%. # 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 # # Remove leading # toset 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
#设置m3。因为m3要去连m2,所以这里要设置m2的IP地址和端口号。 change master to master_host='192.168.198.120',master_port=30000,master_user='repluser',master_password='123456',master_log_file='mysql-bin.000001',master_log_pos=1104;