maradb master-slave synchronization

1. The installation of maridb

Two, Lord:

1. Stop the service

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. Start the service

 

 

mysql -hxxxxx -uroot -pxxxx
#Grant access to the slave server
grant replication slave,replication client on *.* to '用户'@'10.19.90.111' identified by '密码';
flush privileges;

 

 

Third, from

1. Stop the service

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、
Restart the mysql service:
   # service mysqld restart
   Then connect to the mysql server of the slave server:
   # mysql -uroot -hlocalhost -p
   Check to see if the slave's relay log is up:
   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;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326368840&siteId=291194637