Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos7-mysql-binlog-bump- backup and restore

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Mysql backup is generally full database backup + binlog log incremental backup.

Perform a full library every few days and an incremental backup a few hours a day.

Binlog log

This binary log file records all the additions, deletions and modifications in the database..

The effect is

1, master-slave synchronization

2, reply to the database

Binlog enables vim my.cnf

Log-bin=/usr/local/mysql/data/mysql-bin specifies the location of the log file and enables the binlog function

Mysqlbinlog-v log file, you can view the contents of the log file

The mysql-bin.index file stores the location and name of the binlog log file

Backup and restore of binlog

Backup

Mysqlbinlog-v file name > file name. sql backs up the entire binlog file

Mysqlbinlog-v-- stop-position=300 / * / mysql-bin.000003 > / 300.sql back up a thousand 300 events of a binlog file as a 300.sql file

Mysqlbinlog-v-- start-position=600 / * / mysql-bin.000003 > / 600.sql stores the binlog files from the beginning to the end in 600.sql

Skipping is usually used to skip the wrong operation.

Reduction

Mysql-uroot-p123456

< /文件名字.sql 要按照顺序来执行,顺序错了回复的也会有问题 ------------------------------------------------------------------------- mysqldump mysql自带的备份工具 主要是将要把备份表的数据导出,成为sql脚本文件,算是逻辑备份 一般数据量少的情况下会选择mysqldump备份,如果量大就推荐其他备份工具了. mysqldump -uroot -p123456 --all-databases >

/ gao.sql back up all

-- databases library name > gao.sql backup a single library

Library name Table name > gao.sql back up a single table

Mysql-uroot-p123456

< gao.sql 还原 --------------------------------------------------------------------------- 一般在生产环境下,备份都是使用脚本完成的,方便快捷,而且数据库一般晚上会是低峰期,所以通常备份在晚上 一个完整备份的脚本,因为虚拟机没有安装其他软件,所以如果需要微信,或者邮箱提醒,可以后期再加

There is also an incremental backup of binlog

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report