{"id":14,"date":"2024-02-01T05:45:29","date_gmt":"2024-01-31T21:45:29","guid":{"rendered":"http:\/\/www.pay299.com\/?p=14"},"modified":"2024-02-01T05:45:29","modified_gmt":"2024-01-31T21:45:29","slug":"es%e5%a4%87%e4%bb%bd%e4%b9%8bsnapshot-slm%e7%ad%96%e7%95%a5cron%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.pay299.com\/index.php\/2024\/02\/01\/es%e5%a4%87%e4%bb%bd%e4%b9%8bsnapshot-slm%e7%ad%96%e7%95%a5cron%e8%af%a6%e8%a7%a3\/","title":{"rendered":"es\u5907\u4efd\u4e4bsnapshot SLM\u7b56\u7565cron\u8be6\u89e3"},"content":{"rendered":"<p>\u5728ES\u96c6\u7fa4\u79cd\uff0csnapshot\u4f5c\u4e3a\u4e00\u79cd\u7b80\u5355\u800c\u4e14\u80fd\u591f\u6ee1\u8db3\u81ea\u52a8\u5316\u7684\u5907\u4efd\u65b9\u5f0f\uff0c\u901a\u8fc7\u5b9a\u4e49SLM\uff08\u5feb\u7167\u751f\u547d\u5468\u671f\uff09\u6765\u5b9e\u73b0\u4e00\u4e2a\u81ea\u52a8\u5907\u4efd\u7684\u64cd\u4f5c\u3002\u4e14\u901a\u8fc7\u8bbe\u7f6e\u8fd8\u53ef\u4ee5\u7ba1\u7406\u5feb\u7167\u7684\u4fdd\u5b58\u5220\u9664\u4e4b\u7c7b\u7684\u64cd\u4f5c\uff0c\u53ef\u4ee5\u8bf4\u6781\u5927\u7684\u8282\u7701\u4e86\u8fd0\u7ef4\u4eba\u5458\u7684\u5de5\u4f5c\u6210\u672c\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.pay299.com\/wp-content\/uploads\/2024\/02\/7777-300x188.webp\" alt=\"\" width=\"300\" height=\"188\" class=\"alignnone size-medium wp-image-15\" srcset=\"https:\/\/www.pay299.com\/wp-content\/uploads\/2024\/02\/7777-300x188.webp 300w, https:\/\/www.pay299.com\/wp-content\/uploads\/2024\/02\/7777-768x480.webp 768w, https:\/\/www.pay299.com\/wp-content\/uploads\/2024\/02\/7777-480x300.webp 480w, https:\/\/www.pay299.com\/wp-content\/uploads\/2024\/02\/7777.webp 800w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>cron\u8868\u8fbe\u5f0f<br \/>\n&lt;seconds&gt; &lt;minutes&gt; &lt;hours&gt; &lt;day_of_month&gt; &lt;month&gt; &lt;day_of_week&gt; [year]<br \/>\n1<br \/>\n\u6240\u6709\u8ba1\u5212\u5747\u4ee5\u4e16\u754c\u65f6\uff08UTC\uff09\u4e3a\u51c6\uff0c\u4e0d\u652f\u6301\u5176\u4ed6\u65f6\u533a\u3002<\/p>\n<p>corn\u8868\u8fbe\u539f\u4ef6<br \/>\n\u9664year\u4ee5\u5916\uff0c\u5176\u4ed6\u6240\u6709\u5143\u7d20\u90fd\u662f\u5fc5\u9700\u7684\u3002<\/p>\n<p>\u5143\u7d20 \u6027\u8d28 \u6709\u6548\u503c<br \/>\n&lt;seconds&gt; \u5fc5\u586b 0-59\u548c\u7279\u6b8a\u5b57\u7b26, &#8211; * \/<br \/>\n&lt;minutes&gt; \u5fc5\u586b 0-59\u548c\u7279\u6b8a\u5b57\u7b26, &#8211; * \/<br \/>\n&lt;hours&gt; \u5fc5\u586b 0-23\u548c\u7279\u6b8a\u5b57\u7b26, &#8211; * \/<br \/>\n&lt;day_of_month&gt; \u5fc5\u586b 1-31\u548c\u7279\u6b8a\u5b57\u7b26, &#8211; * \/ ? L W<br \/>\n&lt;month&gt; \u5fc5\u586b 1- 12\uff0cJAN- DEC\uff0cjan-dec\u548c\u7279\u6b8a\u5b57\u7b26, &#8211; * \/<br \/>\n&lt;day_of_week&gt; \u5fc5\u586b 1- 7\uff0cSUN- SAT\uff0csun-sat\u548c\u7279\u6b8a\u5b57\u7b26, &#8211; * \/ ? L #<br \/>\n&lt;year&gt; \u53ef\u9009 1970-2099\u548c\u7279\u6b8a\u5b57\u7b26, &#8211; * \/<br \/>\ncron\u7279\u6b8a\u5b57\u7b26<br \/>\n\u7279\u6b8a\u5b57\u7b26 \u5177\u4f53\u4f7f\u7528\u65b9\u6cd5<br \/>\n* \u9009\u62e9\u4e00\u4e2a\u5b57\u6bb5\u7684\u6bcf\u4e2a\u53ef\u80fd\u7684\u503c\u3002\u4f8b\u5982\uff0c*\u5728\u8be5hours\u5b57\u6bb5\u4e2d\u8868\u793a\u201c\u6bcf\u5c0f\u65f6\u201d\u3002<br \/>\n\uff1f \u6ca1\u6709\u5177\u4f53\u503c\u3002\u5f53\u60a8\u4e0d\u5728\u4e4e\u503c\u662f\u4ec0\u4e48\u65f6\u4f7f\u7528\u3002\u4f8b\u5982\uff0c\u5982\u679c\u60a8\u5e0c\u671b\u8ba1\u5212\u5728\u6bcf\u6708\u7684\u7279\u5b9a\u65e5\u671f\u89e6\u53d1\uff0c\u4f46\u4e0d\u5728\u4e4e\u661f\u671f\u51e0\uff0c\u5219\u53ef\u4ee5?\u5728 day_of_week\u5b57\u6bb5\u4e2d\u6307\u5b9a\u3002<br \/>\n&#8211; \u503c\u7684\u8303\u56f4\uff08\u542b\uff09\u3002\u7528\u4e8e\u5206\u9694\u6700\u5c0f\u503c\u548c\u6700\u5927\u503c\u3002\u4f8b\u5982\uff0c\u5982\u679c\u60a8\u5e0c\u671b\u65f6\u95f4\u8868\u5728\u4e0a\u53489:00\u548c\u4e0b\u53485:00\u4e4b\u95f4\u6bcf\u5c0f\u65f6\u89e6\u53d1\u4e00\u6b21\uff0c\u5219\u53ef\u4ee59-17\u5728hours\u5b57\u6bb5\u4e2d\u6307\u5b9a\u3002<br \/>\n\uff0c \u591a\u4e2a\u503c\u3002\u7528\u4e8e\u5206\u9694\u5b57\u6bb5\u7684\u591a\u4e2a\u503c\u3002\u4f8b\u5982\uff0c\u5982\u679c\u60a8\u5e0c\u671b\u65f6\u95f4\u8868\u5728\u6bcf\u4e2a\u661f\u671f\u4e8c\u548c\u661f\u671f\u56db\u89e6\u53d1\uff0c\u5219\u53ef\u4ee5TUE,THU \u5728day_of_week\u5b57\u6bb5\u4e2d\u6307\u5b9a\u3002<br \/>\n\/ \u589e\u91cf\u3002\u6307\u5b9a\u65f6\u95f4\u589e\u91cf\u65f6\u7528\u4e8e\u5206\u9694\u503c\u3002\u7b2c\u4e00\u4e2a\u503c\u4ee3\u8868\u8d77\u70b9\uff0c\u7b2c\u4e8c\u4e2a\u503c\u4ee3\u8868\u95f4\u9694\u3002\u4f8b\u5982\uff0c\u5982\u679c\u60a8\u5e0c\u671b\u65f6\u95f4\u8868\u4ece\u5c0f\u65f6\u7684\u9876\u90e8\u5f00\u59cb\u6bcf20\u5206\u949f\u89e6\u53d1\u4e00\u6b21\uff0c\u5219\u53ef\u4ee50\/20 \u5728minutes\u5b57\u6bb5\u4e2d\u6307\u5b9a\u3002\u540c\u6837\uff0c\u4ece\u8be5\u6708\u7684\u7b2c\u4e00\u5929\u5f00\u59cb\uff0c1\/5\u5728 day_of_month\u5b57\u6bb5\u4e2d\u6307\u5b9a\u5c06\u6bcf5\u5929\u89e6\u53d1\u4e00\u6b21\u3002<br \/>\nL \u6700\u540e\u7684\u3002\u5728day_of_month\u5b57\u6bb5\u4e2d\u4f7f\u7528\u8868\u793a\u6708\u4efd\u7684\u6700\u540e\u4e00\u5929-\u975e-\u5e74\u76841\u670831\u65e5\uff0c2\u6708\u768428\u65e5\uff0c4\u6708\u768430\u65e5\uff0c\u4f9d\u6b64\u7c7b\u63a8\u3002\u5728day_of_week\u5b57\u6bb5\u4e2d\u5355\u72ec\u4f7f\u7528\u4ee3\u66ff7\u6216SAT\uff0c\u6216\u5728\u4e00\u5468\u4e2d\u7684\u7279\u5b9a\u65e5\u671f\u4e4b\u540e\u9009\u62e9\u8be5\u7c7b\u578b\u5728\u6708\u4e2d\u7684\u6700\u540e\u4e00\u5929\u3002\u4f8b\u5982\uff0c6L\u8868\u793a\u6708\u4efd\u7684\u6700\u540e\u4e00\u4e2a\u661f\u671f\u4e94\u3002\u60a8\u53ef\u4ee5LW\u5728day_of_month \u5b57\u6bb5\u4e2d\u6307\u5b9a\u4ee5\u6307\u5b9a\u8be5\u6708\u7684\u6700\u540e\u4e00\u4e2a\u5de5\u4f5c\u65e5\u3002L\u5728\u6307\u5b9a\u503c\u5217\u8868\u6216\u503c\u8303\u56f4\u65f6\u907f\u514d\u4f7f\u7528\u8be5\u9009\u9879\uff0c\u56e0\u4e3a\u7ed3\u679c\u53ef\u80fd\u4e0d\u4f1a\u8fbe\u5230\u60a8\u7684\u671f\u671b\u3002<br \/>\nW \u5e73\u65e5 \u7528\u4e8e\u6307\u5b9a\u6700\u63a5\u8fd1\u7ed9\u5b9a\u65e5\u671f\u7684\u5de5\u4f5c\u65e5\uff08\u661f\u671f\u4e00\u81f3\u661f\u671f\u4e94\uff09\u3002\u4f8b\u5982\uff0c\u5982\u679c\u60a815W\u5728day_of_month\u5b57\u6bb5\u4e2d\u6307\u5b9a\uff0c \u800c15\u53f7\u662f\u661f\u671f\u516d\uff0c\u90a3\u4e48\u65f6\u95f4\u8868\u5c06\u572814\u53f7\u89e6\u53d1\u3002\u5982\u679c15\u65e5\u662f\u661f\u671f\u65e5\uff0c\u5219\u65f6\u95f4\u8868\u5c06\u572816\u65e5\u661f\u671f\u4e00\u89e6\u53d1\u3002\u5982\u679c15\u65e5\u662f\u661f\u671f\u4e8c\uff0c\u5219\u65f6\u95f4\u8868\u5c06\u572815\u65e5\u661f\u671f\u4e8c\u89e6\u53d1\u3002\u4f46\u662f\uff0c\u5982\u679c\u60a8\u5c061W\u7684\u503c\u6307\u5b9a\u4e3aday_of_month\u4e14\u7b2c1\u4e2a\u662f\u661f\u671f\u516d\uff0c\u5219\u8ba1\u5212\u5c06\u5728\u7b2c3\u4e2a\u661f\u671f\u4e00\u89e6\u53d1-\u5b83\u4e0d\u4f1a\u8df3\u8fc7\u6708\u4efd\u8fb9\u754c\u3002\u60a8\u53ef\u4ee5LW\u5728day_of_month\u5b57\u6bb5\u4e2d\u6307\u5b9a\u4ee5\u6307\u5b9a\u8be5\u6708\u7684\u6700\u540e\u4e00\u4e2a\u5de5\u4f5c\u65e5\u3002\u60a8\u53ea\u80fd\u5728W\u5f53\u5929day_of_month\u662f\u4e00\u5929\u65f6\u4f7f\u7528\u8be5\u9009\u9879-\u5728\u6307\u5b9a\u65e5\u671f\u8303\u56f4\u6216\u65e5\u671f\u5217\u8868\u65f6\u65e0\u6548\u3002<br \/>\n# \u4e00\u4e2a\u6708\u4e2d\u7684\u7b2cN\u4e2aXXX\u5929\u3002\u5728day_of_week\u5b57\u6bb5\u4e2d\u4f7f\u7528\u4ee5\u6307\u5b9a\u6bcf\u6708\u7684\u7b2cXXX\u5929\u3002\u4f8b\u5982\uff0c\u5982\u679c\u6307\u5b9a6#1\uff0c\u5219\u8ba1\u5212\u5c06\u5728\u8be5\u6708\u7684\u7b2c\u4e00\u4e2a\u661f\u671f\u4e94\u89e6\u53d1\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u60a8\u6307\u5b9a3#5\u5e76\u4e14\u7279\u5b9a\u6708\u4efd\u4e2d\u6ca1\u67095\u4e2a\u661f\u671f\u4e8c\uff0c\u5219\u8ba1\u5212\u4e0d\u4f1a\u89e6\u53d1\u8be5\u6708\u4efd\u3002<br \/>\n\u4f8b\u5b50<br \/>\n\u8bbe\u7f6e\u6bcf\u65e5\u89e6\u53d1<br \/>\n0 5 9 \\* \\* ? \u6bcf\u5929\u5728\u4e16\u754c\u6807\u51c6\u65f6\u95f4\u4e0a\u53489:05\u89e6\u53d1\u3002<br \/>\n0 5 9 \\* \\* ? 2020 2020\u5e74\u671f\u95f4\uff0c\u6bcf\u5929\u5728\u4e16\u754c\u6807\u51c6\u65f6\u95f4\u4e0a\u53489:05\u89e6\u53d1\u3002<br \/>\n1<br \/>\n2<br \/>\n\u5c06\u89e6\u53d1\u5668\u9650\u5236\u5728\u51e0\u5929\u6216\u8005\u65f6\u95f4\u8303\u56f4\u5185<br \/>\n0 5 9 ? * MON-FRI \u661f\u671f\u4e00\u81f3\u661f\u671f\u4e94\uff0c\u4e16\u754c\u6807\u51c6\u65f6\u95f4\u4e0a\u53489:05\u89e6\u53d1\u3002<br \/>\n0 0-5 9 * * ? \u4eceUTC\u4e0a\u53489:00\u5f00\u59cb\u5230UTC\u6bcf\u59299:05\u7ed3\u675f\uff0c\u6bcf\u5206\u949f\u89e6\u53d1\u4e00\u6b21\u3002<br \/>\n1<br \/>\n2<br \/>\n\u8bbe\u7f6e\u95f4\u9694\u89e6\u53d1<br \/>\n0 0\/15 9 * * ? \u4eceUTC\u4e0a\u53489:00\u5f00\u59cb\u5230UTC\u6bcf\u59299:45\u7ed3\u675f\uff0c\u6bcf15\u5206\u949f\u89e6\u53d1\u4e00\u6b21\u3002<br \/>\n0 5 9 1\/3 * ? \u4ece\u6bcf\u6708\u7684\u7b2c\u4e00\u5929\u5f00\u59cb\uff0c\u6bcf\u6708\u6bcf3\u5929\u5728UTC\u4e0a\u53489:05\u89e6\u53d1\u3002<\/p>\n<p>\u8bbe\u7f6e\u5728\u7279\u5b9a\u7684\u65e5\u671f\u89e6\u53d1<br \/>\n0 1 4 1 4 ? \u5728\u6bcf\u5e74\u4e16\u754c\u6807\u51c6\u65f6\u95f44\u67081\u65e5\u51cc\u66684:01\u89e6\u53d1\u3002<br \/>\n0 0,30 9 ? 4 WED 4\u6708\u7684\u6bcf\u4e2a\u661f\u671f\u4e09\uff0c\u5728UTC\u4e0a\u53489:00\u548cUTC\u4e0a\u53489:30\u89e6\u53d1\u3002<br \/>\n0 5 9 15 * ? \u5728\u6bcf\u4e2a\u6708\u768415\u65e5\uff08\u4e16\u754c\u6807\u51c6\u65f6\u95f4\uff09\u4e0a\u53489:05\u89e6\u53d1\u3002<br \/>\n0 5 9 15W * ? \u5728\u6bcf\u4e2a\u670815\u65e5\u6700\u8fd1\u7684\u5de5\u4f5c\u65e5\uff08\u4e16\u754c\u6807\u51c6\u65f6\u95f4\uff09\u4e0a\u53489:05\u89e6\u53d1\u3002<br \/>\n0 5 9 ? * 6#1 \u5728\u6bcf\u4e2a\u6708\u7684\u7b2c\u4e00\u4e2a\u661f\u671f\u4e94\u4e0a\u53489:05\u89e6\u53d1\u3002<\/p>\n<p>\u4f7f\u7528last\u8bbe\u7f6e\u89e6\u53d1\u5668<br \/>\n0 5 9 L * ? \u5728\u6bcf\u4e2a\u6708\u7684\u6700\u540e\u4e00\u5929\u4e0a\u53489:05\u5728\u4e16\u754c\u6807\u51c6\u65f6\u95f4\u89e6\u53d1\u3002<br \/>\n0 5 9 ? * 2L \u5728\u6bcf\u4e2a\u6708\u7684\u6700\u540e\u4e00\u4e2a\u661f\u671f\u4e00\u7684UTC\u4e0a\u53489:05\u89e6\u53d1\u3002<br \/>\n0 5 9 LW * ? \u5728\u6bcf\u4e2a\u6708\u7684\u6700\u540e\u4e00\u4e2a\u5de5\u4f5c\u65e5\u4e16\u754c\u6807\u51c6\u65f6\u95f4\u4e0a\u53489:05\u89e6\u53d1\u3002<\/p>\n<p>\u6700\u540e\u9644\u4e00\u4e2a\u5173\u4e8e\u8bbe\u7f6eSLM\u7b56\u7565\u7684\u65b9\u6cd5\u7ed9\u5927\u5bb6\u4e00\u4e2a\u4f8b\u5b50\uff0c\u4ec5\u4f9b\u53c2\u8003<\/p>\n<p>[root@localhost ~]# curl -X PUT &#8220;192.168.159.128:9201\/_slm\/policy\/backup-snapshots?pretty&#8221; -H &#8216;Content-Type: application\/json&#8217; -d&#8217;<br \/>\n{<br \/>\n&#8220;schedule&#8221;: &#8220;0 0 0 ? * 2&#8221;, #\u5907\u4efd\u7684\u65f6\u95f4<br \/>\n&#8220;name&#8221;: &#8220;&lt;backup-snap-{now\/d}&gt;&#8221;, #\u5feb\u7167\u7684\u540d\u79f0\u683c\u5f0f<br \/>\n&#8220;repository&#8221;: &#8220;back&#8221;, #\u5907\u4efd\u7684repository<br \/>\n&#8220;config&#8221;: {<br \/>\n&#8220;indices&#8221;: [&#8220;*&#8221;] #\u5907\u4efd\u7684\u7d22\u5f15<br \/>\n},<br \/>\n&#8220;retention&#8221;: {<br \/>\n&#8220;expire_after&#8221;: &#8220;14d&#8221;, #\u5feb\u7167\u5b58\u50a8\u7684\u5929\u6570<br \/>\n&#8220;min_count&#8221;: 3, #\u6700\u5c11\u5b58\u591a\u5c11\u5feb\u7167<br \/>\n&#8220;max_count&#8221;: 5 #\u6700\u591a\u5b58\u591a\u5c11\u5feb\u7167<br \/>\n}<br \/>\n}<br \/>\n&#8216;<\/p>\n<p>\u53c2\u8003\u94fe\u63a5\uff1a<\/p>\n<p>https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/cron-expressions.html#cron-special-characters<br \/>\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/p>\n<p>\u7248\u6743\u58f0\u660e\uff1a\u672c\u6587\u4e3a\u535a\u4e3b\u539f\u521b\u6587\u7ae0\uff0c\u9075\u5faa CC 4.0 BY-SA \u7248\u6743\u534f\u8bae\uff0c\u8f6c\u8f7d\u8bf7\u9644\u4e0a\u539f\u6587\u51fa\u5904\u94fe\u63a5\u548c\u672c\u58f0\u660e\u3002<\/p>\n<p>\u539f\u6587\u94fe\u63a5\uff1ahttps:\/\/blog.csdn.net\/m0_46435788\/article\/details\/116998565<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728ES\u96c6\u7fa4\u79cd\uff0csnapshot\u4f5c\u4e3a\u4e00\u79cd\u7b80\u5355\u800c\u4e14\u80fd\u591f\u6ee1\u8db3\u81ea\u52a8\u5316\u7684\u5907\u4efd\u65b9\u5f0f\uff0c\u901a\u8fc7\u5b9a\u4e49SLM\uff08\u5feb\u7167\u751f\u547d\u5468\u671f\uff09\u6765\u5b9e\u73b0\u4e00 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-14","post","type-post","status-publish","format-standard","hentry","category-tp"],"_links":{"self":[{"href":"https:\/\/www.pay299.com\/index.php\/wp-json\/wp\/v2\/posts\/14","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pay299.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pay299.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pay299.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pay299.com\/index.php\/wp-json\/wp\/v2\/comments?post=14"}],"version-history":[{"count":0,"href":"https:\/\/www.pay299.com\/index.php\/wp-json\/wp\/v2\/posts\/14\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.pay299.com\/index.php\/wp-json\/wp\/v2\/media?parent=14"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pay299.com\/index.php\/wp-json\/wp\/v2\/categories?post=14"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pay299.com\/index.php\/wp-json\/wp\/v2\/tags?post=14"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}