Configure Mysql master-slave service instance

小云云
Release: 2018-01-13 14:23:09
Original
1637 people have browsed it

This article mainly introduces the relevant information for configuring Mysql master-slave service implementation examples. Friends who need it can refer to it. I hope it can help everyone.

Configure Mysql master-slave service implementation instance


Configure the master database my.cnf


server-id=1 log-bin=master-bin log-bin-index=master-bin.index
Copy after login

Create a synchronization account on the master database



create user backup; GRANT REPLICATION SLAVE ON *.* TO 'backup'@'192.168.%.%' IDENTIFIED BY 'mysql';
Copy after login

Configure the slave database my.cnf


server-id=2 relay-log-index=slave-relay-bin.index relay- log=slave-relay-bin
Copy after login


Restart the mysql service


service mysqld restart
Copy after login

Connect to the Master service



change master to master_host='192.168.91.128', master_port=3306,master_user='backup',master_password='mysql', master_log_file='master-bin.000001',master_log_pos=0;
Copy after login

Start slave service


start slave;
Copy after login


Check Master service status


SHOW MASTER STATUS;
Copy after login

Check the Slave service status


SHOW slave STATUS \G;
Copy after login

Check whether the server_id is the same, it needs to be different


show variables like 'server_id';
Copy after login

Common Errors


Error:

Fatal error: The slave I/O thread stops because master and slave have equal MySQL server UUIDs; these UUIDs must be different for replication to work.

Solution:

Check the server-uuid in auto.cnf in the data directory =******************** Whether they are the same, change it to differentRelated recommendations:

Mysql master-slave server architecture configuration

#########Mysql master-slave server configuration special issues############MySQL database configuration master-slave server to achieve dual-machine hot backup Example tutorial######

The above is the detailed content of Configure Mysql master-slave service instance. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!