1 (edited by dsp3 2017-08-15 16:33:19)

Topic: Database backup failed

==== Required information ====
- iRedMail version (check /etc/iredmail-release):
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
======== Required information ====
- iRedMail version (check /etc/iredmail-release): v0.9.7
- Linux/BSD distribution name and version: Centos 7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes
====

Database backup failed: vmail, check log file /var/vmail/backup/mysql/2017/08/15/2017-08-15-03:30:01.log for more details

Since upgrading to 0.9.7 all sql backups are failing. These are iredapd, roundcube, vmail, sogo, iredadmin, vmail, mysql, amavisd, roundcubemail.

I have opened the backup_mysql.sh and made sure I have correct database names listed in variable "DATABASES=".

If I open one of the new backup files, this is what the contents sow:

 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

Previously, there would be the following header

 -- MySQL dump 10.14  Distrib 5.5.52-MariaDB, for Linux (x86_64)
--
-- Host: 127.0.0.1    Database: iredadmin
-- ------------------------------------------------------
-- Server version    5.5.52-MariaDB

No compressed backups are produced. backup log:

 * Starting backup: 2017-08-15-03:30:01.
* Backup directory: /var/vmail/backup/mysql/2017/08/15.
* Backing up databases:  iredadmin mysql vmail amavisd iredapd sogo roundcubemail.
* File size:
----
4.0K    amavisd-2017-08-15-03:30:01.sql
4.0K    iredadmin-2017-08-15-03:30:01.sql
4.0K    iredapd-2017-08-15-03:30:01.sql
4.0K    mysql-2017-08-15-03:30:01.sql
4.0K    roundcubemail-2017-08-15-03:30:01.sql
4.0K    sogo-2017-08-15-03:30:01.sql
4.0K    vmail-2017-08-15-03:30:01.sql
----
* Backup completed (Success? NO).
* Delete old backup: /var/vmail/backup/mysql/2017/05/17.
* Suppose to delete: /var/vmail/backup/mysql/2017/05/17

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Database backup failed

Any useful info in file /var/vmail/backup/mysql/2017/08/15/2017-08-15-03:30:01.log?

3

Re: Database backup failed

ZhangHuangbin wrote:

Any useful info in file /var/vmail/backup/mysql/2017/08/15/2017-08-15-03:30:01.log?

Only this:

* Starting backup: 2017-08-15-03:30:01.
* Backup directory: /var/vmail/backup/mysql/2017/08/15.
* Backing up databases:  iredadmin mysql vmail amavisd iredapd sogo roundcubemail.
* File size:
----
4.0K    amavisd-2017-08-15-03:30:01.sql
4.0K    iredadmin-2017-08-15-03:30:01.sql
4.0K    iredapd-2017-08-15-03:30:01.sql
4.0K    mysql-2017-08-15-03:30:01.sql
4.0K    roundcubemail-2017-08-15-03:30:01.sql
4.0K    sogo-2017-08-15-03:30:01.sql
4.0K    vmail-2017-08-15-03:30:01.sql
----
* Backup completed (Success? NO).
* Delete old backup: /var/vmail/backup/mysql/2017/05/17.
* Suppose to delete: /var/vmail/backup/mysql/2017/05/17

4 (edited by dsp3 2017-08-18 17:05:47)

Re: Database backup failed

Here is backup_mysql.sh script:

########################################################
# Modify below variables to fit your need ----
#########################################################
# Keep backup for how many days. Default is 90 days.
KEEP_DAYS='90'

# Where to store backup copies.
export BACKUP_ROOTDIR="/var/vmail/backup"

# MySQL user and password.
export MYSQL_USER="root"
export MYSQL_PASSWD="********************"

# Databases we should backup.
# Multiple databases MUST be seperated by SPACE.
export DATABASES="iredadmin mysql vmail amavisd iredapd sogo roundcubemail"

# Database character set for ALL databases.
# Note: Currently, it doesn't support to specify character set for each databases.
export DB_CHARACTER_SET="utf8"

New SOGo backups also fail, so something is definitely amiss here. Permissions on backup directory? Where else to look?

mysql -u root -p
show databases;
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| amavisd            |
| iredadmin          |
| iredapd            |
| mysql              |
| performance_schema |
| roundcubemail      |
| sogo               |
| test               |
| vmail              |
+--------------------+
10 rows in set (0.00 sec)

5

Re: Database backup failed

If you try with the new sogo backup tool, any error?
https://bitbucket.org/zhb/iredmail/src/ … up_sogo.sh

6

Re: Database backup failed

ZhangHuangbin wrote:

If you try with the new sogo backup tool, any error?
https://bitbucket.org/zhb/iredmail/src/ … up_sogo.sh

Using these versions of the backup scripts worked! backup_mysql.sh and backup_sogo.sh on bitbucket were different from what was on the server.