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 does Mysql remotely back up binlog logs locally

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

Share

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

This article focuses on "how Mysql remotely backs up binlog logs to the local", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to remotely back up binlog logs locally by Mysql".

MySQL Binlog Server: is to use a tool to pull the logs of online active libraries to the local backup. After MySQL 5.6, you can use the mysqlbinlog command to back up the logs of remote machines to a local directory, thus achieving incremental or log security backups.

Making a good backup of MySQL logs is an important guarantee of data security. In the past, it was achieved by writing programs, but since the emergence of MySQL 5.6, DBA synchronization has been blessed and there is no need to write programs.

Let's talk about how to build binlog Server.

Using the mysqlbinlog command of mysql 5.6, you can place a complete image of the remote binlog locally as follows:

[root@hostnfsd: / root] $mysqlbinlog-R-raw-host=192.168.1.56-user='atlas_user'-password='ionm3aUwK98N45nH'-port=3307-stop-never mysql-bin.000001

Explain:

-R-read-from-remote-server means to read binlog from a remote machine. To ensure remote mysql storage, you need to provide-host,-user,-password parameters.

-raw stores logs in binlog format for later use

-stop-never is connected to the remote server to read the log, and will not exit until the remote server is closed. Or be dropped by pkill.

The log name mysql-bin.0000001 indicates that reading starts from that log.

If you need to start multiple binlog server, you need to specify server-id for binlog server (default is 65535). You can use-stop-never-slave-server-id to change

Start a binlog server with a server-id of 1:

/ usr/local/mysql/bin/mysqlbinlog-R-raw-host=192.168.11.100-user='repl'-password='repl4slave'-stop-never-stop-never-slave-server-id=1 mysql-bin.000003

Start a binlog server with server-id 2:

/ usr/local/mysql/bin/mysqlbinlog-R-raw-host=192.168.11.100-user='repl'-password='repl4slave'-stop-never-stop-never-slave-server-id=2 mysql-bin.000003

At this point, I believe you have a deeper understanding of "how Mysql remotely backs up binlog logs to the local". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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