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

[MySQL] backup binary log-Binlog Server

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

Share

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

The mysqlbinlog will disguise as a slave and connect to the specified binlog file requested by the main library. After receiving this request, the main library creates a binlog dump thread to push the binlog to the mysqlbinlog server. [root@wallet01] # mysql-uroot-pabcd.1234mysql > grant replication slave on *. * to 'repl'@'%' identified by' repl';Query OK, 0 rows affected (0.08 sec) mysql > flush privileges; Query OK, 0 rows affected (0.03 sec) mysql > show binary logs +-+ | Log_name | File_size | +-+-+ | mysql-bin.000001 | 67152168 | | mysql-bin.000002 | 67138954 | mysql-bin.000003 | 67133196 | | mysql-bin.000004 | 67146060 | | mysql-bin.000005 | 67172089 | | mysql-bin.000006 | | 12159668 | +-+-+ 6 rows in set [root@wallet02 ~] # su-mysql [mysql@wallet02 ~] $mkdir binlog [mysql@wallet02 ~] $nohup mysqlbinlog-R-raw-host=192.168.40.34-user=repl-password=repl-port=3306\-stop-never mysql-bin.000001-r / home/mysql/binlog/& [mysql@wallet02 ~] | ] $cd binlog [mysql@wallet02 binlog] $ls-lhtotal 340M Murray r-1 mysql mysql 65M Sep 17 14:06 mysql-bin.000001-rw-r- 1 mysql mysql 65M Sep 17 14:06 mysql-bin.000002-rw-r- 1 mysql mysql 65M Sep 17 14:06 mysql-bin.000003-rw-r- 1 mysql mysql 65M Sep 17 14:06 mysql-bin.000004-rw-r- 1 mysql mysql 65m Sep 17 14:06 mysql-bin.000005-rw-r- 1 mysql mysql 20m Sep 17 14:06 mysql-bin.000006 Parameter Resolution-R -- read-from-remote-server: represents reading binlog from a remote mysql server. -- raw: requires-R. The copied binlog is stored in binary format, or in text format if this parameter is not added. -- stop-never: mysqlbinlog can only get a few specified binlog from a remote server, or it can save the continuously generated binlog locally. Specifying this option means that mysqlbinlog will continue to replicate binlog on the remote server as long as the remote server is not shut down or the connection is not disconnected. -- to-last-log: it means that mysqlbinlog can obtain not only the specified binlog, but also the generated binlog, which will not be terminated until it is finished. If the-- stop-never option is specified, the-- to-last-log option is implicitly turned on. Mysql-bin.000091: represents the binlog from which to start the replication. -- stop-never-slave-server-id: when backing up the binlog of a remote server, mysqlbinlog is essentially a slave server, and this option is used to specify the server-id of the slave server. -r,-- result-file=name: used to set the binlog of the remote server, saved to the local prefix. For example, for mysql-bin.000001, if you specify-- result-file=/test/backup-, the file name saved locally is / test/backup-mysql-bin.000001. Note: if you set-- result-file to a directory, be sure to take the directory delimiter "/". For example,-- result-file=/test/, instead of-- result-file=/test, otherwise the file saved locally is / testmysql-bin.000001.

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