~]# vim /etc/my.cnf.d/mysql-server.cnf
[mysqld]
server-id=48
~]# systemctl restart mysqld
~]# mysql
> show master logs;
binlog.000002 | 156 | No
> create user repluser@'11.0.1.%' identified by '123456';
> grant replication slave on *.* to repluser@'11.0.1.%';
> show master logs;
| binlog.000002 | 681 | No |
~]# vim /etc/my.cnf.d/mysql-server.cnf
[mysqld]
server-id=68
~]# systemctl restart mysqld
~]# mysql
> help change master to
> CHANGE MASTER TO
MASTER_HOST='11.0.1.48',
MASTER_USER='repluser',
MASTER_PASSWORD='123456',
MASTER_PORT=3306,
MASTER_LOG_FILE='binlog.000002',
MASTER_LOG_POS=681,
MASTER_CONNECT_RETRY=10;
> start slave;
> show slave status\G