Avatar of starhu
starhu

asked on 

BackupNinja doesn't work

Hello,

I intalled Backup Ninja, I put a configuration file in /etc/backup.d directory as follows and it didn't do anything.

when = everyday at 01

databases   = all
backupdir   = /var/backups/mysql
hotcopy     = no
sqldump     = yes
compress    = yes

dbusername  = backup_ninja
dbpassword  = GD23ZSAPRuZSFZfU
dbhost = localhost
databases = all
backupdir = /var/backups/mysql



### authentication ###

# three authentication methods:
#
# 1. setting the user, so that /home/user/.my.cnf is used.
# user = some-unix-user
#
# 2. specifying the mysql dbuser and dbpassword,
#    which generates a temporary .my.cnf in /root/.my.cnf
# dbusername  = <some-mysql-user>
# dbpassword  = <password>
#
# 3. specify which config file to use with configfile
#    (this option does not work with hotcopy)
# configfile = /etc/mysql/debian.cnf
#
# if user and dbusername are not specified, the default is to use
# /etc/mysql/debian.cnf for configfile.


### all options ###

# configfile = < path/to/file > (default = /etc/mysql/debian.cnf)
# The config file is passed to mysql with --defaults-file.
# On debian, this default will allow backupninja to make backups
# of mysql without configuring any additional options. 
# (this option is not compatible with "user" or "dbusername").
#
# user = <user> (default = root)
# Run mysql commands as 'user'. A valid .my.cnf must exist with a 
# database username and password in the user's home directory.
# (this option is not compatible with "configfile" or "dbusername").
#
# dbusername = <dbuser> (no default)
# The user must have access to the databases specified later.
# (this option is not compatible with "configfile" or "user").
#
# dbpassword = <dbpass> (no default)
# The password used with dbusername. this password will NOT be passed 
# on the command line and is not readable using "ps aux".
#
# dbhost = <host> (default = localhost)
# only localhost works right now.
#
# databases = < all | db1 db2 db3 > (default = all)
# which databases to backup. should either be the word 'all' or a 
# space separated list of database names.
#
# nodata = < db.table1 db.table2 db.table3 > (no default)
# only dump the structure for the database tables listed here, this means
# no data contained in these tables will be dumped. This is very useful
# to backup databases that have tables with large amounts of cache data that
# isn't necessary to backup, but you still need the structure to exist
# on a restore. You *must* specify the table as part of a database, such
# as "drupal.cache", where the database name is "drupal" and the table that
# you do not want to dump the data for is called "cache". 
#
# backupdir = < path/to/destination > (default = /var/backups/mysql)
# where to dump the backups. hotcopy backups will be in a subdirectory 
# 'hotcopy' and sqldump backups will be in a subdirectory 'sqldump'
#
# hotcopy = < yes | no > (default = no)
# make a backup of the actual database binary files using mysqlhotcopy.
#
# sqldump = < yes | no > (default = no)
# make a backup using mysqldump. this creates text files with sql commands
# sufficient to recontruct the database.
#
# sqldumpoptions = <options>
# (default = --lock-tables --complete-insert --add-drop-table --quick --quote-names)
# arguments to pass to mysqldump
#
# compress = < yes | no > (default = yes)
# if yes, compress the sqldump output. 
#
# vsname = <vserver> (no default)
# what vserver to operate on (only used if vserver = yes 
# in /etc/backupninja.conf), if you do not specify a vsname the 
# host will be operated on
# 
# NB: databases = all doesn't seem to work with hotcopy = yes 
# when vsname is specified, I would like to know how to fix this.

Open in new window


I am a newbie - maybe cron or backup ninja is not running?

Thank you
Linux

Avatar of undefined
Last Comment
starhu
Avatar of starhu
starhu

ASKER

No answer?
Avatar of noci
noci

It most probably does some logging
Default is in:
/var/lib/log/backupninja.log

but maybe in:
/var/log?

You can find log settings  with:
grep logfile /etc/backupninja.conf

Avatar of noci
noci

(and yes cron needs to be started, the /etc/cron.d is a place to drop the ninja backup startup into.) [ should be done by install script ]
Avatar of starhu
starhu

ASKER

The log says:

 
Oct 07 01:00:01 Info: >>>> starting action /etc/backup.d/action.mysql (because it is everyday at 01)       
 Oct 07 01:00:01 Fatal: Backup directory '/var/backups/mysql                                                
 /var/backups/mysql'                                                                                        
 Oct 07 01:00:01 Fatal: <<<< finished action /etc/backup.d/action.mysql: FAILED                             
 Oct 07 01:00:02 Info: FINISHED: 1 actions run. 1 fatal. 0 error. 0 warning.

Open in new window


