Reference
Setting Up Binary Log File Position Based Replication
配置步骤
NOTE Certain steps within the setup process require the SUPER privilege. If you do not have this privilege, it might not be possible to enable replication.
There are some generic tasks that are common to all setups:
On the master, you must enable binary logging and configure a unique server ID. This might require a server restart. See Section 16.1.2.1, “Setting the Replication Master Configuration”.
为了使用 replication,必须开启 log-bin & server-id,配置完成需要重启MySQL
配置 master
[mysqld]
log-bin=mysql-bin
server-id=1
NOTE
如果没有 server-id,master 将拒绝slave连接
为了最大的满足 持久性 和 一致性 ,应该在master里配置
innodb_flush_log_at_trx_commit=1
和sync_binlog=1
确保
skip-networking
未启用。 如果网络被禁用,复制将会失败
replication 应该是采用 TCP/IP 的方式进行传输
具体可以看看MySQL连接方式:TCP/IP, SOCKET
连接不指定ip或使用localhost,应该走 socket
- 其他走 TCP/IP
On each slave that you want to connect to the master, you must configure a unique server ID. This might require a server restart. See S