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

Introduction to master-slave configuration in mysql server

一个新手
一个新手Original
2017-09-08 10:18:221517browse

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

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

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

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

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"

"

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

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

  Slave_IO_Running: Yes            
  Slave_SQL_Running: Yes"

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!

Statement:
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