node2:mysql master配置如下:
编辑/etc/my.cnf
innodb_file_per_table = 1
skip_name_resolve = 1
log-bin = master-bin
relay-log = relay-bin
server-id = 1
启动服务执行如下操作:
systemctl start mariadb.service
授权一个有所有权限的账号:
grant all on *.* to 'mhauser'@'10.1.10.%' identified by 'cncn'
授权一个有复制功能的账号:
grant replication slave,replication client on *.* to 'repluser'@'10.1.10.%' identified by 'cncn'
flush privileges;
node3:mysql slave1
编辑/etc/my.cnf配置文件;
innodb_file_per_table = 1
skip_name_resolve = 1
log-bin = master-bin
relay-log = relay-bin
server-id = 3
read-only = 1
relay-log-purge = 0
启动服务执行如下操作:
systemctl start mariadb.service
change master to MASTER_HOST='10.1.10.66',MASTER_USER='repluser',MASTER_PASSWORD='cncn',MASTER_LOG_FILE='master-bin.000001',MASTER_LOG_POS=245;
start slave
node4:mysql slave2
编辑/etc/my.cnf配置文件;
innodb_file_per_table = 1
skip_name_resolve = 1
log-bin = master-bin
relay-log = relay-bin
server-id = 4
read-only = 1
relay-log-purge = 0
启动服务执行如下操作:
systemctl start mariadb.service
change master to MASTER_HOST='10.1.10.66',MASTER_USER='repluser',MASTER_PASSWORD='cncn',MASTER_LOG_FILE='master-bin.000001',MASTER_LOG_POS=245;
start slave;