{"id":9057,"date":"2022-03-30T14:30:50","date_gmt":"2022-03-30T06:30:50","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=9057"},"modified":"2022-03-30T17:58:18","modified_gmt":"2022-03-30T09:58:18","slug":"gbase-8a%e7%9a%84%e5%90%8e%e5%8f%b0daemon%e4%ba%8b%e4%bb%b6%e8%b0%83%e5%ba%a6%e8%bf%9b%e7%a8%8bevent_scheduler%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/9057","title":{"rendered":"\u5357\u5927\u901a\u7528GBase 8a\u7684\u540e\u53f0(daemon)\u4e8b\u4ef6\u8c03\u5ea6\u8fdb\u7a0bevent_scheduler\u4ecb\u7ecd"},"content":{"rendered":"<p>GBase 8a\u652f\u6301\u6570\u636e\u5e93\u5185\u7684\u5b9a\u65f6\u4efb\u52a1\u4e8b\u4ef6\uff0c\u5176\u8c03\u5ea6\u7a0b\u5e8f\u7531\u6570\u636e\u5e93\u7684daemon\u8fdb\u7a0b\u8d1f\u8d23\uff0c\u672c\u6587\u7b80\u5355\u4ecb\u7ecd\u76f8\u5173\u53c2\u6570 event_scheduler \u4f7f\u7528\u65b9\u6cd5\uff0c\u4ee5\u53ca\u4ece\u6570\u636e\u5e93\u65e5\u5fd7\u7b49\u67e5\u770b\u4e8b\u4ef6\u7684\u76f8\u5173\u4fe1\u606f\u3002<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Directory Navigation<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2acc2d1b542\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2acc2d1b542\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E5%8F%82%E8%80%83\" >\u53c2\u8003<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E6%A0%B7%E4%BE%8B\" >\u6837\u4f8b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E4%BA%8B%E4%BB%B6%E8%B0%83%E5%BA%A6%E5%8A%9F%E8%83%BD%E7%9A%84%E6%9F%A5%E7%9C%8B%E3%80%81%E5%90%AF%E7%94%A8%E5%92%8C%E5%85%B3%E9%97%AD\" >\u4e8b\u4ef6\u8c03\u5ea6\u529f\u80fd\u7684\u67e5\u770b\u3001\u542f\u7528\u548c\u5173\u95ed<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E6%9F%A5%E7%9C%8B%E5%BD%93%E5%89%8D%E4%BA%8B%E4%BB%B6%E8%B0%83%E5%BA%A6\" >\u67e5\u770b\u5f53\u524d\u4e8b\u4ef6\u8c03\u5ea6<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E5%85%B3%E9%97%AD%E4%BA%8B%E4%BB%B6%E8%B0%83%E5%BA%A6%E5%8A%9F%E8%83%BD\" >\u5173\u95ed\u4e8b\u4ef6\u8c03\u5ea6\u529f\u80fd<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E5%90%AF%E7%94%A8%E4%BA%8B%E4%BB%B6%E8%B0%83%E5%8A%A8%E5%8A%9F%E8%83%BD\" >\u542f\u7528\u4e8b\u4ef6\u8c03\u52a8\u529f\u80fd<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E6%8B%BF%E5%88%B0%E4%BA%8B%E4%BB%B6%E8%B0%83%E5%BA%A6%E4%BB%BB%E5%8A%A1%E7%9A%84%E7%BA%BF%E7%A8%8B%E5%8F%B7\" >\u62ff\u5230\u4e8b\u4ef6\u8c03\u5ea6\u4efb\u52a1\u7684\u7ebf\u7a0b\u53f7<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E6%95%B0%E6%8D%AE%E5%BA%93%E5%90%AF%E5%81%9Csystemlog\" >\u6570\u636e\u5e93\u542f\u505csystem.log<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E4%B8%AD%E9%97%B4%E5%8F%82%E6%95%B0%E5%90%AF%E5%81%9C%E6%97%B6%E7%9A%84system%E6%97%A5%E5%BF%97%E8%BE%93%E5%87%BA\" >\u4e2d\u95f4\u53c2\u6570\u542f\u505c\u65f6\u7684system\u65e5\u5fd7\u8f93\u51fa<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E6%9F%A5%E7%9C%8Bpstack%E6%9F%A5%E7%9C%8B%E4%BA%8B%E4%BB%B6%E8%B0%83%E5%BA%A6%E7%BA%BF%E7%A8%8B%E4%BF%A1%E6%81%AF\" >\u67e5\u770bpstack\u67e5\u770b\u4e8b\u4ef6\u8c03\u5ea6\u7ebf\u7a0b\u4fe1\u606f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E4%BA%8B%E4%BB%B6%E6%89%A7%E8%A1%8C%E6%97%A5%E5%BF%97\" >\u4e8b\u4ef6\u6267\u884c\u65e5\u5fd7<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E5%88%9B%E5%BB%BA%E4%BA%8B%E4%BB%B6\" >\u521b\u5efa\u4e8b\u4ef6<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E6%9F%A5%E7%9C%8B%E4%BA%8B%E4%BB%B6%E5%BD%93%E5%89%8D%E7%8A%B6%E6%80%81\" >\u67e5\u770b\u4e8b\u4ef6\u5f53\u524d\u72b6\u6001<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E6%95%B0%E6%8D%AE%E5%BA%93express%E6%97%A5%E5%BF%97\" >\u6570\u636e\u5e93express\u65e5\u5fd7<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E6%9F%A5%E7%9C%8B%E6%89%A7%E8%A1%8C%E7%BB%93%E6%9E%9C\" >\u67e5\u770b\u6267\u884c\u7ed3\u679c<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E5%A4%9A%E4%B8%AA%E8%B0%83%E5%BA%A6%E8%8A%82%E7%82%B9%EF%BC%8C%E5%93%AA%E4%B8%AA%E5%BD%93%E5%89%8D%E4%B8%BAMaster\" >\u591a\u4e2a\u8c03\u5ea6\u8282\u70b9\uff0c\u54ea\u4e2a\u5f53\u524d\u4e3aMaster<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/www.gbase8.cn\/en\/9057\/#%E6%80%BB%E7%BB%93\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%8F%82%E8%80%83\"><\/span>\u53c2\u8003<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5982\u4e0b\u662f\u548c\u7528\u6237\u7f16\u5199\u7684\u4e8b\u4ef6\u5185\u5bb9\u6709\u5173\u7684\u53c2\u8003<\/p>\n\n\n\n<p><a href=\"https:\/\/www.gbase8.cn\/en\/858\/\">GBase 8a\u6570\u636e\u5e93\u5b9a\u65f6\u4efb\u52a1\u8c03\u5ea6\u529f\u80fdevent\u6d4b\u8bd5<\/a><br><a href=\"https:\/\/www.gbase8.cn\/en\/246\/\">GBase 8a\u96c6\u7fa4\u6682\u505c\u5b9a\u65f6\u4efb\u52a1event disable<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%A0%B7%E4%BE%8B\"><\/span>\u6837\u4f8b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5982\u4e0bId=1\u7684\u8fdb\u7a0b\u5c31\u662f\u540e\u53f0\u7684\u4e8b\u4ef6\u8c03\u5ea6\u7ebf\u7a0b\uff0c\u6ce8\u610f\u5176Command\u5217\u662fDaemon\u3002 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; show processlist;\n+----+-----------------+------------------+------+---------+------+------------------------+------------------+\n| Id | User            | Host             | db   | Command | Time | State                  | Info             |\n+----+-----------------+------------------+------+---------+------+------------------------+------------------+\n|  1 | event_scheduler | localhost        | NULL | Daemon  |    5 | Waiting for event lock | NULL             |\n|  6 | gbase           | 10.0.2.115:39820 | NULL | Sleep   |    4 |                        | NULL             |\n|  7 | root            | localhost        | NULL | Query   |    0 | NULL                   | show processlist |\n+----+-----------------+------------------+------+---------+------+------------------------+------------------+\n3 rows in set (Elapsed: 00:00:00.00)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E4%BA%8B%E4%BB%B6%E8%B0%83%E5%BA%A6%E5%8A%9F%E8%83%BD%E7%9A%84%E6%9F%A5%E7%9C%8B%E3%80%81%E5%90%AF%E7%94%A8%E5%92%8C%E5%85%B3%E9%97%AD\"><\/span>\u4e8b\u4ef6\u8c03\u5ea6\u529f\u80fd\u7684\u67e5\u770b\u3001\u542f\u7528\u548c\u5173\u95ed<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u901a\u8fc7event_scheduler\u53c2\u6570\u6253\u5f00\u6216\u5173\u95ed\u4e8b\u4ef6\u8c03\u5ea6\u529f\u80fd. \u6ce8\u610f\u8be5\u53c2\u6570\u662f\u96c6\u7fa4\u4e00\u4e2a\u8c03\u5ea6\u8282\u70b9\u6267\u884c\uff0c\u6240\u6709\u8c03\u5ea6\u8282\u70b9\u540c\u65f6\u751f\u6548\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E7%9C%8B%E5%BD%93%E5%89%8D%E4%BA%8B%E4%BB%B6%E8%B0%83%E5%BA%A6\"><\/span>\u67e5\u770b\u5f53\u524d\u4e8b\u4ef6\u8c03\u5ea6<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u901a\u8fc7show\u547d\u4ee4\u53ef\u4ee5\u67e5\u770bevent_scheduler\u7684\u5f53\u524d\u503c\uff1aON=\u6253\u5f00\uff0c  OFF=\u5173\u95ed\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; show variables like '%scheduler%';\n+-----------------+-------+\n| Variable_name   | Value |\n+-----------------+-------+\n| event_scheduler | ON    |\n+-----------------+-------+\n1 row in set (Elapsed: 00:00:00.01)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%85%B3%E9%97%AD%E4%BA%8B%E4%BB%B6%E8%B0%83%E5%BA%A6%E5%8A%9F%E8%83%BD\"><\/span>\u5173\u95ed\u4e8b\u4ef6\u8c03\u5ea6\u529f\u80fd<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u901a\u8fc7\u8bbe\u7f6e\u8be5\u53c2\u6570\u4e3a0\uff0c\u53ef\u4ee5\u5173\u95ed\u4e8b\u4ef6\u8c03\u5ea6\u529f\u80fd\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; set global event_scheduler=0;\nQuery OK, 0 rows affected (Elapsed: 00:00:00.89)\n\ngbase&gt; show processlist;\n+----+------+------------------+------+---------+------+-------+------------------+\n| Id | User | Host             | db   | Command | Time | State | Info             |\n+----+------+------------------+------+---------+------+-------+------------------+\n|  7 | root | localhost        | NULL | Query   |    0 | NULL  | show processlist |\n|  9 | root | 10.0.2.101:51572 | NULL | Sleep   |    3 |       | NULL             |\n+----+------+------------------+------+---------+------+-------+------------------+\n2 rows in set (Elapsed: 00:00:00.00)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%90%AF%E7%94%A8%E4%BA%8B%E4%BB%B6%E8%B0%83%E5%8A%A8%E5%8A%9F%E8%83%BD\"><\/span>\u542f\u7528\u4e8b\u4ef6\u8c03\u52a8\u529f\u80fd<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u901a\u8fc7\u8bbe\u7f6eevent_scheduler\u53c2\u6570\u4e3a1\uff0c\u542f\u7528\u4e8b\u4ef6\u8c03\u5ea6\u529f\u80fd\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; set global event_scheduler=1;\nQuery OK, 0 rows affected (Elapsed: 00:00:00.03)\n\ngbase&gt; show processlist;\n+----+-----------------+------------------+--------+---------+------+-----------------------------+------------------+\n| Id | User            | Host             | db     | Command | Time | State                       | Info             |\n+----+-----------------+------------------+--------+---------+------+-----------------------------+------------------+\n|  7 | root            | localhost        | testdb | Query   |    0 | NULL                        | show processlist |\n| 48 | event_scheduler | localhost        | NULL   | Daemon  |    1 | Waiting for next activation | NULL             |\n| 49 | root            | 10.0.2.101:51978 | NULL   | Sleep   |    3 |                             | NULL             |\n+----+-----------------+------------------+--------+---------+------+-----------------------------+------------------+\n3 rows in set (Elapsed: 00:00:00.00)\n<\/code><\/pre>\n\n\n\n<p>\u6ce8\u610f\u4e8b\u4ef6\u8c03\u5ea6\u8fdb\u7a0b\u7684ID\u4e0d\u662f\u56fa\u5b9a\u7684\uff0c\u5982\u679c\u6570\u636e\u5e93\u5f00\u542f\u4e86\u5b9a\u65f6\u4efb\u52a1(\u9ed8\u8ba4),\u4e14\u6570\u636e\u5e93\u521a\u542f\u52a8\uff0c\u90a3\u4e48\u4f1a\u4f7f\u7528\u7b2c\u4e00\u4e2aID=1\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%8B%BF%E5%88%B0%E4%BA%8B%E4%BB%B6%E8%B0%83%E5%BA%A6%E4%BB%BB%E5%8A%A1%E7%9A%84%E7%BA%BF%E7%A8%8B%E5%8F%B7\"><\/span>\u62ff\u5230\u4e8b\u4ef6\u8c03\u5ea6\u4efb\u52a1\u7684\u7ebf\u7a0b\u53f7<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u901a\u8fc7show detail\u547d\u4ee4\uff0c\u53ef\u4ee5\u770b\u5230ID\u53f7\u548c\u7ebf\u7a0b\u53f7\u3002\u5982\u4e0b\u56fe\u7684Id=1,Tid=8460\u3002\u5728\u6570\u636e\u5e93\u5185\u90e8\uff0c\u8fd8\u6709\u4e00\u4e2a\u7ebf\u7a0b\u4e5f\u662f\u8d1f\u8d23\u8fd9\u4e2a\uff0c\u53ea\u662f\u5728show processlist\u91cc\u6ca1\u6709\u663e\u793a\uff0c\u4f46\u5728\u540e\u9762\u7684pstack\u4fe1\u606f\u91cc\u80fd\u770b\u5230\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; show detail processlist;\n+----+------+-----------------+-----------+------+---------+------+------------------------+------+------+-------------------------+\n| Id | Tid  | User            | Host      | db   | Command | Time | State                  | Lock | Wait | Info                    |\n+----+------+-----------------+-----------+------+---------+------+------------------------+------+------+-------------------------+\n|  1 | <span class=\"has-inline-color has-luminous-vivid-orange-color\"><strong>8460 <\/strong><\/span>| event_scheduler | localhost | NULL | Daemon  |   55 | Waiting for event lock | NULL | NULL | NULL                    |\n|  5 | 8518 | root            | localhost | NULL | Query   |    0 | NULL                   | NULL | NULL | show detail processlist |\n+----+------+-----------------+-----------+------+---------+------+------------------------+------+------+-------------------------+\n2 rows in set (Elapsed: 00:00:00.00)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%95%B0%E6%8D%AE%E5%BA%93%E5%90%AF%E5%81%9Csystemlog\"><\/span>\u6570\u636e\u5e93\u542f\u505csystem.log<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u670d\u52a1\u9996\u6b21\u542f\u52a8\u65f6\uff0c\u4f1a\u8f93\u51fa\u4e8b\u4ef6\u8c03\u5ea6\u7684\u65e5\u5fd7\uff0c\u5982\u4e0b\u4f8b\u5b50\u663e\u793aID\u662f2\uff0c \u548c\u524d\u4e00\u8282\u4ecb\u7ecd\u7684ID=1\u5bf9\u4e0d\u4e0a\uff0c\u4f46\u5b9e\u9645\u4e0a2\u4e2a\u90fd\u662f\u5185\u90e8\u8c03\u5ea6\u8fdb\u7a0b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>220330 10:28:28 &#91;Note] Express is ready for connections.\nsocket: '\/tmp\/gcluster_5258.sock' port: 5258 283f8db1\n220330 10:28:28 &#91;Note] Event Scheduler: scheduler thread started with id 2\nCBO load statistics begin...\nCBO load statistics OK.\nCBO load statistics used time 00:00:00.044.\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E4%B8%AD%E9%97%B4%E5%8F%82%E6%95%B0%E5%90%AF%E5%81%9C%E6%97%B6%E7%9A%84system%E6%97%A5%E5%BF%97%E8%BE%93%E5%87%BA\"><\/span>\u4e2d\u95f4\u53c2\u6570\u542f\u505c\u65f6\u7684system\u65e5\u5fd7\u8f93\u51fa<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\u5173\u95ed\u53c2\u6570\u65f6\uff0ckill\u6389\u4e86\u7ebf\u7a0bId 2\u548c1\u3002 \u542f\u52a8\u65f6\uff0c\u67092\u4e2a\u65b0\u7ebf\u7a0bId\u4e3a 47\u548c48\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>220330 10:29:05 &#91;Note] Event Scheduler: Killing the scheduler thread, thread id 2\n220330 10:29:05 &#91;Note] Event Scheduler: Waiting for the scheduler thread to reply\n220330 10:29:05 &#91;Note] Event Scheduler: Stopped\n220330 10:29:05 &#91;Note] Event Scheduler: Killing the scheduler thread, thread id 1\n220330 10:29:05 &#91;Note] Event Scheduler: Waiting for the scheduler thread to reply\n220330 10:29:05 &#91;Note] Event Scheduler: Stopped\n220330 13:34:44 &#91;Note] Event Scheduler: scheduler thread started with id 47\n220330 13:34:46 &#91;Note] Event Scheduler: scheduler thread started with id 48\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E7%9C%8Bpstack%E6%9F%A5%E7%9C%8B%E4%BA%8B%E4%BB%B6%E8%B0%83%E5%BA%A6%E7%BA%BF%E7%A8%8B%E4%BF%A1%E6%81%AF\"><\/span>\u67e5\u770bpstack\u67e5\u770b\u4e8b\u4ef6\u8c03\u5ea6\u7ebf\u7a0b\u4fe1\u606f<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u901a\u8fc7pstack <code>`pidof gclusterd<\/code>` \u62ff\u5230\u7ebf\u7a0b\u4fe1\u606f\u3002\u67e5\u770bLWP 8640\u7684\u4e8b\u4ef6\u8c03\u5ea6\u7ebf\u7a0b\u3002\u540c\u65f6\uff0c\u8fd8\u6709\u4e2a8641\u7684\u5185\u90e8\u7ebf\u7a0b\uff0c\u4e00\u81f4\u5728\u67e5\u8be2\u5f53\u524d\u7b26\u5408\u6761\u4ef6\u8981\u6c42\u7684\u4e8b\u4ef6\u4fe1\u606f:get_top_for_execution_if_time\u3002 \u8fd9\u4e0e\u524d\u9762\u5206\u6790\u7684\u67092\u4e2a\u4e8b\u4ef6\u8c03\u5ea6\u7ebf\u7a0b\u662f\u4e00\u81f4\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Thread 16 (Thread 0x7f8fedcb8700 (LWP 8460)):\n#0  0x00007f90485b166d in nanosleep () from \/lib64\/libc.so.6\n#1  0x00007f90485b1504 in sleep () from \/lib64\/libc.so.6\n#2  0x0000000000cf8afa in Event_gc_scheduler::run(THD*) ()\n#3  0x0000000000cf6d8e in <span class=\"has-inline-color has-luminous-vivid-orange-color\">event_scheduler_thread ()<\/span>\n#4  0x00007f904d3f6dc5 in start_thread () from \/lib64\/libpthread.so.0\n#5  0x00007f90485ea73d in clone () from \/lib64\/libc.so.6\n\u3002\u3002\u3002\u3002\nThread 14 (Thread 0x7f8feccb6700 (LWP 8461)):\n#0  0x00007f904d3faa82 in pthread_cond_timedwait@@GLIBC_2.3.2 () from \/lib64\/libpthread.so.0\n#1  0x0000000000cfe58e in <span class=\"has-inline-color has-luminous-vivid-orange-color\">Event_queue::get_top_for_execution_if_time(THD*, Event_queue_element_for_exec**)<\/span> ()\n#2  0x0000000000cf7bd3 in Event_scheduler::run_internal(THD*) ()\n#3  0x0000000000cf7ca6 in Event_scheduler::run(THD*) ()\n#4  0x0000000000cf6d8e in event_scheduler_thread ()\n#5  0x00007f904d3f6dc5 in start_thread () from \/lib64\/libpthread.so.0\n#6  0x00007f90485ea73d in clone () from \/lib64\/libc.so.6<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E4%BA%8B%E4%BB%B6%E6%89%A7%E8%A1%8C%E6%97%A5%E5%BF%97\"><\/span>\u4e8b\u4ef6\u6267\u884c\u65e5\u5fd7<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%88%9B%E5%BB%BA%E4%BA%8B%E4%BB%B6\"><\/span>\u521b\u5efa\u4e8b\u4ef6<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u53c2\u8003 <a href=\"https:\/\/www.gbase8.cn\/en\/858\/\">GBase 8a\u6570\u636e\u5e93\u5b9a\u65f6\u4efb\u52a1\u8c03\u5ea6\u529f\u80fdevent\u6d4b\u8bd5<\/a>\uff0c \u521b\u5efa\u4e00\u4e2a10\u79d2\u540e\u6267\u884c\u7684\u4e8b\u4ef6\uff0c\u7136\u540e\u770b\u76f8\u5173\u65e5\u5fd7\u8f93\u51fa<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; create table tevent(d datetime);\nQuery OK, 0 rows affected (Elapsed: 00:00:00.31)\n\ngbase&gt; create event test_event on schedule at current_timestamp+interval 10 second do insert into tevent values(now());\nQuery OK, 0 rows affected (Elapsed: 00:00:00.03)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E7%9C%8B%E4%BA%8B%E4%BB%B6%E5%BD%93%E5%89%8D%E7%8A%B6%E6%80%81\"><\/span>\u67e5\u770b\u4e8b\u4ef6\u5f53\u524d\u72b6\u6001<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u901a\u8fc7show events\u83b7\u5f97\u5f53\u524d\u5e93\u6240\u6709event\u7684\u72b6\u6001\u4fe1\u606f\uff0c\u6211\u4eec\u5173\u6ce8test_event\u7684Status\u90e8\u5206,\u5176\u4ece\u521b\u5efa\u540e\u7684<strong>ENABLED<\/strong>\u8f6c\u53d8\u6210\u6267\u884c\u5b8c\u6210\u7684<strong>DISABLED<\/strong>\uff0c\u6700\u540e\u8be5Event\u7531\u4e8e\u53ea\u6267\u884c\u4e00\u6b21\uff0c\u88ab\u5220\u9664\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; show events;\n+--------------+------------------------------------------------------------------+------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+----------+---------------------+----------------+----------------+--------+------+---------+--------------+----------------------+----------------------+--------------------+\n| Vc           | Db                                                               | Name                                                             | Definer                                                                                                                                                                                           | Time zone | Type     | Execute at          | Interval value | Interval field | Starts | Ends | Status  | Execute mode | character_set_client | collation_connection | Database Collation |\n+--------------+------------------------------------------------------------------+------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+----------+---------------------+----------------+----------------+--------+------+---------+--------------+----------------------+----------------------+--------------------+\n| vcname000001 | testdb                                                           | test_event                                                       | root@%                                                                                                                                                                                            | +08:00    | ONE TIME | 2022-03-30 13:53:00 | NULL           | NULL           | NULL   | NULL | <span class=\"has-inline-color has-luminous-vivid-orange-color\"><strong>ENABLED <\/strong><\/span>|            1 | utf8                 | utf8_general_ci      | utf8_general_ci    |\n+--------------+------------------------------------------------------------------+------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+----------+---------------------+----------------+----------------+--------+------+---------+--------------+----------------------+----------------------+--------------------+\n1 row in set (Elapsed: 00:00:00.00)\n\ngbase&gt; show events;\n+--------------+------------------------------------------------------------------+------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+----------+---------------------+----------------+----------------+--------+------+----------+--------------+----------------------+----------------------+--------------------+\n| Vc           | Db                                                               | Name                                                             | Definer                                                                                                                                                                                           | Time zone | Type     | Execute at          | Interval value | Interval field | Starts | Ends | Status   | Execute mode | character_set_client | collation_connection | Database Collation |\n+--------------+------------------------------------------------------------------+------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+----------+---------------------+----------------+----------------+--------+------+----------+--------------+----------------------+----------------------+--------------------+\n| vcname000001 | testdb                                                           | test_event                                                       | root@%                                                                                                                                                                                            | +08:00    | ONE TIME | 2022-03-30 13:53:00 | NULL           | NULL           | NULL   | NULL | <span class=\"has-inline-color has-luminous-vivid-orange-color\"><strong>DISABLED <\/strong><\/span>|            1 | utf8                 | utf8_general_ci      | utf8_general_ci    |\n+--------------+------------------------------------------------------------------+------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+----------+---------------------+----------------+----------------+--------+------+----------+--------------+----------------------+----------------------+--------------------+\n1 row in set (Elapsed: 00:00:00.01)\n\ngbase&gt; show events;\nEmpty set (Elapsed: 00:00:00.00)\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%95%B0%E6%8D%AE%E5%BA%93express%E6%97%A5%E5%BF%97\"><\/span>\u6570\u636e\u5e93express\u65e5\u5fd7<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u5982\u4e0b\u662fgcluster\u7684express.log\u7684\u5bf9\u5e94\u4e8b\u4ef6\u90e8\u5206\uff0c\u53ef\u4ee5\u770b\u5230\u572813\uff1a52\uff1a50\u521b\u5efa\u4e86Event(testdb.test_event), \u572813\uff1a53\uff1a00s\u5220\u9664\u4e86\u8be5event\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>2022-03-30 13:52:50.278 &#91;DDL]&#91;WARN ]&#91;S:7]&#91;Q:64]&lt;GetValidTid|1090&gt;:get table id 0 for : vc00001.testdb.test_event\n2022-03-30 13:53:00.455 &#91;DDL]&#91;WARN ]&#91;S:62]&#91;Q:74]&lt;ProcessDDLResultForVc|5728&gt;:.test_event's tableId is 0.\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E7%9C%8B%E6%89%A7%E8%A1%8C%E7%BB%93%E6%9E%9C\"><\/span>\u67e5\u770b\u6267\u884c\u7ed3\u679c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>tevent\u8868\u91cc\u8bb0\u5f55\u4e86\u6267\u884c\u4e8b\u4ef6\u7684\u7ed3\u679c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; select * from tevent;\n+---------------------+\n| d                   |\n+---------------------+\n| 2022-03-30 13:53:00 |\n+---------------------+\n1 row in set (Elapsed: 00:00:00.02)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%A4%9A%E4%B8%AA%E8%B0%83%E5%BA%A6%E8%8A%82%E7%82%B9%EF%BC%8C%E5%93%AA%E4%B8%AA%E5%BD%93%E5%89%8D%E4%B8%BAMaster\"><\/span>\u591a\u4e2a\u8c03\u5ea6\u8282\u70b9\uff0c\u54ea\u4e2a\u5f53\u524d\u4e3aMaster<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u56e0\u4e3a\u4e8b\u4ef6\u652f\u6301\u5168\u5c40\u7684\uff0c\u6240\u4ee5\u5fc5\u987b\u53ea\u80fd\u6709\u4e00\u4e2amaster\u8282\u70b9\uff0c\u5426\u5219\u591a\u4e2a\u8282\u70b9\u540c\u65f6\u53d1\u8d77\u5168\u5c40\u4e8b\u4ef6\uff0c\u5c06\u9020\u6210\u7ed3\u679c\u9519\u8bef\u3002<\/p>\n\n\n\n<p>\u901a\u8fc7 gcadmin showlock\u80fd\u770b\u5230\u54ea\u4e2a\u8282\u70b9\u62ff\u5230\u4e86event\u7684master\u9501\u3002 \u5982\u4e0b10.0.2.115\u8282\u70b9\u62ff\u5230\u4e86\u9501\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;gbase@gbase_rh7_001 ~]$ gcadmin showlock\n +==================================================================================================+\n |                                          GCLUSTER LOCK                                           |\n +==================================================================================================+\n +---------------------------------------------+----------+--------------+--------------+------+----+\n |                  Lock name                  |  owner   |   content    | create time  |locked|type|\n +---------------------------------------------+----------+--------------+--------------+------+----+\n |                gc-event-lock                |<span class=\"has-inline-color has-luminous-vivid-orange-color\">10.0.2.115<\/span>|global master |20220330175200| <span class=\"has-inline-color has-luminous-vivid-orange-color\">TRUE<\/span> | <span class=\"has-inline-color has-luminous-vivid-orange-color\">E<\/span>  |\n +---------------------------------------------+----------+--------------+--------------+------+----+\n |                gc-event-lock                |10.0.2.101|global master |20220330175207|FALSE | E  |\n\u3002\u3002\u3002\u3002\u3002\u3002\u3002\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%80%BB%E7%BB%93\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>GBase 8a\u53ef\u4ee5\u901a\u8fc7event_scheduler\u53c2\u6570\u6765\u5173\u95ed\u6216\u542f\u52a8\u5168\u96c6\u7fa4\u7684\u4e8b\u4ef6\u8c03\u5ea6\u529f\u80fd\u3002\u6bcf\u4e2a\u4e8b\u4ef6\u7684\u521b\u5efa\u548c\u9500\u6bc1\u90fd\u4f1a\u5728\u3010\u4e3b\u8c03\u5ea6\u3011\u8282\u70b9\u7684express.log\u7559\u4e0b\u65e5\u5fd7\u4fe1\u606f\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u53ea\u662f\u90e8\u5206\u4e8b\u4ef6\u7684\u505c\u7528\uff0c\u53ef\u4ee5\u53c2\u8003 <a href=\"https:\/\/www.gbase8.cn\/en\/246\/\">GBase 8a\u96c6\u7fa4\u6682\u505c\u5b9a\u65f6\u4efb\u52a1event disable<\/a>\uff0c \u4e0d\u9700\u8981\u5c06\u6574\u4e2a\u96c6\u7fa4\u8c03\u5ea6\u90fd\u505c\u7528\u4e86\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>\u5357\u5927\u901a\u7528GBase 8a\u652f\u6301\u6570\u636e\u5e93\u5185\u7684\u5b9a\u65f6\u4efb\u52a1\u4e8b\u4ef6\uff0c\u5176\u8c03\u5ea6\u7a0b\u5e8f\u7531\u6570\u636e\u5e93\u7684daemon\u8fdb\u7a0b\u8d1f\u8d23\uff0c\u672c\u6587\u7b80\u5355\u4ecb\u7ecd\u76f8\u5173\u53c2\u6570 event_scheduler \u4f7f\u7528\u65b9\u6cd5\uff0c\u4ee5\u53ca\u4ece\u6570\u636e\u5e93\u65e5\u5fd7\u7b49\u67e5\u770b\u4e8b\u4ef6\u7684\u76f8\u5173\u4fe1\u606f\u3002<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,6],"tags":[],"class_list":["post-9057","post","type-post","status-publish","format-standard","hentry","category-gbase8a"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/9057","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/comments?post=9057"}],"version-history":[{"count":21,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/9057\/revisions"}],"predecessor-version":[{"id":9087,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/9057\/revisions\/9087"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=9057"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=9057"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=9057"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}