debian + MySql + automysqlbackup

Автор alexandr.jurka, 25 мая 2016, 17:27:37

« назад - далее »

0 Пользователи и 1 гость просматривают эту тему.

alexandr.jurka

добрый день!
разбираюсь с automysqlbackup, сервак настраивал другой человек. Не пойму, по-какому принципу идет бэкапирование баз.

в кроне есть запись, ссылается на скрипт automysqlbackup.sh

а в этом скрипте есть строки, отличающиеся от стандартных:

if [ -f /etc/default/automysqlbackup ] ; then
        . /etc/default/automysqlbackup
else


подскажите, что они означают, заранее спасибо!

ogost

Примерный "перевод":
если существует файл /etc/default/automysqlbackup; то
запустить команды, прописанные в /etc/default/automysqlbackup
или

Из хелпа:
Цитировать$help .
.: . filename [arguments]
    Execute commands from a file in the current shell.
   
    Read and execute commands from FILENAME in the current shell.  The
    entries in $PATH are used to find the directory containing FILENAME.
    If any ARGUMENTS are supplied, they become the positional parameters
    when FILENAME is executed.
   
    Exit Status:
    Returns the status of the last command executed in FILENAME; fails if
    FILENAME cannot be read.

ihammers

Проверка условий существует ли файл. Смотрите что написано в этом файле.
Debian GNU/Linux Bookworm, LXQt/OpenBox: AMD Ryzen 5 5600G / 64Gb RAM
_______________________________
Debian GNU/Linux Bookworm, без графики: AMD Phenon X4 / 16Gb RAM
_______________________________
Debian GNU/Linux Bookworm, LXQt/OpenBox: Acer Aspire One 722 AMD C60 / 8Gb RAM / ATI HD6290

alexandr.jurka

Цитата: ihammers от 26 мая 2016, 04:55:19Смотрите что написано в этом файле.
содержимое файла:
Открыть содержимое (спойлер)
# Username to access the MySQL server e.g. dbuser
#USERNAME=`grep user /etc/mysql/debian.cnf | tail -n 1 | cut -d"=" -f2 | awk '{print $1}'`

# Username to access the MySQL server e.g. password
#PASSWORD=`grep password /etc/mysql/debian.cnf | tail -n 1 | cut -d"=" -f2 | awk '{print $1$

# Host name (or IP address) of MySQL server e.g localhost
DBHOST=localhost

# List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"
# Note that it's absolutely normal that the db named "mysql" is not in this
# list, as it's added later by the script. See the MDBNAMES directives below
# in this file (advanced options).
# This is ONLY a convenient default, if you don't like it, don't complain
# and write your own.
# The following is a quick hack that will find the names of the databases by
# reading the mysql folder content. Feel free to replace by something else.
# DBNAMES=`find /var/lib/mysql -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f5 | grep -v ^m$
# This one does a list of dbs using a MySQL statement.
#DBNAMES=`mysql --defaults-file=/etc/mysql/debian.cnf --execute="SHOW DATABASES" | awk '{pr$
DBNAMES="all"

# Backup directory location e.g /backups
# Folders inside this one will be created (daily, weekly, etc.), and the
# subfolders will be database names. Note that backups will be owned by
# root, with Unix rights 0600.
BACKUPDIR="/var/lib/automysqlbackup"

# Mail setup
# What would you like to be mailed to you?
# - log   : send only log file
# - files : send log file and sql files as attachments (see docs)
# - stdout : will simply output the log to the screen if run manually.
# - quiet : Only send logs if an error occurs to the MAILADDR.
MAILCONTENT="quiet"

# Set the maximum allowed email size in k. (4000 = approx 5MB email [see
# docs])
MAXATTSIZE="4000"

# Email Address to send mail to? (user@domain.com)
MAILADDR="root"

# ============================================================
# === ADVANCED OPTIONS ( Read the doc's below for details )===
#=============================================================

# List of DBBNAMES for Monthly Backups.
MDBNAMES="mysql $DBNAMES"

# List of DBNAMES to EXLUCDE if DBNAMES are set to all (must be in " quotes)
DBEXCLUDE=""

# Include CREATE DATABASE in backup?
CREATE_DATABASE=yes

# Separate backup directory and file for each DB? (yes or no)
SEPDIR=yes

# Which day do you want weekly backups? (1 to 7 where 1 is Monday)
DOWEEKLY=6

# Choose Compression type. (gzip or bzip2)
COMP=gzip

# Compress communications between backup server and MySQL server?
COMMCOMP=no

# Additionally keep a copy of the most recent backup in a seperate
# directory.
LATEST=no

#  The maximum size of the buffer for client/server communication. e.g. 16MB
#  (maximum is 1GB)
MAX_ALLOWED_PACKET=

#  For connections to localhost. Sometimes the Unix socket file must be
#  specified.
SOCKET=

# Command to run before backups (uncomment to use)
#PREBACKUP="/etc/mysql-backup-pre"

# Command run after backups (uncomment to use)
#POSTBACKUP="/etc/mysql-backup-post"
[свернуть]

немного предыстории:
у нас много баз, вчера обнаружил, что копируется только одна. В строчке "DBNAMES=" стояло название только одной базы, которая и бэкапилась. Я исправил на "all", и после отработки крона - ничего не изменилось! так же бэкапнулась одна база.
В этом конфиге кстати строки с указанием логина и пароля от мускуля вообще закомментированы. Тогда вопрос - откуда он вообще эти данные берет)))

ihammers

Соединяется по socket, проверяйте почту root-а. Скрипт должен был отправить отчёт. Плюс проверяйте место вдруг его не хватает.
Debian GNU/Linux Bookworm, LXQt/OpenBox: AMD Ryzen 5 5600G / 64Gb RAM
_______________________________
Debian GNU/Linux Bookworm, без графики: AMD Phenon X4 / 16Gb RAM
_______________________________
Debian GNU/Linux Bookworm, LXQt/OpenBox: Acer Aspire One 722 AMD C60 / 8Gb RAM / ATI HD6290

alexandr.jurka

в общем, я психанул, вместо этого костыля взял скачал с оффсайта архив со скриптом, установил, вписал в конфиг нужные параметры.
В кроне подправил - чтоб другой скрипт запускался по расписанию.
Вручную попробовал - вроде работает) бэкапы делаются - и слава богу.

только одна напрягающая строка после завершения выполнения скрипта:

Открыть содержимое (спойлер)
###### WARNING ######
Errors reported during AutoMySQLBackup execution.. Backup failed
Error log below..
-- Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.
[свернуть]

может кто знает, че ругается?

ihammers

Цитата: alexandr.jurka от 26 мая 2016, 17:33:18
может кто знает, че ругается?
Предупреждает, что он не сделал дамп одной таблицы mysql.events.

Посмотрите ещё и stackoverflow.
Debian GNU/Linux Bookworm, LXQt/OpenBox: AMD Ryzen 5 5600G / 64Gb RAM
_______________________________
Debian GNU/Linux Bookworm, без графики: AMD Phenon X4 / 16Gb RAM
_______________________________
Debian GNU/Linux Bookworm, LXQt/OpenBox: Acer Aspire One 722 AMD C60 / 8Gb RAM / ATI HD6290