Results 1 to 6 of 6

Thread: Problems running post-backup plugin

  1. #1

    Default Problems running post-backup plugin

    Hi,

    I'm using mysql-zrm 3.0 on CentOS release 5.11 and want to use the post-backup plugin but can't seem to get it to work.

    I configured it in the /etc/mysql-zrm/lincoln/mysql-zrm.conf with the following lines:

    Code:
    post-backup-plugin="/usr/share/mysql-zrm/plugins/post-backup.pl"
    post-backup-plugin-options="AAAAA BBBBB"
    I also configured the /usr/share/mysql-zrm/plugins/post-backup.pl script to do something:

    Code:
    ---8<---
     59 $argsize = @ARGV;
     60 print "Found $argsize elements in ARGV array\n";
     61 
     62 foreach( @ARGV ){
     63         print "Found agument: ";
     64         print "$_\n";
     65         #system('mysql -h host -uuser -psecret -e "purge master logs before date_sub(now(), interval 3 day);" databasename');
     66 }
     67 print "The 'foreach' had it's chance. Did it print a message?\n";
     68 exit(0);
    ---8<---
    but I can't see that it's being called at all. Here's some logging from /var/log/mysql-zrm/mysql-zrm.log:

    Code:
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: START OF BACKUP
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: PHASE START: Initialization
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: The quick backup-type is supported only for snapshot backups. Setting backup-type to 'regular'
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: backup-set=lincoln
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: backup-date=20150209000001
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: mysql-server-os=Linux/Unix
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: backup-type=regular
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: host=lincoln.motec.com.au
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: backup-date-epoch=1423400401
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: retention-policy=7D
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: mysql-zrm-version=ZRM for MySQL Community Edition - version 3.0
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: mysql-version=5.1.73-log
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: backup-directory=/var/lib/mysql-zrm/lincoln/20150209000001
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: backup-level=1
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: PHASE END: Initialization
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: PHASE START: Running pre backup plugin
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: PHASE END: Running pre backup plugin
    Mon Feb 09 00:00:01 2015: lincoln:backup:INFO: PHASE START: Flushing logs
    Mon Feb 09 00:00:02 2015: lincoln:backup:INFO: PHASE END: Flushing logs
    Mon Feb 09 00:00:02 2015: lincoln:backup:INFO: PHASE START: Creating incremental backup
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: incremental=mysql-bin.[0-9]*
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: PHASE END: Creating incremental backup
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: PHASE START: Calculating backup size & checksums 
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: next-binlog=mysql-bin.000354
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: last-backup=/var/lib/mysql-zrm/lincoln/20150208000002
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: backup-size=0.05 MB
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: PHASE END: Calculating backup size & checksums 
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: PHASE START: Compression/Encryption
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: compress=
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: backup-size-compressed=0.01 MB
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: PHASE END: Compression/Encryption
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: read-locks-time=00:00:00
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: flush-logs-time=00:00:01
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: compress-encrypt-time=00:00:00
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: backup-time=00:00:02
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: backup-status=Backup succeeded
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: Backup succeeded
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: PHASE START: Running post backup plugin
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: PHASE END: Running post backup plugin
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: PHASE START: Cleanup
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: PHASE END: Cleanup
    Mon Feb 09 00:00:03 2015: lincoln:backup:INFO: END OF BACKUP
    Mon Feb 09 04:00:01 2015: purge:INFO: Purging Backup /var/lib/mysql-zrm/lincoln/20150202000002
    Why don't I see any of my perl print messages in the logs?

    When I actually have the perl system call un-commented (line 65), it doesn't seem to do anything either (note that I have changed the configured options for the mysql system call to protect the innocent in this post).

    What am I missing here? How can I call the post-backup script and have it do something useful?

    Is there a way to do a dry-run/test call for mysql-zrm to see what happens without affecting a running system?

    I've done this to see some results:

    Code:
    # pwd
    /usr/share/mysql-zrm/plugins
    # ./post-backup.pl AAAAA BBBBB
    Found 2 elements in ARGV array
    Found agument: AAAAA
    Found agument: BBBBB
    The 'foreach' had it's chance. Did it print a message?
    Also, I'm quite confused over the (limited) documentation for this plugin. I have not worked out what parameters (or the syntax) will be passed and when. What does it mean in the post-backup.pl comments when it says: "The second time the post-backup-plugin is called it will have 2 parameters" ?

    Clearly I am confused. I'm not a perl programmer but it's not the first time I've written/customised perl scripts. I can work through the syntax of most scripting languages without issues (php, javascript, ...). I used to program C and Java, and script regularly in bash so I do know something about coding. A clear example of the post-backup.pl would say a 1000 words in helping me understand this plugin.

    Someone please hit me with a clue stick. Thanks in advance.

    Kind regards,
    Tom
    Last edited by yzenezy; March 1st, 2015 at 03:56 PM. Reason: Put in CODE blocks for easier reading

  2. #2

    Default

    Anyone care to comment?

  3. #3

    Default

    man 1 mysql-zrm-backup has some information but I'm still struggling to get a full picture and my script doesn't appear to be called at all:

    Code:
           --post-backup-plugin plugin
                  Set  the  plugin  along  with full pathname to be called after a
                  backup run. If synchronous-checksum is not set or its  value  is
                  set to zero, the post backup plugin is called twice, once at the
                  end of backup and once when the checksum is finished.
    
           --post-backup-plugin-options "Option1 Option2 Option3 Option4..."
                  option1 is the  value  of  post-backup-plugin-options  from  the
                  mysql-zrm.conf(5) file.  option2 is the data being backed up. It
                  will be either
    
                  --all-databases
                      Use when all databases on the server are being backed up.
    
                  --database database1 database2...
                      Use when selected databases are being backed up.
    
                  --database database --tables table1 table2...
                      Use if selected tables are being backed up.
    
                  Option3 will be --backup-directory path
    
                  Option4 will be --checksum-pending or it will be --checksum-fin-
                  ished if synchronous-checksum is set to 1.
    
                  If  synchronous-checksum is not set or its value is set to zero,
                  the post-backup-plugin is called again and it will have 3 param-
                  eters First parameter is the value of post-backup-plugin-options
                  from the mysql-zrm.conf(5) configuration file.  Second parameter
                  will   be  --backup-directory  path.  Third  parameter  will  be
                  --checksum-finished.
    180+ views and still no one has any ideas?

  4. #4
    Join Date
    Aug 2008
    Location
    Sunnyvale, CA
    Posts
    306

    Default

    I haven't tried to use the perl pre/post-backup.pl scripts in /usr/share/mysql-zrm/plugins/ directly but if I simply add the the post-backup-plugin parameter in mysql-zrm.conf to specify the path of an file (bash script in my case) that can be executed by mysql, it is executed. Parameters I added were:

    post-backup-plugin="/var/lib/mysql-zrm/print-args.bash"
    post-backup-plugin-options="dbuser dbpasswd MySQL_servername"

    Also, if I add verbosity:

    verbose="1"

    ...I can see in the logs the plugin being called:

    Fri May 15 20:30:09 2015: rhel5-64:backup:INFO: Executing post-backup-plugin
    Fri May 15 20:30:09 2015: rhel5-64:backup:INFO: Command being executed is /var/lib/mysql/print-args.bash dbuser dbpasswd MySQL_servername --all-databases --backup-directory /var/lib/mysql-zrm/rhel5-64/20150515203004 --checksum-pending
    Fri May 15 20:30:09 2015: rhel5-64:backup:INFO: Return value from post-backup-plugin is 0

  5. #5
    Join Date
    Sep 2015
    Posts
    2

    Default

    Is this forum still active?[url=http://www.coquegsm.com/category-accessoires-iphone-6s-46.html]coque cuir iPhone 6s[/url] [url=http://www.coquegsm.com/category-accessoires-iphone-6s-46.html]etui iPhone 6s[/url]
    Last edited by Glouber; September 28th, 2015 at 05:30 PM.

  6. #6

    Default

    Forum is active. Please post your question.
    [URL=http://amanda.zmanda.com/]Amanda backup and recovery [/URL]
    [URL=http://www.zmanda.com/backup-mysql.html]MySQL backup and recovery[/URL]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •