{"id":86394,"date":"2024-01-07T01:28:14","date_gmt":"2024-01-06T17:28:14","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=86394"},"modified":"2024-01-07T01:28:14","modified_gmt":"2024-01-06T17:28:14","slug":"deletefile-space","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/deletefile-space.html","title":{"rendered":"\u4e3a\u4ec0\u4e48\u5220\u9664\u4e86\u6587\u4ef6\u7a7a\u95f4\u5374\u4e0d\u91ca\u653e\uff1f"},"content":{"rendered":"

\u4f60\u662f\u5426\u78b0\u89c1\u8fc7 Linux \u73af\u5883\u4e0b\uff0c\u6587\u4ef6\u5df2\u7ecf\u5220\u9664\uff0c\u4f46\u662f\u7a7a\u95f4\u672a\u88ab\u91ca\u653e\u7684\u60c5\u51b5\uff1f\u8fd9\u7bc7\u5c0f\u6587\u5c31\u4f1a\u4ecb\u7ecd\u4e00\u4e0b\uff0c\u8fd9\u79cd\u95ee\u9898\u7684\u4e00\u4e2a\u573a\u666f\uff0c\u4ee5\u53ca\u76f8\u5e94\u7684\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n

\u6211\u4eec\u7684\u4e00\u53f0\u5e94\u7528\u670d\u52a1\u5668\uff0c\u64cd\u4f5c\u7cfb\u7edf\u662f Red Hat Linux\uff0c\u76d1\u63a7\u62a5\u8b66\uff0c\/opt\/applog\u6587\u4ef6\u7cfb\u7edf\u4f7f\u7528\u7387\u8d85\u9608\u503c\uff0c\u6574\u4f53\u5bb9\u91cf\u4e3a50G\uff0c\u4f46\u53d1\u73b0\u5b9e\u9645\u6587\u4ef6\u5bb9\u91cf20G\uff0c\u5269\u4e0b\u768430G\u7a7a\u95f4\u662f\u4ec0\u4e48\uff1f<\/p>\n

\u6211\u4eec\u77e5\u9053\uff0cLinux \u73af\u5883\u4e0b\uff0c\u4efb\u4f55\u4e8b\u7269\uff0c\u90fd\u662f\u4ee5\u6587\u4ef6\u7684\u5f62\u5f0f\u5b58\u5728\uff0c\u7cfb\u7edf\u5728\u540e\u53f0\uff0c\u4e3a\u6bcf\u4e2a\u5e94\u7528\u7a0b\u5e8f\uff0c\u5206\u914d\u4e86\u4e00\u4e2a\u6587\u4ef6\u63cf\u8ff0\u7b26\uff0c\u4ed6\u4e3a\u5e94\u7528\u7a0b\u5e8f\u548c\u64cd\u4f5c\u7cfb\u7edf\u4e4b\u95f4\u7684\u4ea4\u4e92\u64cd\u4f5c\u63d0\u4f9b\u4e86\u901a\u7528\u7684\u63a5\u53e3\uff0c\u65e2\u7136\u662f\u6587\u4ef6\uff0c\u5c31\u4f1a\u5360\u7528\u7a7a\u95f4\uff0c\u6b64\u65f6\u53ef\u4ee5\u4f7f\u7528 lsof \u6307\u4ee4\uff0c\u4ed6\u53ef\u4ee5\u5217\u51fa\uff0c\u5f53\u524d\u7cfb\u7edf\u6b63\u5728\u6253\u5f00\u7684\u6587\u4ef6\u3002<\/p>\n

\n
>lsof\r\nCOMMAND \u00a0 \u00a0 \u00a0PID \u00a0 \u00a0 \u00a0USER \u00a0 FD \u00a0 \u00a0 \u00a0TYPE \u00a0 \u00a0DEVICE \u00a0SIZE\/OFF \u00a0 \u00a0 \u00a0NODE NAME\r\n...\r\nfilebeat \u00a0111442 \u00a0 app \u00a01r \u00a0 \u00a0 \u00a0REG \u00a0 \u00a0 253,3 209715229 \u00a0 1040407 \/opt\/applog\/E.20171016.info.012.log\r\nfilebeat \u00a0111442 \u00a0 app \u00a02r \u00a0 \u00a0 \u00a0REG \u00a0 \u00a0 253,3 209715254 \u00a0 \u00a0385080 \/opt\/applog\/E.20171015.info.001.log (deleted)\r\n...<\/pre>\n<\/blockquote>\n

\u8868\u5934\u5404\u5b57\u6bb5\uff0c\u542b\u4e49\u5982\u4e0b\uff1a<\/p>\n

COMMAND\uff1a\u8fdb\u7a0b\u7684\u540d\u79f0
\nPID\uff1a\u8fdb\u7a0b\u6807\u8bc6\u7b26
\nUSER\uff1a\u8fdb\u7a0b\u6240\u6709\u8005
\nFD\uff1a\u6587\u4ef6\u63cf\u8ff0\u7b26\uff0c\u5e94\u7528\u7a0b\u5e8f\u901a\u8fc7\u6587\u4ef6\u63cf\u8ff0\u7b26\u8bc6\u522b\u8be5\u6587\u4ef6\u3002\u5982cwd\u3001txt\u7b49
\nTYPE\uff1a\u6587\u4ef6\u7c7b\u578b\uff0c\u5982DIR\u3001REG\u7b49
\nDEVICE\uff1a\u6307\u5b9a\u78c1\u76d8\u7684\u540d\u79f0
\nSIZE\uff1a\u6587\u4ef6\u7684\u5927\u5c0f
\nNODE\uff1a\u7d22\u5f15\u8282\u70b9\uff08\u6587\u4ef6\u5728\u78c1\u76d8\u4e0a\u7684\u6807\u8bc6\uff09
\nNAME\uff1a\u6253\u5f00\u6587\u4ef6\u7684\u786e\u5207\u540d\u79f0<\/p><\/blockquote>\n

\u53ef\u4ee5\u770b\u51fa\uff0c\u6709\u4e00\u4e9b\u884c\u4e2d\uff0cNAME\u6807\u8bc6\u4e86(deleted)<\/p>\n

\/opt\/applog\/E.20171015.info.001.log (deleted)<\/p><\/blockquote>\n

\u4ed6\u7684\u542b\u4e49\uff0c\u5c31\u662f\u8fd9\u6587\u4ef6\u5df2\u88ab\u5220\u9664\uff0c\u4f46\u6253\u5f00\u6587\u4ef6\u7684\u53e5\u67c4\uff0c\u5e76\u672a\u5173\u95ed\uff0c\u518d\u770b COMMAND \u7684\u540d\u79f0\u662f filebeat\uff0cUSER \u8fdb\u7a0b\u6240\u6709\u8005\u662f app\uff0c\u8fd9\u662f\u6211\u4eec\u7684\u65e5\u5fd7\u91c7\u96c6\u8fdb\u7a0b\uff0capp \u7528\u6237\u5f00\u542f\u4e86 filebeat \u8fdb\u7a0b\u3002<\/p>\n

\u63d2\u64ad\u4e00\u4e0b\u65e5\u5fd7\u91c7\u96c6\u5e73\u53f0<\/p>\n

\u4f20\u7edf\u7684\u5f00\u6e90\u65e5\u5fd7\u5e73\u53f0\uff0c\u5373 ELK\uff0c\u7531 ElasticSearch\u3001Logstash \u548c Kiabana \u4e09\u4e2a\u5f00\u6e90\u5de5\u5177\u7ec4\u6210\uff0c\u5176\u4e2d\uff1a<\/p>\n