Home > Database > Mysql Tutorial > MySQL master热备份 开启主从复制_MySQL

MySQL master热备份 开启主从复制_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:44:07
Original
1233 people have browsed it

bitsCN.com

 

1 开启binlog

mysql

server-id                       = 151

log-bin                         =/opt/soft/mysql/binlog/mysql-bin

binlog_format                    = MIXED

2 获得基础备份

/opt/soft/mysql/bin/mysqldump -p123456 --single-transaction --master-data=2 AdDataCenter | gzip >AdDataCenter.sql.gz

3 开通用于binlog 复制的 用户

GRANT REPLICATION SLAVE ON *.* TO'repat152'@'192.168.%'  IDENTIFIED BY'123456';

4到从机上恢复数据库

gzip –cd AdDataCenter.sql.gzip | opt/soft/mysql/bin/mysql –p123456 AdDataCenter

5 设置复制库选项

gzip -cd AdDataCenter.sql.gz | grep -i"CHANGE MASTER TO"

得到binlog 文件和binlog pos

CHANGEMASTER TO MASTER_HOST='master_host_name',MASTER_USER='replication_user_name',MASTER_PASSWORD='replication_password',MASTER_LOG_FILE='recorded_log_file_name',ASTER_LOG_POS=recorded_log_position;

6 开启从库复制

Start slave

 

摘自 ylqmf的专栏

bitsCN.com
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 Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template