The '/var/backups/mysql exists. Can it be a problem that in the action.mysql the line "backupdir   = /var/backups/mysql " was twice accidentally?                                              
Avatar of noci
noci

So it did something,
I wouldn't expect that, but by all means remove the doubles. (also the databases).

Also you may need to update the GZIP_OPTS as not all gzip 's support the default --resyncable
-q (quiet) is an acceptable alternative.
Avatar of starhu
starhu

ASKER

Hello,

I removed the duplicate, BackupNinja did the work according to the log:

 
Oct 08 01:00:01 Info: >>>> starting action /etc/backup.d/action.mysql (because it is everyday at 1)                                                                                                            
Oct 08 01:00:01 Info: Initializing SQL dump method                                                                                                                                                             
Oct 08 01:00:01 Info: Successfully finished dump of mysql database all                                                                                                                                         
Oct 08 01:00:01 Info: Successfully finished dump of mysql database all                                                                                                                                         
Oct 08 01:00:02 Info: <<<< finished action /etc/backup.d/action.mysql: SUCCESS                                                                                                                                 
Oct 08 01:00:02 Info: FINISHED: 1 actions run. 0 fatal. 0 error. 0 warning.

Open in new window


But it doesn't seem to export the data, the var/backups/mysql/sqldump contains a file named all.sql.gz that contains this:

-- MySQL dump10.13  Distrib 5.1.41, for debian-linux-gnu (x86_64)                                                                                                                                            
--                                                                                                                                                                                                            
-- Host: localhost    Database: all                                                                                                                                                                            
-- ------------------------------------------------------                                                                                                                                                      
-- Server version<----->5.1.41-3ubuntu12.10                                                                                                                                                                    

/*!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 */;                                                                                                                                                      


Avatar of noci
noci

What version are you using?
I have: 0.9.9  - latest available is 0.9.10 though.
In the configured directory backup directory i have a sqldump subdirectory with an tar file Per database i have.

And the content should be just behind the data you have just shown, thats the preamble of an sql dump.
Any errors in the log maybe?

Avatar of starhu
starhu

ASKER

