{"id":2806,"date":"2020-09-02T17:44:56","date_gmt":"2020-09-02T09:44:56","guid":{"rendered":"https:\/\/nj.transwarp.cn:8180\/?p=2806"},"modified":"2020-09-02T17:44:55","modified_gmt":"2020-09-02T09:44:55","slug":"inceptor-%e6%95%b0%e6%8d%ae%e5%af%bc%e5%85%a5%e5%af%bc%e5%87%ba%e4%b9%8bsqoop","status":"publish","type":"post","link":"https:\/\/kbwp.transwarp.cn\/?p=2806","title":{"rendered":"Inceptor \u6570\u636e\u5bfc\u5165\u5bfc\u51fa\u4e4bsqoop"},"content":{"rendered":"<h3>\u6982\u8981\u8bf4\u660e<\/h3>\n<hr \/>\n<p>\u9762\u5bf9\u4e00\u4e9b\u91cd\u8981\u6570\u636e\uff0c\u5f88\u591a\u573a\u666f\u4e0b\u90fd\u9700\u8981\u5c06\u6570\u636e\u4ed3\u5e93\u8fdb\u884c\u590d\u5236\uff0c\u8fd9\u53ef\u4ee5\u662f\u6574\u4e2a\u6570\u636e\u5e93\u7684\u66f4\u5e7f\u6cdb\u7ea7\u522b\uff0c\u4e5f\u53ef\u4ee5\u662f\u8f83\u5c0f\u7684\u7ea7\u522b\uff0c\u4f8b\u5982\u8868\u6216\u5206\u533a\u3002\u672c\u6848\u4f8b\u5c06\u6f14\u793aExport\/Import \u7684\u65b9\u5f0f\u5bfc\u5165\u5bfc\u51fa Inceptor \u6570\u636e\u3002<\/p>\n<blockquote>\n<p><strong>\u8be5\u65b9\u6cd5\u53ea\u9002\u7528\u4e8eORC\u666e\u901a\u8868\u7684\u5bfc\u5165\u5bfc\u51fa\u3002ORC \u5206\u533a\u8868\u4e0d\u652f\u6301\uff0cORC\u4e8b\u52a1\u8868\u4e0d\u652f\u6301\u3002<\/strong><\/p>\n<\/blockquote>\n<h3>\u8be6\u7ec6\u8bf4\u660e<\/h3>\n<hr \/>\n<p>Inceptor \u6570\u636e\u5bfc\u5165\u5bfc\u51fa\u65b9\u6cd5\u5927\u81f4\u5206\u4e3a\u4ee5\u4e0b\u51e0\u79cd\uff1a<\/p>\n<ol>\n<li>Export\/Import<\/li>\n<li>Insert Overwrite Dirctory\uff0c\u7136\u540e\u5efa\u5916\u8868\u7684\u65b9\u5f0f<\/li>\n<li>HDFS \u7684 get\u3001put\uff0c\u4ee5\u53caInceptor \u7684 Load \u6216\u8005 Location<\/li>\n<li>\u4f7f\u7528sqoop \u5c06 Inceptor \u6570\u636e\u5411mysql \u8fc1\u79fb\u6570\u636e<\/li>\n<\/ol>\n<p>\u672c\u6848\u4f8b\u4ecb\u7ecd\u4f7f\u7528 Export\/Import \u7684\u65b9\u5f0f\u5bfc\u5165\u5bfc\u51fa Inceptor \u6570\u636e\uff0c\u8be5\u65b9\u6cd5\u53ea\u9700\u89813\u6b65\uff1a<\/p>\n<ol>\n<li>\u5728 mysql \u4e0a\u521b\u5efa\u540c\u6784\u7684\u8868<\/li>\n<li>\u5728TDH \u96c6\u7fa4\u4e0a\u8fd0\u884c sqoop \u547d\u4ee4\uff0c\u5c06\u6570\u636e\u5bfc\u5165\uff1b<\/li>\n<\/ol>\n<h4>1\u3001\u5728mysql\u4e0a\u5efa\u8868<\/h4>\n<pre><code>EXPORT TABLE crmdev.orc_unpart_export TO '\/crmdev\/orc_unpart_export\/';<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\u6709\u4e2a_metadata\uff0cjson \u683c\u5f0f\u7684\uff0c\u4fdd\u5b58\u4e86\u8868\u7684\u5143\u6570\u636e\u4fe1\u606f\uff1a<\/p>\n<pre><code>$ ll orc_unpart_export\/\n\u603b\u7528\u91cf 8\ndrwxr-xr-x 2 root root 4096 4\u6708   7 16:12 data\n-rw-r--r-- 1 root root 3086 4\u6708   7 16:12 _metadata<\/code><\/pre>\n<h4>2\u3001\u5728TDH \u96c6\u7fa4\u4e0a\u6267\u884csqoop \u5bfc\u51fa<\/h4>\n<p>\u547d\u4ee4\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<pre><code>$ sqoop export --connect jdbc:mysql:\/\/172.22.22.23:3306\/eastmoney?useSSL=false --username root --password 123456 --table main_rank --export-dir \/inceptor1\/user\/hive\/warehouse\/source.db\/tableau\/orc_unpart_sql\/<\/code><\/pre>\n<h4>3\u3001\u5728\u76ee\u6807\u96c6\u7fa4\u4e0a Import \u5230Inceptor \u8868<\/h4>\n<p>\u5728\u76ee\u6807\u96c6\u7fa4\uff0c\u6267\u884c Import \uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0cimport \u8bed\u53e5\u53ea\u80fd\u5199\u5230\u5f53\u524d\u6570\u636e\u5e93\u7684\u8868\u4e2d\uff0c\u4e0d\u652f\u6301database_name.table_name\uff1b<\/p>\n<pre><code>USE crmdev;\nIMPORT TABLE orc_unpart_export FROM '\/crmdev\/orc_unpart_export\/';<\/code><\/pre>\n<p>IMPORT\u5982\u679c\u76ee\u6807\u8868\u662f\u4e2a\u975e\u5206\u533a\u666e\u901aORC\u8868\uff0c\u5b83\u5c06\u521b\u5efa\u76ee\u6807\u8868\u3002\u6240\u6709\u7684\u8868\u5c5e\u6027\/\u53c2\u6570\u90fd\u662fEXPORT\u5bfc\u51fa\u65f6\u751f\u6210\u7684\u5b58\u6863\u3002\u6d4b\u8bd5\u662f\u53ef\u884c\u7684\u3002\u540c\u7248\u672c\u8de8\u96c6\u7fa4\u662f\u53ef\u4ee5\u7684\uff0c5.2.2\u96c6\u7fa4\u54115.2.3\u53ef\u884c\uff0c\u4f46\u662f\u54116.2.0\u7248\u672cImport\u662f\u4e0d\u652f\u6301\u7684\u3002<\/p>\n<p>\u4f46\u662f\u5206\u533a\u8868\u7684\u5bfc\u5165\u4f1a\u51fa\u73b0\u8bc6\u522b\u9519\u8bef\u7684\u60c5\u51b5\uff0c\u62a5\u9519\u5982\u4e0b\uff1a<\/p>\n<pre><code>2020-04-07 16:38:39,334 ERROR inceptor.InceptorDriver: (Logging.scala:logError(75)) [HiveServer2-Handler-Pool: Thread-300(SessionHandle=9d8e86f5-f7a6-4dff-a365-97791785a14f)] - COMPILE FAILED: Semantic error: [Error 40000] Exception while processing: Error in serializing metadata\norg.apache.hadoop.hive.ql.parse.SemanticException: Exception while processing: Error in serializing metadata\n        at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)\n        at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)\n        at org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56)\n        at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:285)\n        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n        at java.lang.Thread.run(Thread.java:748)\nCaused by: org.json.JSONException: JSONObject[\"partitions\"] not a string.\n        at org.json.JSONObject.getString(JSONObject.java:722)\n        at org.apache.hadoop.hive.ql.parse.EximUtil.readMetaData(EximUtil.java:222)\n        ... 24 more<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981\u8bf4\u660e \u9762\u5bf9\u4e00\u4e9b\u91cd\u8981\u6570\u636e\uff0c\u5f88\u591a\u573a\u666f\u4e0b\u90fd\u9700\u8981\u5c06\u6570\u636e\u4ed3\u5e93\u8fdb\u884c\u590d\u5236\uff0c\u8fd9\u53ef\u4ee5\u662f\u6574\u4e2a\u6570\u636e\u5e93\u7684\u66f4\u5e7f\u6cdb\u7ea7\u522b\uff0c\u4e5f\u53ef\u4ee5\u662f\u8f83\u5c0f\u7684 ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/kbwp.transwarp.cn\/?p=2806\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2806","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"acf":[],"_links":{"self":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/2806","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2806"}],"version-history":[{"count":1,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/2806\/revisions"}],"predecessor-version":[{"id":4687,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/2806\/revisions\/4687"}],"wp:attachment":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2806"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2806"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}