Home > Database > Mysql Tutorial > Introduction to master-slave configuration in mysql server

Introduction to master-slave configuration in mysql server

一个新手
Release: 2017-09-08 10:18:22
Original
1512 people have browsed it

Log files: binlog, slow query log, query log, error log innodb redo log, transaction log data files: .frm file, .MYD file, .MYI file , .ibd file and ibdata file Replication related files: master.info file, relay log and relay log index, relay_log_info_file configuration file: my.cnf, pid file, socket file1. Shutdown
mysqladmin -uroot -p shutdown
From the library

cd $MYSQL_HOME
mysql -uroot -p
Copy after login

Verification parameters show variables like '%read_only%';
The result should be ON (the slave library and disaster recovery should be ON, and the main library should be OFF)"

"Export the entire master library

mysqldump  --login-path=root --socket=/var/mysql.sock --default-character-set=UTF8 --single-transaction --events --triggers --routines --all-databases > all_databases.sql
Copy after login

2. Import the slave library
First execute reset master;
then import

mysql -uroot -p --protocol=TCP --port=  <all_databases.sql &
Copy after login

Use root to log in and refresh the permission table
flush privileges;"

3. Test the connection

"mysql -udbsync -pPaic1234 -h10.31.224.103 --protocol=TCP --port=3938
10.31.9.241为主机物理IP"
Copy after login

"

change master to
master_host=&#39;...&#39;,
master_user=&#39;****&#39;,
master_password=&#39;****&#39;,
master_port=38,
master_auto_position = 1;"
Copy after login

4 ."show slave status\G
Look at the following 2 lines        

  Slave_IO_Running: Yes            
  Slave_SQL_Running: Yes"
Copy after login

The above is the detailed content of Introduction to master-slave configuration in mysql server. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template