Configure the Mysql Master/Slave service implementation instance,

Source: Internet
Author: User

Configure the Mysql Master/Slave service implementation instance,

Configure the Mysql Master/Slave service implementation instance

### Configure the primary database my. cnf

server-id=1log-bin=master-binlog-bin-index=master-bin.index

### Create a synchronization account on the primary database

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

### Configure the slave database my. cnf

server-id=2relay-log-index=slave-relay-bin.indexrelay- log=slave-relay-bin

### Restart the mysql Service

service mysqld restart

### 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;

### Start the slave Service

start slave;

### View Master service status

SHOW MASTER STATUS;

### View the Slave service status

SHOW slave STATUS \G;

### Check whether server_id is the same and need to be different

show variables like 'server_id';

Common Errors

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

Solution:Check whether server-uuid = ****************************** in auto. cnf in the data directory is the same.

Thank you for reading this article. I hope it will help you. Thank you for your support for this site!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.