Detailed description of mysqlhotcopy commands

Source: Internet
Author: User
Tags perl script

Description of the mysqlhotcopy command preface mysqldump adopts an SQL-level backup mechanism, which imports data tables into SQL script files. When a database is large, it occupies a large amount of system resources and supports commonly used MyISAM, innodb mysqlhotcopy is only a simple process of cache writing and file replication. It consumes much faster resources and backup speed than mysqldump. It is especially suitable for large databases. However, note that mysqlhotcopy only supports MyISAM engines and uses mysqlhotcopy. perl must be installed because mysqlhotcopy is written in prel language. So install the following three perl packages: [plain] yum install-y perl-DBI perl-DBD-MySQL. If you have installed mysql properly, whether installed through yum, apt-get or source code, you can directly use mysqlhotcopy. mysqlhotcopy is a Perl script, which was originally written and provided by Tim Bunce. It uses lock tables, flush tables, and cp or scp to quickly back up databases. It is the fastest way to back up a database or a single table, but it can only run on the machine where the database directory is located. Mysqlhotcopy is only used to back up MyISAM. It runs in Unix and NetWare. In practice, I personally have a habit of refreshing the binlog During Hot Standby. mysqlhotcopy has the flushlog parameter that supports this function. So let's take a look at the binlog logs in the database, as shown below: Check the position where the binlog is used in the specific binlog file. You can run the following command, once you know this, you can start hot backup. $ mysqlhotcopy-u user-p password -- flushlog djangodb/tmp # Note that there must be spaces between-u user-p password, otherwise, mysqlhotcopy cannot be identified. Here, the mysqldump command is different from mysql. djangodb refers to the database name/tmp refers to the directory location to be backed up. After the backup, A directory of djangodb will be generated under/tmp, which contains related data files. For example, note that you must have select and reload (to flush tables ), lock tables permission. After the backup, you can check the binlog again. At this moment, there is an additional binlog. The position in the binlog is also changed. Here -- flushlog is mainly used for backup and reply considerations. Generally, this is enough. If you have special requirements, you can take a look at the specific parameters of man mysqlhotcopy.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.