MySQL Master and Slave Copy

1. Install MySQL on the server hosting the main library manager (192.168.1.101) and from the dependent library (192.168.1.103).

2. Perform the following configuration in the wizard:

Server-ID = 1 # идентификатор узла, убедитесь, что уникальный
# log config
 log-bin = mysql-bin #open mysql
log-bin-index = mysql-bin.index

6cfe51fd0600c89eef7e05442085c5a1
3. Create an account and grant permissions

create user repl IDENTIFIED BY 'yourpassword';
grant replication slave on *.* to 'repl'@'192.168.1.103'  identified by 'yourpassword';
FLUSH PRIVILEGES;

1b89b5f60323ad82510900e8f3087af6

4. Reload the database and execute the main view state; As follows

96458aecfdaa3556db17397ea3300a25

5. Perform the following configuration and restart from the library

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

750ed9ec62c1158cedc8f236eb75bdc7

6. Install the library

CHANGE MASTER TO MASTER_HOST = '192.168.1.101', MASTER_USER = 'repl', MASTER_PASSWORD = 'yourpassword', MASTER_PORT = 3306, MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=569, MASTER_RETRY_COUNT = 60, MASTER_HEARTBEAT_PERIOD = 10000;

9543c53f323fa0cd8f4896936255487b

7. Begin the process of submission, and start the slaves.

b26581f6d1b633f774fc86ff22e67b7a

8. Check whether the master library file and position match the slave library, and then prove that the master and slave are synchronized

66d3d38a61b4f2e28d16726b5b1c71db

d8d193c5856ab9c51454da4dd9b0b83b

Leave a Comment