轻量级MySQL备份方案:AutoMySQLBackup_MySQL
bitsCN.com
有句话说得好:『选择最好的不一定是最好的选择!』。AutoMySQLBackup算不上出类拔萃,但作为轻量级MySQL备份方案,对一些迷你项目而言,它绝对值得尝试。
AutoMySQLBackup使用起来简单方便,属于快餐型工具,操作步骤如下:
下载AutoMySQLBackup,是一个名字类似automysqlbackup.sh的shell脚本。
创建配置文件,缺省内容就是shell脚本中“START CFG”和“END CFG”之间的部分:
<ol class="dp-xml"> <li class="alt">shell> mkdir /etc/automysqlbackup </li> <li>shell> sed -n '/START CFG/,/END CFG/s/^/s*//p' automysqlbackup.sh / </li> <li class="alt"> > /etc/automysqlbackup/automysqlbackup.conf </li> </ol>
包含基本选项和高级选项两部分,主要设置基本选项,如下所示:
<ol class="dp-xml"> <li class="alt"># Username to access the MySQL server e.g. dbuser </li> <li>USERNAME=debian </li> <li class="alt"> </li> <li># Password to access the MySQL server e.g. password </li> <li class="alt">PASSWORD= </li> <li> </li> <li class="alt"># Host name (or IP address) of MySQL server e.g localhost </li> <li>DBHOST=localhost </li> <li class="alt"> </li> <li># List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3" </li> <li class="alt">DBNAMES="all" </li> <li> </li> <li class="alt"># Backup directory location e.g /backups </li> <li>BACKUPDIR="/srv/backup/db" </li> <li class="alt"> </li> <li># Mail setup </li> <li class="alt"># What would you like to be mailed to you? </li> <li># - log : send only log file </li> <li class="alt"># - files : send log file and sql files as attachments (see docs) </li> <li># - stdout : will simply output the log to the screen if run manually. </li> <li class="alt"># - quiet : Only send logs if an error occurs to the MAILADDR. </li> <li>MAILCONTENT="log" </li> </ol>
按部就班的设置USERNAME,PASSWORD,DBNAMES,BACKUPDIR,由于配置文件包含账号密码等敏感信息,所以可能需要考虑一下权限,另外还有一点需要说明的是邮件相关的设置,作为轻量级MySQL备份方案,此功能显得有点画蛇添足,建议关闭(stdout)。
万事俱备,只欠东风,接着设置定时任务,比如说设定每天备份:
<ol class="dp-xml"> <li class="alt">shell> cp /path/to/automysqlbackup.sh /etc/cron.daily/automysqlbackup </li> <li>shell> chmod +x /etc/cron.daily/automysqlbackup </li> </ol>
如此一来,就大功告成了,会在你设定的备份目录中按日,周,月来存档。
提示:每天备份,日积月累可能会占用大量的磁盘空间,为了避免磁盘空间耗尽,定期删除旧的备份文件是必要的,比如删除N天前的备份文件,可以使用类似下面的shell命令:
<ol class="dp-xml"><li class="alt">shell> find /path/to/backup/dir -type f -mtime +N -print0 | xargs -0 rm -f </li></ol>
另外要注意搭配mtime时,N/-N/+N的含义易混淆,大家可以参考相关文档后再使用。
bitsCN.com
Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Please recommend which 1155-pin CPU is the best. The current 1155-pin CPU with the highest performance is Intel Corei7-3770K. It has 4 cores and 8 threads, a base frequency of 3.5GHz, and supports TurboBoost2.0 technology, which can reach up to 3.9GHz. In addition, it is equipped with 8MB of level 3 cache and is an excellent processor with the LGA1155 pin, the most powerful CPU Intel Core i73770K. The LGA1155 interface is the interface type used by second and third generation Core processors. The best performing one is Intel Core i73770K. The parameters of this processor are as follows: 1. Applicable type: desktop; 2. CPU series: Core i7; 3. CPU

NEARProtocol: A scalable, user-friendly blockchain platform NEARProtocol is a blockchain platform using sharding technology designed to address the challenges faced by blockchain technology in terms of scalability, user-friendliness, and security. It provides developers with an efficient and user-friendly platform that enables them to easily build and deploy decentralized applications (dApps). NEARProtocol is designed to lower the barriers to blockchain development while providing a high degree of efficiency and security. By adopting sharding technology, NEARProtocol can better handle large-scale transactions and provide users with faster transaction confirmation times. Overall, NEARProtocol is designed to provide

Resources for any programming language include video lessons, notes, and e-books. Here I'll list the best resources for Python. Python official documentation Many websites provide Python resources, but the official documentation is the best. Let’s take a look at the resources they offer. Python Beginners Guide - https://wiki.python.org/moin/BeginnersGuide Python Developer Guide - https://devguide.python.org/Free Python Books − https://wiki.python.org/moin/PythonBooksPyth

With the rapid development of computer technology, graphics cards, as one of the important components of computers, play a pivotal role in games, graphic design and other fields. The graphics card interface is the bridge connecting the graphics card and the motherboard, affecting the performance and effect of the graphics card. So, which graphics card interface works best? Currently, there are three common graphics card interfaces on the market: PCI, AGP, and PCIe. Among them, the PCI interface is an early standard interface and is relatively outdated. For some old computers or simple office needs

Which website is the best to download win10? Nowadays, many friends like to download and install or reinstall the system online. This requires an excellent download platform. So which website is good for downloading the win10 system? Many friends don’t know how to operate in detail. The editor has compiled the download websites for the win10 system below. Good introduction, if you are interested, follow the editor to read below! A good introduction to win10 system download website Answer: System 520 is the best. The systems here are safe and reliable, and the installation method is also very simple, suitable for all users. 1. The system here has several benefits. 2. First of all, ensure safety and reliability. All systems can be installed normally without errors. 3. Secondly, the installation operation is very simple, and the system is installed with one click.

How to choose the best computer configuration With the continuous advancement of technology, computers have become an indispensable part of our lives. They not only meet our work needs, but also bring us entertainment and leisure. When choosing a computer, excellent configuration is very important. This article will introduce you to some important factors and tips when purchasing computer configurations. First, we need to consider our own needs. Different people use computers for different purposes. Some people mainly use them for daily office work and Internet browsing, while others may need high-performance games or professional

How many pins does the Antec 650w motherboard cable have? The power cable of the Antec 650W power supply motherboard is usually 24 pins, which is the largest power interface on the motherboard. Its function is to connect the motherboard and power supply to provide power to the motherboard and other system components. In addition, the Antec 650W power supply may also include other types of power interfaces, such as CPU8pin, PCIe6+2pin, etc., for connecting other components such as the CPU and independent graphics cards. Motherboard routing tutorial Motherboard routing is the process of connecting circuits between various electronic components when designing a motherboard. In this process, factors such as circuit stability, signal transmission speed and accuracy need to be considered. When routing wiring according to the circuit diagram, pay attention to the layout and select appropriate line width and distance to avoid

When choosing a computer, most users now pay attention to the heat dissipation problem. Therefore, the current air-cooled radiators are very popular because they are affordable and cost-effective. However, most users do not quite understand which one is best. According to the current situation, The best is Valkyrie. Which air-cooled radiator is the best: A: According to the current ladder chart, the best one is Valkyrie’s “vk Star Ring GL360”. The performance of this water cooling is explosive, and the price is very good. For entry-level users, it will definitely not suffer. Related introduction of vk Starring GL360: 1. This water-cooled product looks very good, and the installation is relatively simple. It is also very convenient for novices to operate. 2. The fan is very simple overall. The logo also has a rotating circle, which is boring.
