MySQL 中怎么利用master实现热备份

40次阅读
没有评论

共计 815 个字符,预计需要花费 3 分钟才能阅读完成。

本篇文章为大家展示了 MySQL 中怎么利用 master 实现热备份,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。

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 到从机上恢复 www.2cto.com

gzip ndash;cd AdDataCenter.sql.gzip | opt/soft//bin/mysql ndash;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

上述内容就是 MySQL 中怎么利用 master 实现热备份,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注丸趣 TV 行业资讯频道。

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-03发表,共计815字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)