MySQL Event Scheduler无法正常工作,但一切都已设置 [英] MySQL Event Scheduler does not work but everything is set

查看:743
本文介绍了MySQL Event Scheduler无法正常工作,但一切都已设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的MySQL事件永远都不想执行.
我使用最新的5.6.10版本,但问题也出现在5.5版本中.
我有1个Master-Many Slaves配置.我想在Master上运行该事件.

My MySQL events never want to execute.
I use the latest 5.6.10 release but the problem was also in the 5.5 versions.
I have 1 Master- Many Slaves configuration. I want to run the event on the Master.

  1. 我已经在 my.ini 中设置了 event_scheduler = ON
  1. In my.ini i have already set event_scheduler=ON

2,检查一下:

show variables like '%event_scheduler%';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | ON    |
+-----------------+-------+

show processlist\G

Id: 1
User: event_scheduler
Host: localhost
db: NULL
Command: Daemon
Time: 720
State: Waiting on empty queue
Info: NULL
...

3,接下来我在主服务器上有一个重复发生的事件.
这永远都不想执行.我还尝试将日期更改为其他时间.

3, Next i have a recurring event on the master server.
This never want to execute. I also tried to change the date to different time.

CREATE EVENT IF NOT EXISTS dbname.event_xyz
ON SCHEDULE EVERY 1 DAY STARTS '2013-02-05 00:15:00'
ON COMPLETION PRESERVE
DISABLE ON SLAVE
COMMENT 'Collect data from ...'
DO CALL dbname._procedurename;

我没有直接调用"_procedurename"过程的错误.

I have no errors calling the "_procedurename" procedure directly.

4,事件和过程的创建者是根".

4, The creator of the event and the procedure is the "root".

5,

show events\G

Db: dbname
Name: event_xyz
Definer: root@localhost
Time zone: SYSTEM
Type: RECURRING
Execute at: NULL
Interval value: 1
Interval field: DAY
Starts: 2013-02-05 00:15:00
Ends: NULL
Status: SLAVESIDE_DISABLED
Originator: 1
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: utf8_general_ci

6,重新启动主服务器,在 masterservername.err:

6, Restarting the master server i get the following lines in the masterservername.err:

...
Event Scheduler: Purging the queue. 0 events
...
Event Scheduler: Loaded 0 events
...

show processlist\G

显示event_scheduler

shows that the event_scheduler

State: Waiting on empty queue !

所以,我的问题是为什么不在我的主服务器上运行事件?
为什么事件计划程序对先前定义的事件一无所知?
我想念什么吗?

So, my question is why does not run the event on my master server?
Why the event scheduler does not know anything about the previously defined event?
Am I missing something?

推荐答案

也许这是一个错误.

解决方案是删除

DISABLE ON SLAVE

事件声明命令中的参数.

parameter from the event declaration command.

此后,事件状态更改为已启用"状态,并由主服务器上的事件计划程序触发.

After this, the event state changed to "ENABLED" status and fired by the Event Scheduler on the Master server.

在从属服务器上,此事件的状态复制为"SLAVESIDE_DISABLED"状态.

On the slaves the State of this event replicated with "SLAVESIDE_DISABLED" status.

那么,CREATE EVENT语法中的"DISABLE ON SLAVE"参数有何用途?

So, for what purpose exists the "DISABLE ON SLAVE" parameter in the CREATE EVENT syntax?

这篇关于MySQL Event Scheduler无法正常工作,但一切都已设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