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

How to use mysqlbinlog backup binlog to build Binlog Server

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article is about how to use mysqlbinlog backup binlog to build Binlog Server. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Binlog is one of the prerequisites for incremental backups, and in some scenarios, real-time or regular backups of binlog are necessary.

In fact, the official mysqlbinlog comes with this feature.

0 commonly used parameters:

-R |-- read-from-remote-server means to enable binlog backup and request binlog locally on the corresponding master node.

-- the copied binlog of raw is stored in binary format, or in text format if this parameter is not added.

-r |-- result-file specifies the directory or file name:

If the-- raw parameter is specified, the value of-r specifies the binlog directory and file name prefix; if the-- raw parameter is not specified, the value of-r specifies the directory and file name where the text is stored.

The-t option represents pulling from the specified binlog to the last binlog on the current primary node.

-- stop-never continuously pulls binlog from the primary node, backs up to the current last one, and continues. This parameter contains-t

-- the default value of stop-never-slave-server-id is 65535, which is used to avoid ID conflicts in the case of multiple mysqlbinlog processes or slaves.

When mysqlbinlog starts backup, it does not end until the connection is closed or the kill is forced.

You can see the backup process that has been started through ps.

Usage example: pull the binlog of the remote server locally and store it in the / data/backup_binlog directory intact and intact.

Note that the directory specified by-r must be fully written, otherwise it will be placed under the / data directory and named binlog with the prefix "backup_binlog"

For example:-r / data/backup_binlog will be displayed as / data/backup_binlogmysql-bin.000008

Mkdir-p / data/backup_binlog

Mysqlbinlog-h$ip-P$port-u$user-p$password-R-raw-- stop-never mysql-bin.000008-r / data/backup_binlog/ &

[root@sAno1y backup_binlog] # mysql-h$ip-P$port-u$user-p$password-e "SHOW BINARY LOGS"

Mysql: [Warning] Using a password on the command line interface can be insecure.

+-+ +

| | Log_name | File_size |

+-+ +

| | mysql-bin.000008 | 1073742873 | |

| | mysql-bin.000009 | 284594590 | |

| | mysql-bin.000010 | 396303459 | |

| | mysql-bin.000011 | 154 | |

| | mysql-bin.000012 | 154 | |

| | mysql-bin.000013 | 154 | |

+-+ +

Check the pulled binlog, which is consistent with the show binary logs result.

[root@sAno1y backup_binlog] # ll

Total 1713580

-rw-r- 1 root root 1073742873 Aug 22 17:12 mysql-bin.000008

-rw-r- 1 root root 284594590 Aug 22 17:13 mysql-bin.000009

-rw-r- 1 root root 396303459 Aug 22 17:13 mysql-bin.000010

-rw-r- 1 root root 154 Aug 22 17:13 mysql-bin.000011

-rw-r- 1 root root 154 Aug 22 17:13 mysql-bin.000012

-rw-r- 1 root root 154 Aug 22 17:13 mysql-bin.000013

Thank you for reading! This is the end of this article on "how to use mysqlbinlog backup binlog to build Binlog Server". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

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