Event e_part_manage not executes automatically in MariaDB

Just by following these instructions on https://zabbix.org/wiki/Docs/howto/mysql_partitioning, I was not able to fully automize the partition creating process on MariaDB 10.3.

The problem is that the database event is not launching.

Here are few commands which I have learned why debugging the setup

Authorize to DB:
mysql -u$(grep "^DBUser" /etc/zabbix/zabbix_server.conf|sed "s/^.*=//") -p$(grep "^DBPassword" /etc/zabbix/zabbix_server.conf|sed "s/^.*=//")
Select database:
use zabbix;
Look if event scheduler is on:
SELECT @@global.event_scheduler;
select @@event_scheduler;
Turn on event scheduler:
SET GLOBAL event_scheduler = ON;
Show processlist. The event_scheduler should be there:
SHOW PROCESSLIST; 
Show information about events:
SELECT * FROM INFORMATION_SCHEMA.events\G
Drop event 'e_part_manage':
DROP EVENT e_part_manage;
Create event 'e_part_manage':
DELIMITER $$
 
USE `zabbix`$$

CREATE EVENT IF NOT EXISTS `e_part_manage`
       ON SCHEDULE EVERY 1 DAY
       STARTS '2018-06-11 15:20:00'
       ON COMPLETION PRESERVE
       ENABLE
       COMMENT 'Creating and dropping partitions'
       DO BEGIN
            CALL zabbix.drop_partitions('zabbix');
            CALL zabbix.create_next_partitions('zabbix');
       END$$
DELIMITER ;
As a workaround, I choose to create a daily scheduled task in '/etc/cron.daily':
#!/bin/bash
mysql -u$(grep "^DBUser" /etc/zabbix/zabbix_server.conf|sed "s/^.*=//") -p$(grep "^DBPassword" /etc/zabbix/zabbix_server.conf|sed "s/^.*=//") <<< 'use zabbix; CALL zabbix.create_next_partitions("zabbix");'

No comments: