Deprecated: Function create_function() is deprecated in /var/www/smart-core.org/web/task/includes/class.flyspray.php on line 113 Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /var/www/smart-core.org/web/task/vendor/adodb/adodb-php/adodb.inc.php on line 1167 Deprecated: Function create_function() is deprecated in /var/www/smart-core.org/web/task/includes/class.user.php on line 115 FS#427 : Бэкапы

Administration

  • Status Новая   Reopened
  • Percent Complete
    0%
  • Task Type Сделать
  • Category -
  • Assigned To No-one
  • Operating System
  • Severity Medium
  • Priority Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Administration
Opened by Артём - 24 Apr 2014
Last edited by Артём - 22 Oct 2015

FS#427 - Бэкапы

http://smart-core.org/forum/topic/36/bekapy/

http://habrahabr.ru/post/154047/ - Свое облачное хранилище на основе ownCloud

http://habrahabr.ru/post/45912/ - Настройка резервного копирования в Ubuntu

http://habrahabr.ru/post/51419/ - резервное копирование rsync-ом

http://www.ibm.com/developerworks/ru/library/au-spunix_rsync/ - Эффективное использование rsync

https://www.dropbox.com/developers/core/start/php

Для мускуля поизучать XtraBackup или MySQL Enterprise Backup.

Поизучать такой скриптик:

#
#Copyright (c) 2015 Сrutch_master (from linux.org.ru)
#License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
#
#!/bin/bash
host=$1;
if [ $1 = "--help" ]; then
    echo "MySQL backup script."
    echo "Include mysqldump, mysql, git"
    echo "Usage: dump.sh <host> <user> <password>";
else
    mkdir $host 2> /dev/null
    cd $host
 
    echo 'show databases;' | mysql -h $1 --user=$2 --password=$3 | tail -n +2 > databases.list
    dbcnt=$(wc -l databases.list | cut -d ' ' -f 1)
    dbcur=0
 
 
    for db in $(cat databases.list);
    do
        dbcur=$(($dbcur+1))
        echo "DB# $dbcur/$dbcnt Start dump $db"
        if [ -d $db ]; then 
            newdb=0
        else
            mkdir $db 2> /dev/null
            newdb=1
        fi
        cd $db
        if [ $newdb -eq 1 ]; then 
            echo "git init"
            git init 
        fi
 
        echo "use $db;show tables;" | mysql -h $1 --user=$2 --password=$3 | tail -n +2 > tables.list
        tabcnt=$(wc -l tables.list | cut -d ' ' -f 1)
        tabcur=0
 
        #git: rm 
        for remove in $(dir -1 | grep -v -f tables.list | grep -v "routines.sql" | grep -v "tables.list");
        do
            echo "rm:$remove"
            git rm $remove
            rm $remove
        done
 
        for table in $(cat tables.list);
        do
            tabcur=$(($tabcur+1))
            echo "DB# $dbcur/$dbcnt TAB# $tabcur/$tabcnt dump $db.$table"
            #dump tables
            mysqldump --user=$2 -h $1 --password=$3 --lock-tables=false --extended-insert=false $db $table | grep -v 'SQL SECURITY DEFINER' > $table.sql 2>>error.log
            git add $table.sql
        done
        #dump routines
        echo "DB# $dbcur/$dbcnt dump $db routines"
        mysqldump --user=$2 -h $1 --password=$3 -R -t -d --extended-insert=false $db | grep -v 'SQL SECURITY DEFINER' | tr '[:upper:]' '[:lower:]' | sed 's/ definer=`root`@`[^`]*`//' > $db.routines.sql 2>>error.log
        git add $db.routines.sql
        git commit -m "$(date +%F_%R)"
        git gc
        cd ..
    done
    cd ..
fi

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing