一、maridb 安装略
二、主:
1、停止服务
2、vi /etc/my.conf.d/server.conf
[mysqld]
log-bin=/mydata/binlogs/master-bin
binlog_format=mixed
server-id = 1
3、
# mkdir -pv /mydata/binlogs/
# chown -R mysql:mysql /mydata/binlogs/
4、启动服务
mysql -hxxxxx -uroot -pxxxx
#授权给从服务器访问权限
grant replication slave,replication client on *.* to '用户'@'10.19.90.111' identified by '密码';
flush privileges;
三、从
1、停止服务
2、vi /etc/my.conf.d/server.conf
[mysqld]
server-id = 2
relay-log=/mydata/relaylogs/relay-bin
3、# mkdir /data/relaylogs/
# chown -R mysql.mysql /data/relaylogs 4、
重启mysql服务:
# service mysqld restart
再连到从服务器的mysql服务器上:
# mysql -uroot -hlocalhost -p
查看一下从服务器的中继日志是否在启动状态:
MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE '%relay%';
5、
CHANGE MASTER TO MASTER_HOST='10.2.104.61', MASTER_USER='root',MASTER_PASSWORD='xxxx';
6、start slave;