Voilà j'aimerais effectuer une sauvegarde des bases MySQL de mon dédié. J'utilise rsync pour sauvegarder directement les fichiers .MYD et .MYI. Ca marche très bien sauf que la solution n'est pas "propre" quand MySQL tourne.
Comment dois-je procéder pour locker les tables avant de lancer le rsync dans mon script bash ?
Si je procède comme ci-dessous, la bdd n'est pas lockée puisque dès que la première commande est exécutée, il y a automatiquement déconnexion et donc unlock des tables... le rsync s'exécute mais sur des tables ouvertes !
#!/bin/bash
mysql -hlocalhost -uroot-pmdp <<FIN
FLUSH TABLES WITH READ LOCK;
FIN
rsync -avz src cible
mysql -hlocalhost -uroot -pmdp <<FIN
UNLOCK TABLES;
FIN
Page 1 sur 1
rsync, mysql et bash
#2
Posté 13 mars 2008 - 02:21
J'imamgine que les tables sont trop grosse pour faire un mysqldump 
Donc si il n'y a pas de innodb dans la base je me pencherais sur mysqlhotcopy
NAME
mysqlhotcopy - a database backup program
SYNOPSIS
mysqlhotcopy arguments
DESCRIPTION
mysqlhotcopy is a Perl script that was originally written and contributed by Tim Bunce. It uses LOCK TABLES, FLUSH TABLES, and cp or scp to make a database backup quickly. It is the fastest
way to make a backup of the database or single tables, but it can be run only on the same machine where the database directories are located. mysqlhotcopy works only for backing up MyISAM and
ISAM tables, and ARCHIVE tables as of MySQL 4.1. mysqlhotcopy runs on Unix, and as of MySQL 4.0.18 also on NetWare.
Sinon sauvegarde à chaud de innodb , le module innodbhotcopy mais qui est payant ( http://www.innodb.co...t-backup/order/ ).
Donc si il n'y a pas de innodb dans la base je me pencherais sur mysqlhotcopy
NAME
mysqlhotcopy - a database backup program
SYNOPSIS
mysqlhotcopy arguments
DESCRIPTION
mysqlhotcopy is a Perl script that was originally written and contributed by Tim Bunce. It uses LOCK TABLES, FLUSH TABLES, and cp or scp to make a database backup quickly. It is the fastest
way to make a backup of the database or single tables, but it can be run only on the same machine where the database directories are located. mysqlhotcopy works only for backing up MyISAM and
ISAM tables, and ARCHIVE tables as of MySQL 4.1. mysqlhotcopy runs on Unix, and as of MySQL 4.0.18 also on NetWare.
Sinon sauvegarde à chaud de innodb , le module innodbhotcopy mais qui est payant ( http://www.innodb.co...t-backup/order/ ).
Partager ce sujet :
Page 1 sur 1



Haut










