{"id":369,"date":"2022-01-13T09:47:21","date_gmt":"2022-01-13T01:47:21","guid":{"rendered":"http:\/\/192.168.1.218:88\/?p=369"},"modified":"2022-01-13T09:47:21","modified_gmt":"2022-01-13T01:47:21","slug":"%e3%80%90dataserver%e3%80%91%e8%a7%86%e9%a2%91%e6%95%b0%e6%8d%ae%e6%b8%85%e7%90%86%e8%84%9a%e6%9c%ac","status":"publish","type":"post","link":"http:\/\/learning.sino-vt.com:8988\/index.php\/2022\/01\/13\/%e3%80%90dataserver%e3%80%91%e8%a7%86%e9%a2%91%e6%95%b0%e6%8d%ae%e6%b8%85%e7%90%86%e8%84%9a%e6%9c%ac\/","title":{"rendered":"\u3010dataserver\u3011\u89c6\u9891\u6570\u636e\u6e05\u7406\u811a\u672c"},"content":{"rendered":"<table>\n<tbody>\n<tr>\n<td>\n\u5907\u4efd\u670d\u52a1\u5668\u4f7f\u7528\u8fc1\u79fb\u7684\u5f62\u5f0f\uff0c\u7531\u4e8e\u6570\u636e\u91cf\u5927\u5b58\u50a8\u7a7a\u95f4\u6709\u9650\uff0c\u5f53\u524ddataserver\u6570\u636e\u5206\u533a\u603b\u5927\u5c0f4T\uff0c\u4e24\u4e2aserver\u670d\u52a1\u5668\uff0c\u6bcf\u5929\u89c6\u9891\u6570\u636e\u5171\u4ea7\u751f200G-300G\uff0cdataserver\u5dee\u4e0d\u591a\u5b58\u4e00\u4e2a\u534a\u6708\u6570\u636e\u3002<br \/>\ndataserver\u5f55\u50cf\u6570\u636e\u76ee\u5f55\u683c\u5f0f\uff1adataserver\u5b58\u50a8\u8def\u5f84\/serverID\/server\u5b58\u50a8\u8def\u5f84<br \/>\n\u5f55\u50cf\u6587\u4ef6\u4e00\u5929\u4e00\u4e2a\u76ee\u5f55\u4ee5\u5e74-\u6708-\u65e5\u7684\u683c\u5f0f\u751f\u6210\uff0c\u6839\u636e\u76ee\u5f55\u540d\u79f0\u5220\u9664\u6570\u636e\u3002\u9633\u5149\u4fdd\u9669\u4f7f\u7528\u5b9a\u65f6\u4efb\u52a1\u4e00\u4e2a\u5c0f\u65f6\u68c0\u67e5\u4e00\u6b21\uff0c\u5982\u679c\u5360\u7528\u7387\u8d85\u8fc784%\u5c31\u5220\u9664\u4e00\u5929\u5386\u53f2\u6570\u636e\u3002<br \/>\n\u5b9a\u65f6\u4efb\u52a1\u683c\u5f0f\uff1a1 *\/1 * * * \/bin\/bash \/data1\/dataclean\/dataclean.sh<br \/>\n\u811a\u672c\u53ef\u4ee5\u76f4\u63a5\u4fee\u6539path\u5730\u5740\u4f7f\u7528\uff0c\u5982\u679c\u5176\u4ed6\u670d\u52a1\u4f7f\u7528\u6216\u8005\u5220\u9664\u6570\u91cf\u4e0d\u540c\u6839\u636e\u5177\u4f53\u60c5\u51b5\u4fee\u6539\u3002<br \/>\n\u811a\u672c\u5185\u5bb9\uff1a<\/p>\n<ol>\n<li>#!\/bin\/bash<\/li>\n<li>datasize=`df -h |grep data1|awk &#8216;{print $5}&#8217;|awk -F &#8216;%&#8217; &#8216;{print $1}&#8217;`<\/li>\n<li>path1=\/data1\/data\/\u670d\u52a1\u56681id\/data&#8230;\/<\/li>\n<li>path2=\/data1\/data\/\u670d\u52a1\u56682id\/data&#8230;\/<\/li>\n<li>if [[ $datasize -ge 84 ]]<\/li>\n<li>#\u5ba2\u6237\u76d1\u63a7\u7cfb\u7edf85%\u544a\u8b66<\/li>\n<li>then<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0delfile1=`ls -v $path1 | awk &#8216;NR==1{print $1}&#8217;`<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0delfile2=`ls -v $path2 | awk &#8216;NR==1{print $1}&#8217;`<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0echo &#8220;$(date +%Y\/%m\/%d\\ %T)\u00a0\u00a0Delete files in date1 $path1:$delfile1&#8221; &gt;&gt; \/tmp\/dataclean.log<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0echo &#8220;$(date +%Y\/%m\/%d\\ %T)\u00a0\u00a0Delete files in date1 $path2:$delfile2&#8221; &gt;&gt; \/tmp\/dataclean.log<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0rm -rf $path1$delfile1 $path2$delfile2<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0if [ -e &#8220;$path1$delfile1&#8221; -o -e &#8220;$path2$delfile2&#8221; ]; then<\/li>\n<li>#\u53cc\u4e2d\u62ec\u53f7\u4f7f\u7528-o\u62a5\u9519<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0 echo &#8220;$(date +%Y\/%m\/%d\\ %T)\u00a0\u00a0[ERROR]:Failed to delete file&#8221; &gt;&gt; \/tmp\/dataclean.log<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0 exit 1<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0else<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0 echo &#8220;$(date +%Y\/%m\/%d\\ %T)\u00a0\u00a0File deleted successfully&#8221; &gt;&gt; \/tmp\/dataclean.log<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0 exit 2<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0fi<\/li>\n<li>else<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0echo &#8220;$(date +%Y\/%m\/%d\\ %T)\u00a0\u00a0The size of data1 is $datasize%&#8221; &gt;&gt; \/tmp\/dataclean.log<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0exit 3<\/li>\n<li>fi<\/li>\n<\/ol>\n<p>\u590d\u5236\u4ee3\u7801<\/p>\n<p>\u5220\u9664\u591a\u5929\u6570\u636e\u811a\u672c\uff1a<\/p>\n<ol>\n<li>#!\/bin\/bash<\/li>\n<li>datasize=`df -h |grep data1|awk &#8216;{print $5}&#8217;|awk -F &#8216;%&#8217; &#8216;{print $1}&#8217;`<\/li>\n<li>path1=\/data1\/data\/\u670d\u52a1\u56681id\/data&#8230;\/<\/li>\n<li>path2=\/data1\/data\/\u670d\u52a1\u56682id\/data&#8230;\/<\/li>\n<li>if [[$datasize -ge 89 ]]<\/li>\n<li>then<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0delfile1=`ls -v $path1 | awk &#8216;NR&lt;=5{print $1}&#8217;`<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0delfile2=`ls -v $path2 | awk &#8216;NR&lt;=5{print $1}&#8217;`<\/li>\n<li>#\u52205\u5929<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0echo &#8220;$(date +%Y\/%m\/%d\\ %T)\u00a0\u00a0Delete files in date1 $path1:$delfile1&#8221; &gt;&gt; \/tmp\/dataclean.log<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0echo &#8220;$(date +%Y\/%m\/%d\\ %T)\u00a0\u00a0Delete files in date1 $path2:$delfile2&#8221; &gt;&gt; \/tmp\/dataclean.log<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0cd $path1<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0rm -rf $delfile1<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0cd $path2<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0rm -rf $delfile2<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0delfile1_1=`echo $delfile1 | awk &#8216;{print $1}&#8217;`<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0delfile1_2=`echo $delfile1 | awk &#8216;{print $2}&#8217;`<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0delfile1_3=`echo $delfile1 | awk &#8216;{print $3}&#8217;`<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0delfile1_4=`echo $delfile1 | awk &#8216;{print $4}&#8217;`<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0delfile1_5=`echo $delfile1 | awk &#8216;{print $5}&#8217;`<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0delfile2_1=`echo $delfile2 | awk &#8216;{print $1}&#8217;`<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0delfile2_2=`echo $delfile2 | awk &#8216;{print $2}&#8217;`<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0delfile2_3=`echo $delfile2 | awk &#8216;{print $3}&#8217;`<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0delfile2_4=`echo $delfile2 | awk &#8216;{print $4}&#8217;`<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0delfile2_5=`echo $delfile2 | awk &#8216;{print $5}&#8217;`<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0if [ -e &#8220;$path1$delfile1_1&#8221; -o\u00a0\u00a0-e &#8220;$path1$delfile1_2&#8221; -o\u00a0\u00a0-e &#8220;$path1$delfile1_3&#8221; -o -e &#8220;$path1$delfile1_4&#8221; -o -e &#8220;$path1$delfile1_5&#8221; -o -e &#8220;$path1$delfile2_1&#8221; -o\u00a0\u00a0-e &#8220;$path1$delfile2_2&#8221; -o\u00a0\u00a0-e &#8220;$path1$delfile2_3&#8221; -o -e &#8220;$path1$delfile2_4&#8221; -o -e &#8220;$path1$delfile2_5&#8221; ]; then<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0 echo &#8220;$(date +%Y\/%m\/%d\\ %T) [ERROR]:Failed to delete file&#8221; &gt;&gt; \/tmp\/dataclean.log<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0 exit 1<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0else<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0 echo &#8220;$(date +%Y\/%m\/%d\\ %T) File deleted successfully&#8221; &gt;&gt; \/tmp\/dataclean.log<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0 exit 2<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0fi<\/li>\n<li>else<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0echo &#8220;$(date +%Y\/%m\/%d\\ %T)\u00a0\u00a0The size of data1 is $datasize %&#8221; &gt;&gt; \/tmp\/dataclean.log<\/li>\n<li>\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0exit 3<\/li>\n<li>fi<\/li>\n<\/ol>\n<p>\u590d\u5236\u4ee3\u7801<\/p>\n<p>\u5ba2\u6237\u5b9e\u9645\u60c5\u51b5\u622a\u56fe\uff1a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong><a href=\"http:\/\/as.vm-v.com\/forum.php?mod=attachment&amp;aid=ODU1fDkzNGE0YzI1fDE2NDE5NTgzMDF8MjR8NDEz&amp;nothumb=yes&quot; \\t &quot;http:\/\/as.vm-v.com\/_blank\">\u811a\u672c\u622a\u56fe.jpg<\/a><\/strong>\u00a0(1.07 MB, \u4e0b\u8f7d\u6b21\u6570: 1)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1920\" height=\"960\" class=\"wp-image-370\" src=\"http:\/\/192.168.1.218:88\/wp-content\/uploads\/2022\/01\/jpg.jpeg\" alt=\"\u811a\u672c\u622a\u56fe.jpg\" srcset=\"http:\/\/learning.sino-vt.com:8988\/wp-content\/uploads\/2022\/01\/jpg.jpeg 1920w, http:\/\/learning.sino-vt.com:8988\/wp-content\/uploads\/2022\/01\/jpg-300x150.jpeg 300w, http:\/\/learning.sino-vt.com:8988\/wp-content\/uploads\/2022\/01\/jpg-1024x512.jpeg 1024w, http:\/\/learning.sino-vt.com:8988\/wp-content\/uploads\/2022\/01\/jpg-768x384.jpeg 768w, http:\/\/learning.sino-vt.com:8988\/wp-content\/uploads\/2022\/01\/jpg-1536x768.jpeg 1536w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5907\u4efd\u670d\u52a1\u5668\u4f7f\u7528\u8fc1\u79fb\u7684\u5f62\u5f0f\uff0c\u7531\u4e8e\u6570\u636e\u91cf\u5927\u5b58\u50a8\u7a7a\u95f4\u6709\u9650\uff0c\u5f53\u524ddataserver\u6570\u636e\u5206\u533a\u603b\u5927\u5c0f4T\uff0c\u4e24\u4e2aserve [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-369","post","type-post","status-publish","format-standard","hentry","category-auditsys"],"_links":{"self":[{"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/posts\/369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/comments?post=369"}],"version-history":[{"count":1,"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/posts\/369\/revisions"}],"predecessor-version":[{"id":371,"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/posts\/369\/revisions\/371"}],"wp:attachment":[{"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/media?parent=369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/categories?post=369"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/tags?post=369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}