mysql mysql>show master logs mysql>grant replication slave on *.* to repluser@'192.168.31.%' identified by ‘centos'; mysql>grant all on *.* to mhauser@‘192.168.190.%’ identified by ‘magedu‘; show variables like '%semi%'; 5、slave1节点和slave2节点 vim /etc/my.cnf [mysqld] server_id=2 不同节点此值各不相同 log-bin read_only 只读,对超级用户无效,主坏切换为主时,全局变量会变 relay_log_purge=0 不删除中继日志 skip_name_resolve=1 不解析主机名,通过ip连接 plugin_load = "rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so" 加载半同步复制的插件,主从的都装,主坏,从顶上时实现半同步 loose_rpl_semi_sync_master_enabled = 1 开启主的半同步功能 loose_rpl_semi_sync_slave_enabled = 1 开启从的半同步功能 loose_rpl_semi_sync_master_timeout = 5000