mysql hot backup xtrabackup

2010-10-23  来源:本站原创  分类:Database  人气:113 

Reprinted from the final edit lemoncoketea dream Shambhala
XtraBackup is a backup of MySQL's InnoDB database to open source tools.
Development Language: C / C + +
Project Home: https: / / launchpad.net / percona-xtrabackup /
Document addresses: http://www.percona.com/docs/wiki/percona-xtrabackup:start
Download: http://www.percona.com/mysql/xtrabackup/0.7/
example: vi ~ / xtrabackup_cp.sh
#! / Bin / sh
# Echo "in master host xtrabackup"
# Xtrabackup - - prepare - target-dir = / data / dbbak / xtrabackup
# Xtrabackup - prepare - target-dir = / data / dbbak / xtrabackup
# Echo "scp data"
# Scp-r xtrabackup [email protected]: / data / dbbak /
# Scp-r mysql [email protected]: / data / dbbak / xtrabackup
# Scp. / *. Frm [email protected]: / data / var / app /
echo "copy xtrbackup data"
cd / data / dbbak / xtrabackup
echo "cp-R. / ibdata * / data / ibdata /"
cp-R. / ibdata * / data / ibdata /
echo "cp-R. / ib_logfile *. / data / iblogs /"
cp-R. / ib_logfile *. / data / iblogs /
echo "copy mysql data"
cp-R / data / dbbak / xtrabackup / app / data / var /
echo "chown-R mysql.mysql / data / *"
chown-R mysql.mysql / data / *

# Grant reload, Super, REPLICATION SLAVE on *.* to 'fbrep' @ '10. Xxx 'identified by' xxxxxxx ';
# Change master to master_host = 'parker', master_user = 'fbrep', master_password = '4 rep0u1y ', master_log_file =' fb-bin.000272 ', master_log_po
s = xxx # only one time important!!
# Slave start;

Troubleshooting

# Handle error mysql can't start, Dubplicate key,
# InnoDB: Doing recovery: scanned up to log sequence number 194 4057720832
# Error 'Duplicate entry '720778891-24997-708487842' for key 1 'on query. Default database:' app '. Query:' insert into app_invitefrie
nd (app_id, from_id, from_name, to_id, to_name, invitation_id) values (24997,708487842, '36 ')'
# Killall -9 mysqld
# Tail -200 oneal-slow.log
# Mysqlbinlog fb-bin.000003 | tail -200
# Tail -200 oneal.err
# / Usr / bin / mysqld_safe & / etc / init.d / mysql restart;
# Rm-rf fb-*.* relay-* master.info
# Rm-rf app / *
# Rm-f / data / ibdata / *
# Rm-f / data / iblogs / *
# Cd / data / dbbak / xtrabackup
# Cp-R. / Ibdata * / data / ibdata /
# Cp-R. / Ib_logfile * / data / iblogs /
# Ls-ll / data / var / app | grep "Jun 21"
# Cp app_bean_order.ibd app_hourly_active_user_stat.ibd app_outsite_invitation.ibd / data / var / app /
# Chown-R mysql.mysql / data / *
#
echo "mysql command"
# Grant all privileges on app .* to 'ipo2008' @ '10 .22.198.85 'identified by' meiguiyuan ';
# Flush privileges;
# Show slave status \ G;
#. / Insert_app_active_user_log_data.sh | tee insert_app_active_user_log_data.log

Installing Mysql

#! / Bin / sh
echo "install mysql sh"
# Scp [email protected]: / home/taohuixiang/MySQL-client-standard-5.0.27-0.rhel4.x86_64.rpm. /
# Scp [email protected]: / home/taohuixiang/MySQL-server-standard-5.0.27-0.rhel4.x86_64.rpm. /
# Scp [email protected]: / home / taohuixiang / soft_bk / my.cnf.exmple. /
echo "1. bak old my.cnf"
mv / etc / my.cnf / etc / my.cnf_bk
echo "2. remove old mysql"
# Killall -9 mysqld
# / Etc / init.d / mysql start
rpm-e MySQL-client-standard
rpm-e MySQL-server-standard
echo "3. install mysql"
rpm-Uvh ~ / MySQL-client-standard-5.0.27-0.rhel4.x86_64.rpm
rpm-Uvh ~ / MySQL-server-standard-5.0.27-0.rhel4.x86_64.rpm
echo "3. finished."
echo "4. stop mysql"
/ Etc / init.d / mysql stop
echo "5. mkdir / data / ibdata / data / iblogs / data / var"
mkdir / data / ibdata / data / iblogs / data / var
echo "6. cp-rf / var / lib / mysql / var / lib / mysql_bk"
cp-rf / var / lib / mysql / var / lib / mysql_bk
echo "7. mv / var / lib / mysql / data / var"
mv / var / lib / mysql / data / var
echo "8. change chown-R mysql.mysql / data / var / *"
cd / data / var
chown-R mysql.mysql. / *
echo "9. start mysql"
# / Usr / bin / mysql_install_db - user = mysql
/ Usr / bin / mysqld_safe &
# Vi / etc / sysconfig / network