I should have the latest (I don't know how to check it) because I downloaded 1 week ago.

Can you post your Mysql Backup configuration file? I would try with that if you don't mind.

There were not errors. The only thing I might mention is that I edited the file on my Pc then I uploaded the mysql config file to Linux.

Thank you
Avatar of noci
noci

when = everyday at 01
### backupninja MySQL config file ###

# hotcopy = < yes | no > (default = no)
# make a backup of the actual database binary files using mysqlhotcopy.
hotcopy = no

# sqldump = < yes | no > (default = no)
# make a backup using mysqldump. this creates text files with sql commands
# sufficient to recontruct the database.
#
sqldump = yes

# sqldumpoptions = <options>
# (default = --lock-tables --complete-insert --add-drop-table --quick --quote-names)
# arguments to pass to mysqldump
# sqldumpoptions = --add-drop-table --quick --quote-names

# compress = < yes | no > (default = yes)
# if yes, compress the sqldump output.
#compress = yes

# dbhost      = <host> (default = localhost)


# backupdir = <dir> (default: /var/backups/mysql)
# where to dump the backups. hotcopy backups will be in a subdirectory
# 'hotcopy' and sqldump backups will be in a subdirectory 'sqldump'
backupdir = /store/backup/ninja/

# databases = <all | db1 db2 db3 > (default = all)
# which databases to backup. should either be the word 'all' or a
# space separated list of database names.
databases = all
dbhost = localhost
dbusername = backupaccount
dbpassword = guessyouwanttoknowthis
Avatar of starhu
starhu

ASKER

Hello,

I will try your settings. What rights did you set for the mysql user?
Avatar of noci
noci

create user backup@localhost identified by 'somepassword' ;
grant lock tables, select, process on *.* to backup@localhost ;
Avatar of starhu
starhu

ASKER

The PROCESS wasn't set. I set it, tomorrow I will see the result.
Avatar of noci
noci

You are aware of the backupninja --now command?
Avatar of noci
noci

(Ow do that from an empty directory, i saw something weird doing that it exanded the * in /* & */...
)
Avatar of starhu
starhu

ASKER

Hello,

What

So with your backup file the result is the same.

The log reads:
 Oct 12 01:00:02 Info: >>>> starting action /etc/backup.d/action.mysql (because i
 Oct 12 01:00:02 Info: Initializing SQL dump method                              
 Oct 12 01:00:02 Info: Successfully finished dump of mysql database all          
 Oct 12 01:00:02 Info: Successfully finished dump of mysql database all
 Oct 12 01:00:02 Info: <<<< finished action /etc/backup.d/action.mysql: SUCCESS  
 Oct 12 01:00:02 Info: FINISHED: 1 actions run. 0 fatal. 0 error. 0 warning.  

but in the directory: there is only a all.sql.gz file with the following:

 -- MySQL dump 10.13  Distrib 5.1.41, for debian-linux-gnu (x86_64)              
 --                                                                              
 -- Host: localhost    Database: all                                            
 -- ------------------------------------------------------                      
 -- Server version<----->5.1.41-3ubuntu12.10                                    

 /*!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 */;                        

I am sure this should be something trivial I missed

Thank you



ASKER CERTIFIED SOLUTION
Avatar of noci
noci

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of starhu
starhu

ASKER


strange, the action.mysql is:

 
when = everyday at 01                                                                                                                                                                                          
hotcopy     = no                                                                                                                                                                                               
sqldump     = yes                                                                                                                                                                                              
backupdir   = /var/backups/mysql/ninja/                                                                                                                                                                        
databases   = all                                                                                                                                                                                              
# compress    = yes....................                                                                                                                                                                        
databases = all                                                                                                                                                                                                
dbhost = localhost                                                                                                                                                                                             
dbusername  = backup_ninja                                                                                                                                                                                     
dbpassword  = MyPassword

Open in new window


my backupninja.conf is:

 
reportspace = yes                                                                                                                                                                                       

# where to rsync the backupninja.log to be aggregated in                                                                                                                                                       
# a ninjareport                                                                                                                                                                                                
reporthost =.                                                                                                                                                                                                  

# what user to connect to reporthost to sync the                                                                                                                                                               
# backupninja.log                                                                                                                                                                                              
reportuser = ninja                                                                                                                                                                                             

# where on the reporthost should the report go                                                                                                                                                                 
# NOTE: the name of the log will be used in the report,.                                                                                                                                                       
# use a globally unique name, preferably the hostname                                                                                                                                                          
reportdirectory = /var/lib/backupninja/reports                                                                                                                                                                 

# set to the administration group that is allowed to.                                                                                                                                                          
# read/write configuration files in /etc/backup.d                                                                                                                                                              
admingroup = root                                                                                                                                                                                              

#######################################################                                                                                                                                                        
# for most installations, the defaults below are good #                                                                                                                                                        
#######################################################                                                                                                                                                        

# where to log:                                                                                                                                                                                                
logfile = /var/log/backupninja.log                                                                                                                                                                             

# directory where all the backup configuration files live                                                                                                                                                      
configdirectory = /etc/backup.d                                                                                                                                                                                

# where backupninja helper scripts are found                                                                                                                                                                   
scriptdirectory = /usr/share/backupninja                                                                                                                                                                       

# where backupninja libs are found                                                                                                                                                                             
libdirectory = /usr/lib/backupninja                                                                                                                                                                            

# whether to use colors in the log file                                                                                                                                                                        
usecolors = yes                                                                                                                                                                                                

# default value for 'when'                                                                                                                                                                                     
when = everyday at 01:00                                                                                                                                                                                       

# if running vservers, set to yes                                                                                                                                                                              
vservers = no                                                                                                                                                                                                  

# programs paths                                                                                                                                                                                               
# SLAPCAT=/usr/sbin/slapcat                                                                                                                                                                                    
# LDAPSEARCH=/usr/bin/ldapsearch                                                                                                                                                                               
# RDIFFBACKUP=/usr/bin/rdiff-backup                                                                                                                                                                            
# CSTREAM=/usr/bin/cstream                                                                                                                                                                                     
# MYSQL=/usr/bin/mysql                                                                                                                                                                                         
# MYSQLHOTCOPY=/usr/bin/mysqlhotcopy                                                                                                                                                                           
# MYSQLDUMP=/usr/bin/mysqldump                                                                                                                                                                                 
# PGSQLDUMP=/usr/bin/pg_dump                                                                                                                                                                                   
# PGSQLDUMPALL=/usr/bin/pg_dumpall                                                                                                                                                                             
# GZIP=/bin/gzip                                                                                                                                                                                               
# RSYNC=/usr/bin/rsync                                                                                                                                                                                         
# VSERVERINFO=/usr/sbin/vserver-info                                                                                                                                                                           
# VSERVER=/usr/sbin/vserver                                                                                                                                                                                    
# VROOTDIR=/var/lib/vservers

Open in new window

Avatar of starhu
starhu

ASKER

You were right: the doubled line caused the problem
Linux
Linux

Linux is a UNIX-like open source operating system with hundreds of distinct distributions, including: Fedora, openSUSE, Ubuntu, Debian, Slackware, Gentoo, CentOS, and Arch Linux. Linux is generally associated with web and database servers, but has become popular in many niche industries and applications.

71K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo