{"id":5506,"date":"2023-09-04T20:52:21","date_gmt":"2023-09-04T12:52:21","guid":{"rendered":"https:\/\/ixyzero.com\/blog\/?p=5506"},"modified":"2023-09-04T20:52:21","modified_gmt":"2023-09-04T12:52:21","slug":"hdfs%e7%9a%84%e4%b8%80%e4%ba%9b%e7%9f%a5%e8%af%86%e7%82%b9%e8%ae%b0%e5%bd%95","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/5506.html","title":{"rendered":"HDFS\u7684\u4e00\u4e9b\u77e5\u8bc6\u70b9\u8bb0\u5f55"},"content":{"rendered":"\n<p>=Start=<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u7f18\u7531\uff1a<\/h4>\n\n\n\n<p>\u6700\u8fd1\u5728\u770b\u548c HDFS \u76f8\u5173\u7684\u6570\u636e\u5b89\u5168\u95ee\u9898\uff0c\u4e86\u89e3\u5230\u4e86\u4e00\u4e9b\u4e4b\u524d\u4e0d\u77e5\u9053\u98ce\u9669\uff0c\u5728\u6b64\u8fc7\u7a0b\u4e2d\u4e3a\u4e86\u9a8c\u8bc1\u76f8\u5173\u64cd\u4f5c\uff0c\u7b80\u5355\u914d\u7f6e\u5b66\u4e60\u4e86\u89e3\u4e86\u4e00\u4e0b Alluxio \u548c Hadoop Shell\u547d\u4ee4 \u4ee5\u53ca WebHDFS REST API \uff0c\u8fd8\u6709 Parquet \u6587\u4ef6\u7684\u67e5\u770b\u65b9\u6cd5\uff0c\u5728\u6b64\u7b80\u5355\u8bb0\u5f55\u4e00\u4e0b\uff0c\u65b9\u4fbf\u540e\u9762\u6709\u9700\u8981\u7684\u65f6\u5019\u53c2\u8003\u548c\u66f4\u65b0\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u6b63\u6587\uff1a<\/h4>\n\n\n\n<h5 class=\"wp-block-heading\">\u53c2\u8003\u89e3\u7b54\uff1a<\/h5>\n\n\n\n<p>HDFS\u7684\u5185\u90e8\u6570\u636e\u5b89\u5168\u98ce\u9669\u5f88\u591a\uff0c\u603b\u7684\u6765\u770b\uff0c\u5bf9\u4e8e\u5185\u90e8\u76d1\u63a7\u6765\u8bf4\uff0c\u4e00\u65b9\u9762\u662f\u5c06\u672c\u6765\u9650\u5236\u5728IDC\u5185\u90e8\u624d\u53ef\u8bbf\u95ee\u7684Hadoop\u76f8\u5173\u7cfb\u7edf\u901a\u8fc7WebHDFS\u7b49HTTP(S)\u5f62\u5f0f\u7684API\u5bf9\u529e\u516c\u7f51\u6216\u5916\u90e8\u8fdb\u884c\u4e86\u5f00\u653e\uff0c\u6269\u5927\u4e86\u653b\u51fb\u9762\uff0c\u8fd9\u4e2a\u9700\u8981\u4eceWeb\/API\u5c42\u9762\u53bb\u505a\u5206\u6790\u548c\u76d1\u63a7\u9884\u8b66\uff1b\u53e6\u4e00\u65b9\u9762\u662f\u5b89\u5168\u8ba4\u8bc1\/\u52a0\u5bc6\u7b49\u63aa\u65bd\u6267\u884c\u4e0d\u5230\u4f4d\uff0c\u5bfc\u81f4\u653b\u51fb\u8005\u53ea\u8981\u83b7\u53d6\u5230master\/namenode\u7b49\u5730\u5740\u4fe1\u606f\u5c31\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7alluxio\/hadoop\u7b49\u5ba2\u6237\u7aef\u76f4\u8fde\uff0c\u7136\u540e\u901a\u8fc7\u6587\u4ef6\u62f7\u8d1d\u7b49\u65b9\u5f0f\u83b7\u53d6parquet\u6587\u4ef6\u4ece\u800c\u62ff\u5230\u654f\u611f\u6570\u636e\u5b8c\u6210\u653b\u51fb\uff0c\u8fd9\u4e2a\u9700\u8981\u4ece\u4e3b\u673a\u5c42\u7684\u5f02\u5e38\u547d\u4ee4\u64cd\u4f5c\u5206\u6790\u6765\u76d1\u63a7\u9884\u8b66\u76f8\u5173\u98ce\u9669\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Alluxio \u90e8\u5206<\/h4>\n\n\n\n<p><strong>\u7b80\u5355\u6765\u8bf4\u5c31\u662f\uff0cAlluxio \u8ba9\u6211\u4eec\u53ef\u4ee5\u65b9\u4fbf\u7684\u5728\u4e00\u4e2a\u5730\u65b9\u540c\u65f6\u5feb\u901f\u8bbf\u95ee\u591a\u4e2a\u4e0d\u540c\u5b58\u50a8\u7cfb\u7edf\u4e2d\u7684\u6570\u636e\uff08\u4e3a\u5176\u4e0a\u5c42\u6570\u636e\u9a71\u52a8\u578b\u5e94\u7528\u63d0\u4f9b\u7edf\u4e00\u7684\u5ba2\u6237\u7aefAPI\u548c\u5168\u5c40\u547d\u540d\u7a7a\u95f4\uff09\u3002<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Alluxio \u662f\u4e16\u754c\u4e0a\u7b2c\u4e00\u4e2a\u9762\u5411\u57fa\u4e8e\u4e91\u7684\u6570\u636e\u5206\u6790\u548c\u4eba\u5de5\u667a\u80fd\u7684\u5f00\u6e90\u7684\u6570\u636e\u7f16\u6392\u6280\u672f\u3002<strong>\u5b83\u4e3a\u6570\u636e\u9a71\u52a8\u578b\u5e94\u7528\u548c\u5b58\u50a8\u7cfb\u7edf\u6784\u5efa\u4e86\u6865\u6881<\/strong>\uff0c\u5c06\u6570\u636e\u4ece\u5b58\u50a8\u5c42\u79fb\u52a8\u5230\u8ddd\u79bb\u6570\u636e\u9a71\u52a8\u578b\u5e94\u7528\u66f4\u8fd1\u7684\u4f4d\u7f6e\u4ece\u800c\u80fd\u591f\u66f4\u5bb9\u6613\u88ab\u8bbf\u95ee\u3002\u8fd9\u8fd8\u4f7f\u5f97\u5e94\u7528\u7a0b\u5e8f\u80fd\u591f\u901a\u8fc7\u4e00\u4e2a\u516c\u5171\u63a5\u53e3\u8fde\u63a5\u5230\u8bb8\u591a\u5b58\u50a8\u7cfb\u7edf\u3002Alluxio\u5185\u5b58\u81f3\u4e0a\u7684\u5c42\u6b21\u5316\u67b6\u6784\u4f7f\u5f97\u6570\u636e\u7684\u8bbf\u95ee\u901f\u5ea6\u80fd\u6bd4\u73b0\u6709\u65b9\u6848\u5feb\u51e0\u4e2a\u6570\u91cf\u7ea7\u3002<\/p>\n\n\n\n<p>\u5728\u5927\u6570\u636e\u751f\u6001\u7cfb\u7edf\u4e2d\uff0cAlluxio \u4f4d\u4e8e\u6570\u636e\u9a71\u52a8\u6846\u67b6\u6216\u5e94\u7528\uff08\u5982 Apache Spark\u3001Presto\u3001Tensorflow\u3001Apache Hive \u6216 Apache Flink\uff09\u548c\u5404\u79cd\u6301\u4e45\u5316\u5b58\u50a8\u7cfb\u7edf\uff08\u5982 Amazon S3\u3001Google Cloud Storage\u3001OpenStack Swift\u3001HDFS\u3001IBM Cleversafe\u3001EMC ECS\u3001Ceph\u3001NFS \u3001Minio\u548c Alibaba OSS\uff09\u4e4b\u95f4\u3002<strong>Alluxio \u7edf\u4e00\u4e86\u5b58\u50a8\u5728\u8fd9\u4e9b\u4e0d\u540c\u5b58\u50a8\u7cfb\u7edf\u4e2d\u7684\u6570\u636e\uff0c\u4e3a\u5176\u4e0a\u5c42\u6570\u636e\u9a71\u52a8\u578b\u5e94\u7528\u63d0\u4f9b\u7edf\u4e00\u7684\u5ba2\u6237\u7aef API \u548c\u5168\u5c40\u547d\u540d\u7a7a\u95f4\u3002<\/strong><\/p>\n\n\n\n<p><strong>\u5728\u5f53\u524d\u7684\u4e1a\u52a1\u7cfb\u7edf\u4e2d\u6211\u4eec\u4f1a\u9047\u5230\u591a\u79cd\u591a\u6837\u7684\u6570\u636e\u5b58\u50a8\u548c\u8bfb\u53d6\u573a\u666f<\/strong>\u3002\u5728\u5bf9\u4e8e\u5927\u91cf\u6570\u636e(G\u4ee5\u4e0a\u7ea7\u522b)\u7684\u5b58\u50a8\u548c\u8bfb\u53d6\u6211\u4eec\u5c31\u57fa\u672c\u4f1a\u91c7\u7528\u5206\u5e03\u5f0f\u6587\u4ef6\u7cfb\u7edf\u6bd4\u5982 Amazon S3\u3001Apache HDFS\u3002<strong>\u76ee\u524d\u4e3a\u4e86\u7cfb\u7edf\u7684\u53ef\u7528\u6027\u548c\u7a33\u5b9a\u6027\u8ba1\u7b97\u548c\u5b58\u50a8\u5f80\u5f80\u662f\u5206\u5f00\u90e8\u7f72\uff0c\u5728\u8fd9\u6837\u7684\u80cc\u666f\u4e0b\u5bf9\u4e8e\u5927\u6570\u636e\u7684\u8bfb\u5199\u6027\u80fd\u548c\u517c\u5bb9\u6027\u5c31\u4f1a\u6210\u4e3a\u5f88\u5927\u7684\u6311\u6218<\/strong>\u3002\u4e8e\u662f\u6211\u4eec\u770b\u5230\u4e86\u4e00\u79cd\u89e3\u51b3\u65b9\u6848 Alluxio\u3002<\/p>\n<\/blockquote>\n<\/blockquote>\n\n\n\n<h5 class=\"wp-block-heading\">Alluxio \u5feb\u901f\u4e0a\u624b<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>1. \u4e0b\u8f7d Alluxio\n\n\u4e0b\u8f7d\u5e76\u89e3\u538b\u5bf9\u5e94\u6587\u4ef6\uff0c\u9ed8\u8ba4\u4f1a\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u540d\u5b57\u7c7b\u4f3c alluxio-2.9.3 \u7684\u6587\u4ef6\u5939\uff0c\u8fd9\u91cc\u5c06\u8be5\u6587\u4ef6\u5939\u6240\u5728\u7684\u8def\u5f84\u5c06\u7b80\u8bb0\u4e3a ${ALLUXIO_HOME} \u3002\n\n2. \u914d\u7f6e Alluxio\n\n\u5728${ALLUXIO_HOME}\/conf\u76ee\u5f55\u4e0b\uff0c\u6839\u636e\u6a21\u677f\u6587\u4ef6\u521b\u5efa conf\/alluxio-env.sh \u914d\u7f6e\u6587\u4ef6\u3002\n$ cp conf\/alluxio-env.sh.template conf\/alluxio-env.sh\n\n\u5728 conf\/alluxio-env.sh \u6587\u4ef6\u4e2d\u4e3a JAVA_HOME \u589e\u52a0\u914d\u7f6e.\u4f8b\u5982:\n$ echo \"JAVA_HOME=\/path\/to\/java\/home\" &gt;&gt; conf\/alluxio-env.sh\n\n\u5728${ALLUXIO_HOME}\/conf\u76ee\u5f55\u4e0b\uff0c\u6839\u636e\u6a21\u677f\u6587\u4ef6\u521b\u5efaconf\/alluxio-site.properties\u914d\u7f6e\u6587\u4ef6\u3002\n$ cp conf\/alluxio-site.properties.template conf\/alluxio-site.properties\n\n\u5728 conf\/alluxio-site.properties \u6587\u4ef6\u4e2d\u5c06 alluxio.master.hostname \u8bbe\u7f6e\u4e3a localhost\uff08\u4e5f\u53ef\u6839\u636e\u5b9e\u9645\u9700\u8981\u6307\u5b9a\u4e3a\u5bf9\u5e94Alluxio\u7684master\u8282\u70b9\u7684host:port\u5730\u5740\uff09\u3002\n$ echo \"alluxio.master.hostname=localhost\" &gt;&gt; conf\/alluxio-site.properties\n\n3. \u4f7f\u7528 Alluxio Shell\n\n$ .\/bin\/alluxio fs\n$ .\/bin\/alluxio fs ls \/\n$ .\/bin\/alluxio fs copyFromLocal LICENSE \/LICENSE\n$ .\/bin\/alluxio fs cat \/LICENSE<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Alluxio \u63d0\u4f9b\u7684\u547d\u4ee4\u884c\u63a5\u53e3<\/h5>\n\n\n\n<p>Alluxio\u547d\u4ee4\u884c\u63a5\u53e3\u4e3a\u7528\u6237\u63d0\u4f9b\u4e86\u57fa\u672c\u7684\u6587\u4ef6\u7cfb\u7edf\u64cd\u4f5c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u5f97\u5230\u6240\u6709\u5b50\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ .\/bin\/alluxio fs<\/code><\/pre>\n\n\n\n<p>\u5bf9\u4e8e\u7528Alluxio URI\uff08\u5982ls\uff0c mkdir\uff09\u4f5c\u4e3a\u53c2\u6570\u7684fs\u5b50\u547d\u4ee4\u6765\u8bf4\uff0c\u53c2\u6570\u5e94\u8be5\u8981\u4e48\u662f\u5b8c\u6574\u7684Alluxio URI <code>alluxio:\/\/&lt;master-hostname&gt;:&lt;master-port&gt;\/&lt;path&gt;<\/code>\uff0c\u8981\u4e48\u662f\u7701\u7565\u4e86\u5934\u90e8\u4fe1\u606f\u7684<code>\/&lt;path&gt;<\/code>\uff0c\u4ee5\u4f7f\u7528<code>conf\/alluxio-site.properties<\/code>\u4e2d\u8bbe\u7f6e\u7684\u9ed8\u8ba4\u7684\u4e3b\u673a\u540d\u548c\u7aef\u53e3\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u5c06\"source path\"\u6307\u5b9a\u7684\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u6587\u4ef6\u62f7\u8d1d\u5230Alluxio\u4e2d\"remote path\"\u6307\u5b9a\u7684\u8def\u5f84 \u5982\u679c\"remote path\"\u5df2\u7ecf\u5b58\u5728\u8be5\u547d\u4ee4\u4f1a\u5931\u8d25\ncopyFromLocal \"source path\" \"remote path\"\n\n#\u5c06\"remote path\"\u6307\u5b9a\u7684Alluxio\u4e2d\u7684\u6587\u4ef6\u590d\u5236\u5230\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e2d\ncopyToLocal \"remote path\" \"local path\"<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Alluxio \u5e38\u89c1\u95ee\u9898<\/h5>\n\n\n\n<p>Q\uff1aAlluxio\u53ef\u4ee5\u8fd0\u884c\u5728\u54ea\u4e9b\u5e73\u53f0\u548cJava\u7248\u672c\u4e0a?<br>A\uff1aAlluxio\u53ef\u4ee5\u5728Linux \/ Mac\u7684\u5404\u79cd\u53d1\u884c\u7248\u4e0a\u4f7f\u7528Java 1.8\u6216\u66f4\u9ad8\u7248\u672c\u8fd0\u884c\u3002<\/p>\n\n\n\n<p>Q\uff1a\u662f\u5426\u6709\u7b80\u5355\u7684\u65b9\u6cd5\u6765\u67e5\u770b\u7fa4\u96c6\u7684\u72b6\u6001\u548c\u8fd0\u884c\u72b6\u51b5\uff1f<br>A\uff1a\u662f\u7684\uff0c\u4e00\u65e6\u5b89\u88c5\u597dAlluxio\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95ee http:\/\/master_ip:19999 \u7684UI\u754c\u9762\u6765\u67e5\u770b\u3002<\/p>\n\n\n\n<p>Q\uff1a\u4ec0\u4e48\u662f\u5e95\u5c42\u5b58\u50a8\u7cfb\u7edf\uff1fAlluxio\u652f\u6301\u591a\u5c11\u79cd\u5e95\u5c42\u5b58\u50a8\u7cfb\u7edf\uff1f<br>A\uff1aAlluxio \u4f7f\u7528\u5e95\u5c42\u5b58\u50a8\u7cfb\u7edf\u4f5c\u4e3a\u5176\u6301\u4e45\u5316\u5b58\u50a8\u7cfb\u7edf\uff0c\u5f53\u524d\u652f\u6301 Amazon S3, Swift, GCS, HDFS\u4ee5\u53ca\u5f88\u591a\u5176\u4ed6\u5b58\u50a8\u7cfb\u7edf\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Parquet \u6587\u4ef6<\/h4>\n\n\n\n<p>\u6570\u636e\u7684\u63a5\u5165\u3001\u5904\u7406\u3001\u5b58\u50a8\u4e0e\u67e5\u8be2\uff0c\u662f\u5927\u6570\u636e\u7cfb\u7edf\u4e0d\u53ef\u6216\u7f3a\u7684\u56db\u4e2a\u73af\u8282\u3002\u968f\u7740\u6570\u636e\u91cf\u7684\u589e\u52a0\uff0c\u5927\u5bb6\u5f00\u59cb\u5bfb\u627e\u4e00\u79cd\u9ad8\u6548\u7684\u6570\u636e\u683c\u5f0f\uff0c\u6765\u89e3\u51b3\u5b58\u50a8\u4e0e\u67e5\u8be2\u73af\u8282\u7684\u75db\u70b9\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u9ad8\u6548\u7684\u538b\u7f29\u7f16\u7801\uff0c\u7528\u4e8e\u964d\u4f4e\u5b58\u50a8\u6210\u672c<\/li>\n\n\n\n<li>\u9ad8\u6548\u7684\u8bfb\u53d6\u80fd\u529b\uff0c\u7528\u4e8e\u652f\u6491\u5feb\u901f\u67e5\u8be2<\/li>\n<\/ul>\n\n\n\n<p>Parquet\u4fbf\u662f\u5728\u8fd9\u6837\u7684\u80cc\u666f\u4e0b\u8bde\u751f\uff0c\u4e0etext\u3001json\u3001csv\u7b49\u6587\u4ef6\u683c\u5f0f\u76f8\u6bd4\uff0c\u5b83\u6709\u4e09\u4e2a\u6838\u5fc3\u7279\u5f81\uff0c\u4e3a\u89e3\u51b3\u4e0a\u8ff0\u7684\u75db\u70b9\u95ee\u9898\u63d0\u4f9b\u4e86\u57fa\u7840\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5217\u5f0f\u5b58\u50a8<\/li>\n\n\n\n<li>\u81ea\u5e26Schema<\/li>\n\n\n\n<li>\u5177\u5907Predicate Filter\u7279\u6027<\/li>\n<\/ul>\n\n\n\n<p>\u5728\u884c\u5f0f\u5b58\u50a8\u4e2d\uff0c\u4e00\u884c\u7684\u591a\u5217\u662f\u8fde\u7eed\u7684\u5199\u5728\u4e00\u8d77\u7684\uff0c\u800c\u5728\u5217\u5f0f\u5b58\u50a8\u4e2d\uff0c\u6570\u636e\u6309\u5217\u5206\u5f00\u5b58\u50a8\u3002\u7531\u4e8e\u540c\u4e00\u5217\u7684\u6570\u636e\u7c7b\u578b\u662f\u4e00\u6837\u7684\uff0c\u53ef\u4ee5\u4f7f\u7528\u66f4\u9ad8\u6548\u7684\u538b\u7f29\u7f16\u7801\u8fdb\u4e00\u6b65\u8282\u7ea6\u5b58\u50a8\u7a7a\u95f4\u3002<\/p>\n\n\n\n<p>\u5f53\u524d\u5982\u679c\u4f60\u60f3\u67e5\u770bParquet\u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u6709\u51e0\u79cd\u9009\u62e9\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u4f7f\u7528Apache Arrow\uff1aApache Arrow\u662f\u4e00\u79cd\u5f00\u6e90\u7684\u5185\u5b58\u6570\u636e\u7ed3\u6784\uff0c\u53ef\u4ee5\u7528\u4e8e\u5b58\u50a8\u548c\u4ea4\u6362\u5927\u578b\u7ed3\u6784\u5316\u6570\u636e\u96c6\uff0c\u5305\u62ecParquet\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528Apache Arrow\u7684Python\u5e93\uff0cpandas-arrow\uff0c\u5c06Parquet\u6587\u4ef6\u52a0\u8f7d\u5230pandas DataFrame\u4e2d\uff0c\u7136\u540e\u67e5\u770bDataFrame\u7684\u5185\u5bb9\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528parquet-tools\uff1aparquet-tools\u662f\u4e00\u79cd\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u4e8e\u67e5\u770bParquet\u6587\u4ef6\u7684\uff08inspect\uff09\u5143\u6570\u636e\u548c\uff08show\uff09\u5185\u5bb9\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528Spark\uff1aApache Spark\u662f\u4e00\u4e2a\u6d41\u884c\u7684\u5927\u6570\u636e\u5904\u7406\u5f15\u64ce\uff0c\u5b83\u652f\u6301\u8bfb\u53d6Parquet\u6587\u4ef6\u5e76\u5c06\u5176\u8f6c\u6362\u4e3aSpark DataFrame\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528Spark SQL\u67e5\u8be2\u6570\u636e\uff0c\u6216\u8005\u4f7f\u7528Spark\u7684\u5176\u4ed6\u529f\u80fd\u6765\u5904\u7406\u6570\u636e\u3002<\/li>\n<\/ol>\n\n\n\n<h5 class=\"wp-block-heading\">\u7528 parquet-tools \u6765\u67e5\u770b Parquet \u6587\u4ef6\u7684\u5185\u5bb9<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pip3 install parquet-tools\n\n$ parquet-tools --help\n$ parquet-tools inspect test.parquet #\u67e5\u770b\u8868\u7ed3\u6784\n$ parquet-tools show -n 10 test.parquet #\u67e5\u770b\u524d10\u884c\u5185\u5bb9\n$ parquet-tools show -n 10 -c col1,col2 test.parquet #\u67e5\u770b\u524d10\u884c\u5185\u5bb9\uff0c\u4e14\u53ea\u663e\u793a\u7279\u5b9a\u7684\u5217\n\n$ ~\/Library\/Python\/3.9\/bin\/parquet-tools #\u6211\u7684macOS\u4e0a\u7528pip3\u5b89\u88c5parquet-tools\u6240\u5728\u7684\u4f4d\u7f6e\uff0c\u5e76\u4e0d\u5728\u9ed8\u8ba4\u7684PATH\u8def\u5f84\u4e0b<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">WebHDFS<\/h4>\n\n\n\n<p>WebHDFS \u662fHDFS\u63d0\u4f9b\u7684HTTP RESTFul API\u63a5\u53e3\uff0c\u5e76\u4e14\u5b83\u662f\u72ec\u7acb\u4e8eHadoop\u7684\u7248\u672c\u7684\uff0c\u5b83\u652f\u6301HDFS\u7684\u5b8c\u6574FileSystem\/FileContext\u63a5\u53e3\u3002<strong>\u5b83\u53ef\u4ee5\u8ba9\u5ba2\u6237\u7aef\u901a\u8fc7\u53d1\u9001HTTP\u8bf7\u6c42\u7684\u65b9\u5f0f\u6765\u64cd\u4f5cHDFS\uff0c\u800c\u65e0\u9700\u5b89\u88c5Hadoop\uff08\u4ee5\u53caJava\u7b49\u73af\u5883\uff09<\/strong>\u3002<br>\u6211\u4eec\u7ecf\u5e38\u4f7f\u7528\u7684HDFS Web UI\uff0c\u5b83\u5c31\u662f\u57fa\u4e8e WebHDFS \u6765\u64cd\u4f5cHDFS\u7684\u3002<\/p>\n\n\n\n<p><strong>WebHDFS \u548c HttpFS \u4e24\u8005\u90fd\u662f\u57fa\u4e8eREST\u7684HDFS API\uff0c\u4f7f\u5f97\u4e00\u4e2a\u96c6\u7fa4\u5916\u7684host\u53ef\u4ee5\u4e0d\u7528\u5b89\u88c5Hadoop\u548cJava\u73af\u5883\u5c31\u53ef\u4ee5\u5bf9\u96c6\u7fa4\u5185\u7684Hadoop\u8fdb\u884c\u8bbf\u95ee\uff0c\u5e76\u4e14client\u4e0d\u53d7\u8bed\u8a00\u7684\u9650\u5236\u3002<\/strong><\/p>\n\n\n\n<p>WebHDFS \u662f HortonWorks \u5f00\u53d1\u7684\uff0c\u7136\u540e\u6350\u7ed9\u4e86Apache\uff1b\u800c HttpFS \u662f Cloudera \u5f00\u53d1\u7684\uff0c\u4e5f\u6350\u7ed9\u4e86Apache\u3002<\/p>\n\n\n\n<p>WebHDFS \u4e0d\u652f\u6301\u9ad8\u53ef\u7528NameNode\u67b6\u6784\uff0c\u4f46 HttpFS \u652f\u6301\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Get Content Summary of a Directory\ncurl -i \"http:\/\/&lt;HOST&gt;:&lt;PORT&gt;\/webhdfs\/v1\/&lt;PATH&gt;?op=GETCONTENTSUMMARY\"\n\n# Status of a File\/Directory\ncurl -i  \"http:\/\/&lt;HOST&gt;:&lt;PORT&gt;\/webhdfs\/v1\/&lt;PATH&gt;?op=GETFILESTATUS\"\n\n# List a Directory\ncurl -i \"http:\/\/&lt;HOST&gt;:&lt;PORT&gt;\/webhdfs\/v1\/&lt;PATH&gt;?op=LISTSTATUS\"\n\n# Open and Read a File\ncurl -i -L \"http:\/\/&lt;HOST&gt;:&lt;PORT&gt;\/webhdfs\/v1\/&lt;PATH&gt;?op=OPEN\n                    &#91;&amp;offset=&lt;LONG&gt;]&#91;&amp;length=&lt;LONG&gt;]&#91;&amp;buffersize=&lt;INT&gt;]\"<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Hadoop Shell\u547d\u4ee4<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>FS Shell\n\u8c03\u7528\u6587\u4ef6\u7cfb\u7edf(FS)Shell\u547d\u4ee4\u5e94\u4f7f\u7528 bin\/hadoop fs &lt;args&gt;\u7684\u5f62\u5f0f\u3002**\u6240\u6709\u7684\u7684FS shell\u547d\u4ee4\u4f7f\u7528URI\u8def\u5f84\u4f5c\u4e3a\u53c2\u6570\u3002**URI\u683c\u5f0f\u662fscheme:\/\/authority\/path\u3002\u5bf9HDFS\u6587\u4ef6\u7cfb\u7edf\uff0cscheme\u662fhdfs\uff0c\u5bf9\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\uff0cscheme\u662ffile\u3002\u5176\u4e2dscheme\u548cauthority\u53c2\u6570\u90fd\u662f\u53ef\u9009\u7684\uff0c\u5982\u679c\u672a\u52a0\u6307\u5b9a\uff0c\u5c31\u4f1a\u4f7f\u7528\u914d\u7f6e\u4e2d\u6307\u5b9a\u7684\u9ed8\u8ba4scheme\u3002\u4e00\u4e2aHDFS\u6587\u4ef6\u6216\u76ee\u5f55\u6bd4\u5982\/parent\/child\u53ef\u4ee5\u8868\u793a\u6210hdfs:\/\/namenode:namenodeport\/parent\/child\uff0c\u6216\u8005\u66f4\u7b80\u5355\u7684\/parent\/child\uff08\u5047\u8bbe\u4f60\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u9ed8\u8ba4\u503c\u662fnamenode:namenodeport\uff09\u3002**\u5927\u591a\u6570FS Shell\u547d\u4ee4\u7684\u884c\u4e3a\u548c\u5bf9\u5e94\u7684Unix Shell\u547d\u4ee4\u7c7b\u4f3c\uff0c\u4e0d\u540c\u4e4b\u5904\u4f1a\u5728\u4e0b\u9762\u4ecb\u7ecd\u5404\u547d\u4ee4\u4f7f\u7528\u8be6\u60c5\u65f6\u6307\u51fa\u3002\u51fa\u9519\u4fe1\u606f\u4f1a\u8f93\u51fa\u5230stderr\uff0c\u5176\u4ed6\u4fe1\u606f\u8f93\u51fa\u5230stdout\u3002**\n\ncat #\u5c06\u8def\u5f84\u6307\u5b9a\u6587\u4ef6\u7684\u5185\u5bb9\u8f93\u51fa\u5230stdout\u3002\n\n\u4f7f\u7528\u65b9\u6cd5\uff1ahadoop fs -cat URI &#91;URI \u2026]\n\n\u793a\u4f8b\uff1a\nhadoop fs -cat hdfs:\/\/host1:port1\/file1 hdfs:\/\/host2:port2\/file2\nhadoop fs -cat file:\/\/\/file3 \/user\/hadoop\/file4\n\n\u8fd4\u56de\u503c\uff1a\n\u6210\u529f\u8fd4\u56de0\uff0c\u5931\u8d25\u8fd4\u56de-1\u3002\n==\n\nhadoop fs -copyToLocal &#91;-ignorecrc] &#91;-crc] URI &lt;localdst&gt;\nhadoop fs -get \/user\/hadoop\/file localfile\nhadoop fs -get hdfs:\/\/host:port\/user\/hadoop\/file localfile\n\nhadoop fs -copyFromLocal &lt;localsrc&gt; URI\nhadoop fs -put localfile \/user\/hadoop\/hadoopfile\nhadoop fs -put localfile1 localfile2 \/user\/hadoop\/hadoopdir\nhadoop fs -put localfile hdfs:\/\/host:port\/hadoop\/hadoopfile\n\u2026\u2026<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">\u53c2\u8003\u94fe\u63a5\uff1a<\/h5>\n\n\n\n<p>\u4ec0\u4e48\u662f Alluxio<br><a href=\"https:\/\/docs.alluxio.io\/os\/user\/stable\/cn\/Overview.html\">https:\/\/docs.alluxio.io\/os\/user\/stable\/cn\/Overview.html<\/a><\/p>\n\n\n\n<p>Alluxio \u5feb\u901f\u4e0a\u624b\u6307\u5357<br><a href=\"https:\/\/docs.alluxio.io\/os\/user\/stable\/cn\/overview\/Getting-Started.html\">https:\/\/docs.alluxio.io\/os\/user\/stable\/cn\/overview\/Getting-Started.html<\/a><br><a href=\"https:\/\/downloads.alluxio.io\/downloads\/files\/2.9.3\/alluxio-2.9.3-bin.tar.gz\">https:\/\/downloads.alluxio.io\/downloads\/files\/2.9.3\/alluxio-2.9.3-bin.tar.gz<\/a><\/p>\n\n\n\n<p>Alluxio \u5e38\u89c1\u95ee\u9898<br><a href=\"https:\/\/docs.alluxio.io\/os\/user\/stable\/cn\/overview\/FAQ.html\">https:\/\/docs.alluxio.io\/os\/user\/stable\/cn\/overview\/FAQ.html<\/a><\/p>\n\n\n\n<p>Alluxio\u547d\u4ee4\u884c\u63a5\u53e3\u4e3a\u7528\u6237\u63d0\u4f9b\u4e86\u57fa\u672c\u7684\u6587\u4ef6\u7cfb\u7edf\u64cd\u4f5c<br><a href=\"https:\/\/docs.alluxio.io\/os\/user\/stable\/cn\/operation\/User-CLI.html\">https:\/\/docs.alluxio.io\/os\/user\/stable\/cn\/operation\/User-CLI.html<\/a><\/p>\n\n\n\n<p>Hadoop Shell\u547d\u4ee4<br><a href=\"https:\/\/hadoop.apache.org\/docs\/r1.0.4\/cn\/hdfs_shell.html\">https:\/\/hadoop.apache.org\/docs\/r1.0.4\/cn\/hdfs_shell.html<\/a><\/p>\n\n\n\n<p>WebHDFS REST API<br><a href=\"https:\/\/hadoop.apache.org\/docs\/r1.0.4\/webhdfs.html#Operations\">https:\/\/hadoop.apache.org\/docs\/r1.0.4\/webhdfs.html#Operations<\/a><\/p>\n\n\n\n<p>PyORC is a Python module for reading and writing Apache ORC file format. It uses the Apache ORC\u2019s Core C++ API under the hood, and provides a similar interface as the csv module in the Python standard library.<br><a href=\"https:\/\/pyorc.readthedocs.io\/en\/stable\/index.html\">https:\/\/pyorc.readthedocs.io\/en\/stable\/index.html<\/a><\/p>\n\n\n\n<p>the smallest, fastest columnar storage for Hadoop workloads.<br><a href=\"https:\/\/orc.apache.org\/\">https:\/\/orc.apache.org\/<\/a><\/p>\n\n\n\n<p>Apache Parquet is an open source, column-oriented data file format designed for efficient data storage and retrieval. It provides efficient data compression and encoding schemes with enhanced performance to handle complex data in bulk. Parquet is available in multiple languages including Java, C++, Python, etc\u2026<br><a href=\"https:\/\/parquet.apache.org\/docs\/\">https:\/\/parquet.apache.org\/docs\/<\/a><\/p>\n\n\n\n<p>parquet-tools<br><a href=\"https:\/\/pypi.org\/project\/parquet-tools\/\">https:\/\/pypi.org\/project\/parquet-tools\/<\/a><\/p>\n\n\n\n<p>Parquet\u7684\u90a3\u4e9b\u4e8b\uff08\u4e00\uff09\u57fa\u672c\u539f\u7406<br><a href=\"https:\/\/zhuanlan.zhihu.com\/p\/111822325\">https:\/\/zhuanlan.zhihu.com\/p\/111822325<\/a><\/p>\n\n\n\n<p>Parquet\u6587\u4ef6\u67e5\u770b\u5de5\u5177<br><a href=\"https:\/\/juejin.cn\/s\/Parquet%E6%96%87%E4%BB%B6%E6%9F%A5%E7%9C%8B%E5%B7%A5%E5%85%B7\">https:\/\/juejin.cn\/s\/Parquet%E6%96%87%E4%BB%B6%E6%9F%A5%E7%9C%8B%E5%B7%A5%E5%85%B7<\/a><\/p>\n\n\n\n<p>hdfs\u4e4bWebHDFS\u548cHttpFS\u4ecb\u7ecd<br><a href=\"https:\/\/blog.csdn.net\/breakout_alex\/article\/details\/102384683\">https:\/\/blog.csdn.net\/breakout_alex\/article\/details\/102384683<\/a><\/p>\n\n\n\n<p>HDFS restful API\uff1a\u5173\u4e8eWebHDFS\u4e0eHttpFS\u7684\u533a\u522b<br><a href=\"https:\/\/blog.51cto.com\/zhangxueliang\/4942683\">https:\/\/blog.51cto.com\/zhangxueliang\/4942683<\/a><\/p>\n\n\n\n<p>[hadoop3.x\u7cfb\u5217]HDFS REST HTTP API\u7684\u4f7f\u7528(\u4e00)WebHDFS<br><a href=\"https:\/\/cloud.tencent.com\/developer\/article\/1912486\">https:\/\/cloud.tencent.com\/developer\/article\/1912486<\/a><\/p>\n\n\n\n<p>\u4f7f\u7528Hadoop WebHDFS\u8bbf\u95eeHDFS<br><a href=\"https:\/\/www.cnblogs.com\/yinzhengjie2020\/p\/13352498.html\">https:\/\/www.cnblogs.com\/yinzhengjie2020\/p\/13352498.html<\/a><\/p>\n\n\n\n<p>=END=<\/p>\n","protected":false},"excerpt":{"rendered":"<p>=Start= \u7f18\u7531\uff1a \u6700\u8fd1\u5728\u770b\u548c HDFS \u76f8\u5173\u7684\u6570\u636e\u5b89\u5168\u95ee\u9898\uff0c\u4e86\u89e3\u5230\u4e86\u4e00\u4e9b\u4e4b\u524d\u4e0d\u77e5\u9053\u98ce\u9669\uff0c\u5728\u6b64\u8fc7\u7a0b\u4e2d\u4e3a\u4e86\u9a8c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,23,25],"tags":[2013,1255,933,2011,2014,2015,2012,963],"class_list":["post-5506","post","type-post","status-publish","format-standard","hentry","category-database","category-knowledgebase-2","category-security","tag-alluxio","tag-datasecurity","tag-hadoop","tag-hdfs","tag-parquet","tag-parquet-tools","tag-webhdfs","tag-963"],"views":1848,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/5506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=5506"}],"version-history":[{"count":1,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/5506\/revisions"}],"predecessor-version":[{"id":5507,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/5506\/revisions\/5507"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=5506"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=5506"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=5506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}