相关文章
  • mysql hot backup xtrabackup 2010-10-23

    Reprinted from the final edit lemoncoketea dream Shambhala XtraBackup is a backup of MySQL's InnoDB database to open source tools. Development Language: C / C + + Project Home: https: / / launchpad.net / percona-xtrabackup / Document addresses: http:

  • Mysql database backup and practice of design ideas 2010-11-19

    Ado, design a backup first before we understand a few concepts: Logical backup Physical backup Cold backup Hot backup Binary log file Full backup Incremental backup Cold backup cold backup (turning off the database after the backup), we need to do so

  • rails mysql database backup 2010-02-02

    In # (RAILS_ROOT) / lib / tasks established under db.rake, the mccxj to copy the code into, then press Alt + Shift + R bring up the dialog box is running Rake tasks, click "Refresh Tasks" button, the list will come out "db: backup: create&q

  • 1 Mysql automatic backup script 2010-02-21

    Can this script into crontab, every morning the implementation of an automatic backup script executed once a day at most, and only keep the last five days of backup on the server. #!/bin/bash #This is a ShellScript For Auto DB Backup #Powered by aspb

  • MySQL database backup and restore of the commonly used commands 2010-04-06

    MySQL database backup command mysqldump-hhostname-uusername-ppassword databasename> backupfile.sql Backup MySQL database table with the format <br /> delete backup deleted MySQL database table with the format, allowing the backup coverage without

  • MySQL database backup batch command BAT 2010-04-08

    This carried over http://www.jb51.net/article/19296.htm MySQL data backup tools may have a lot in this I'm going to share with you through the DOS batch commands and MySQL, WinRAR command to back up the work. Work environment Windows Server 2003, MyS

  • MYSQL database backup and restore common statement 2010-07-12

    MySQL database backup command, you can add options to select different parameters to achieve the requirements of different formats. mysqldump-h host-u username-p password database name> file Backup MySQL database to delete the table with the format,

  • mysql database backup command summary 2010-08-14

    MySQL database backup command mysqldump-hhostname-uusername-ppassword databasename> backupfile.sql Backup MySQL database to delete the table with the format of the backup MySQL database table with a delete format allows coverage of the existing datab

  • MySQL database backup commands the practical application of 2010-10-24

    MySQL database backup command mysqldump-hhostname-uusername-ppassword databasename> backupfile.sql MySQL database backup to remove the table format with Backup MySQL database table format with the deletion, allowing the backup overwrite the existing

  • mysql data backup and restore command 2010-11-18

    mysql data backup and restore commands: Backup: mysqldump-u root-p dbcurr> 20090219.sql mysqldump backup command root user name (root administrator) dbcurr backup database name; > Backup symbol 20090219.sql backup file name Restore: mysql-u root-p d

  • Mysql automatic backup script under linux 2010-12-16

    The following is saved as a. Sh file and then put the above script files uploaded to the server, you can put linux directory as the executable file to modify the script command chmod + x filename; The first open system with vi cronntab: vi / etc / cr

  • Mysql Automatic Backup (Windows) 2010-12-20

    For Mysql automatic backup, I've got two ways: First, the use navicat program provides functionality can be achieved. But the problem is, we must pay version to use. Recommend the second method, to create a. Bat file in the windows of the regular imp

  • MySQL hot backup implementation plan 2010-12-27

    MySQL hot backup implementation plan 1, MySQL database does not incremental backup mechanism, when the data is too big when the backup is a big problem. Fortunately, the main MySQL database provides a mechanism from a backup, in fact, the master data

  • mysql database backup and restore command 2011-01-12

    MySQL database backup command mysqldump-hhostname-uusername-ppassword databasename> backupfile.sql Backup MySQL database to delete a table format with backup MySQL database table format with the deletion, allowing the backup overwrite the existing da

  • mysql database backup and restore 2011-05-14

    MySQL database backup command mysqldump-hhostname-uusername-ppassword databasename> backupfile.sql Backup MySQL database to delete a table format with backup MySQL database table format with the deletion, allowing the backup overwrite the existing da

  • How to use java MySql database backup and recovery procedures? 2011-07-29

    How to use java MySql database backup and recovery procedures? Note: To add to the mysql bin directory in the Path environment variable MySql database will be exported to a file backup import java.io. *; import java.lang .*; public class BeiFen { pub

  • 10 MySQL database backup tutorial recommended 2011-08-20

    10 MySQL database backup tutorial recommended 2 hours ago by trainee reporter luiang1018 Comments (0) 6 people browse collections MySQL PHP Linux <> Job search: Beijing: ITeye website Chengpin engineer Java Advanced Search MySQL is a dynamic web sit

  • MySQL database backup command has several practical applications 2011-02-22

    The following article focuses on the MySQL database backup commands the practical application, in practice we all know that MySQL database backup is essential, so it has a more in-depth understanding is essential, the following is description of the

  • MySQL database backup data recovery misuse 2011-02-27

    1 MySQL database backup mechanism, writing a. Bat files, automatically back up every time: echo on FOR / F "TOKENS = 1 * DELIMS ="%% A IN ('DATE / T') DO SET CDATE =%% B FOR / F "TOKENS = 1,2 eol = / DELIMS = /"%% A IN ('DATE / T') DO

  • mysql incremental backup switch 2011-03-06

    MySQL incremental backup steps: 1 to enable MySQL binary logging (enable binary logging). In the MySQL configuration file, My.ini or add my.cnf log-bin configuration. log-bin="v:/dbbackup/db-bin-log" #binlog-do-db= #log-slow-queries= #max_binlog