Skip to content

Backup of a large database (+ 400Go) without freezing it more than a few seconds.

Notifications You must be signed in to change notification settings

Daklyan/Rendu-stage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



Instructions

The scripts allows you to backup and restore a database from LVM2 snapshots.

Requirements

  • mysql-server package installed

  • nfs-utils package installed and activated + an athore vm (for database slave)

  • db_test for testing the scripts

How to install the database for the tests

To unzip the database you'll need a tool that can read .zip like winzip that we'll use in this exemple :

shell> unzip test_db-master.zip
shell> cd test_db-master/

Then import the database :

shell> mysql -uroot -p -t < employees.sql

Set up of the NFS

Script modification :

Change the variable ipServer in var.sh by the ip of your vm that will be the nfs server

Firewall access :

shell> firewall-cmd --permanent --zone=public --add-service=ssh
shell> firewall-cmd --permanent --zone=public --add-service=nfs
shell> firewall-cmd --reload

Server side :

  • Create a directory nfs and give the own / rights :
shell> mkdir /var/nfs
shell> chown nfsnobody:nfsnobody /var/nfs
shell> chmod 755 /var/nfs
  • Modify exports file
shell> nano /etc/exports

/var/nfs        IPCLIENT(rw,sync,no_subtree_check)

  • Save changes on exports
shell> exportfs -a

Client side

  • Create a nfs directory :
shell> mkdir -p /mnt/nfs/var/nfs

Backup of mysql

  • Create a directory /backup before anything:

    shell> mkdir /backup
    
  • Launch backup.sh with sudo or in su :

    shell> sudo sh backup.sh
    
  • Once it's launched a password we'll be asked, enter your root password for mysql

Restore a database

TO DO

About

Backup of a large database (+ 400Go) without freezing it more than a few seconds.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages