Hive建立表格報【Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException】引發的血案

來源:互聯網
上載者:User

標籤:lob   成功   javase   ogg   engine   ble   error   not   main   

在成功啟動Hive之後感慨這次終於沒有出現Bug了,滿懷信心地打了長長的建立表格的命令,結果現實再一次給了我一棒,報了以下的錯誤Error, return code 1 from org.apache.Hadoop.hive.ql.exec.DDLTask. MetaException,看了一下錯誤之後,先是楞了一下,接著我就發出感慨,自從踏上編程這條不歸路之後,就沒有一天不是在找Bug的路上就是在處理Bug,給自己貼了個標籤:找Bug就跟吃飯一樣的男人。抒發心中的感慨之後,該幹活還是的幹活。

第一步:查看設定檔 確保沒有出錯

第二步:上網找找同是天涯落人,看看有哪位哥們也跟我一樣出現了這個問題,找來找去,就找到一個更換MySQL-connector-Java jar包的解決方案,怎麼看都不像能解決問題,抱著死馬當活馬醫的心態,還是試了一下,果然不出意料,沒有解決問題,PASS!

第三步:運行 hive -hiveconf hive.root.logger=DEBUG,console列印hive啟動過程的log。不打不知道,一打嚇一跳,看到下面血淋淋的報錯資訊,心涼了半截,血案啊!!!由於太長我就截了一小部分出來

[main]: ERROR DataNucleus.Datastore: Error thrown executing CREATE TABLE `SERDE_PARAMS`(    `SERDE_ID` BIGINT NOT NULL,    `PARAM_KEY` VARCHAR(256) BINARY NOT NULL,    `PARAM_VALUE` VARCHAR(4000) BINARY NULL,    CONSTRAINT `SERDE_PARAMS_PK` PRIMARY KEY (`SERDE_ID`,`PARAM_KEY`)) ENGINE=INNODB : Specified key was too long; max key length is 767 bytescom.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)    ...    at org.apache.hadoop.util.RunJar.main(RunJar.java:212)main]: ERROR Datastore.Schema: An exception was thrown while adding/validating class(es) : Specified key was too long; max key length is 767 bytescom.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)    ...    at java.lang.reflect.Method.invoke(Method.java:606)    at org.apache.hadoop.util.RunJar.main(RunJar.java:212)[main]: DEBUG metastore.HiveMetaStore: admin role already existsInvalidObjectException(message:Role admin already exists.)    at org.apache.hadoop.hive.metastore.ObjectStore.addRole(ObjectStore.java:3187)    ...    at java.lang.reflect.Method.invoke(Method.java:606)[main]: DEBUG metastore.HiveMetaStore: Failed while granting global privs to adminInvalidObjectException(message:All is already granted by admin)    at org.apache.hadoop.hive.metastore.ObjectStore.grantPrivileges(ObjectStore.java:3912)    ...    at org.apache.hadoop.util.RunJar.main(RunJar.java:212)

 

第四步:繼續搜尋解決方案,然後找到了可能是字元集的原因,可以通過在mysql中將資料庫的字元集改為latin1,執行以下命令: alter database hive character set latin1;

第五步:重啟hive,繼續看log,除了第一個exception消失了之外,其他依然存在,有些疑惑,認真看了一下,發現metastore.HiveMetaStore: admin role already exists,會不會是之前hive啟動出錯時留下的問題,那麼把mysql中的hive資料刪掉重新建立一個看看。

第六步:在mysql中執行以下命令: 
  drop database hive; 
  create database hive; 
  alter database hive character set latin1;

第七步:重啟hive,查看log,問題解決了!!!

Hive建立表格報【Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException】引發的血案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.