自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Hive問題集

企業(yè)動態(tài)
今天講一講關(guān)于Hive的問題、原因以及解決方法。

 1、FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org

問題:

起因是我重裝了mysql數(shù)據(jù)庫。

安裝之后 把訪問權(quán)限都配置好 :

  1. GRANT ALL PRIVILEGES ON*.* TO 'hive'@'%' Identified by 'hive';  
  2. GRANT ALL PRIVILEGES ON*.* TO 'hive'@'localhost' Identified by 'hive';  
  3. GRANT ALL PRIVILEGES ON*.* TO 'hive'@'127.0.0.1' Identified by 'hive' 

本機(jī)地址: 192.168.103.43 機(jī)器名字:192-168-103-43 

  1. flush privileges

啟動hive 發(fā)生下面的錯(cuò)誤:

  1. hive> show tables;FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient 
  2. FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTaskFAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClientFAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask  
  1. cd ${HIVE_HOME}/bin 
  2. ./hive -hiveconf hive.root.logger=DEBUG,console 
  3. hive> show tables;  

得到如下的錯(cuò)誤信息(當(dāng)然 不同的問題所產(chǎn)生的日志是不同的):

  1. Caused by: javax.jdo.JDOFatalDataStoreException: Access denied for user 'hive'@'192-168-103-43' (using password: YES) 
  2. NestedThrowables: 
  3. java.sql.SQLException: Access denied for user 'hive'@'192-168-103-43' (using password: YES) 
  4.     at org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:298) 
  5.     at org.datanucleus.jdo.JDOPersistenceManagerFactory.freezeConfiguration(JDOPersistenceManagerFactory.java:601) 
  6.     at org.datanucleus.jdo.JDOPersistenceManagerFactory.createPersistenceManagerFactory(JDOPersistenceManagerFactory.java:286) 
  7.     at org.datanucleus.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:182) 
  8.     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
  9.     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
  10.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
  11.     at java.lang.reflect.Method.invoke(Method.java:597) 
  12.     at javax.jdo.JDOHelper$16.run(JDOHelper.java:1958) 
  13.     at java.security.AccessController.doPrivileged(Native Method) 
  14.     at javax.jdo.JDOHelper.invoke(JDOHelper.java:1953) 
  15.     at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1159) 
  16.     at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:803) 
  17.     at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:698) 
  18.     at org.apache.hadoop.hive.metastore.ObjectStore.getPMF(ObjectStore.java:262) 
  19.     at org.apache.hadoop.hive.metastore.ObjectStore.getPersistenceManager(ObjectStore.java:291) 
  20.     at org.apache.hadoop.hive.metastore.ObjectStore.initialize(ObjectStore.java:224) 
  21.     at org.apache.hadoop.hive.metastore.ObjectStore.setConf(ObjectStore.java:199) 
  22.     at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62) 
  23.     at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117) 
  24.     at org.apache.hadoop.hive.metastore.RetryingRawStore.<init>(RetryingRawStore.java:62) 
  25.     at org.apache.hadoop.hive.metastore.RetryingRawStore.getProxy(RetryingRawStore.java:71) 
  26.     at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.newRawStore(HiveMetaStore.java:413) 
  27.     at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.getMS(HiveMetaStore.java:401) 
  28.     at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB(HiveMetaStore.java:439) 
  29.     at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:325) 
  30.     at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.<init>(HiveMetaStore.java:285) 
  31.     at org.apache.hadoop.hive.metastore.RetryingHMSHandler.<init>(RetryingHMSHandler.java:53) 
  32.     at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:58) 
  33.     at org.apache.hadoop.hive.metastore.HiveMetaStore.newHMSHandler(HiveMetaStore.java:4102) 
  34.     at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:121) 
  35.     ... 28 more  

原因:

發(fā)現(xiàn)數(shù)據(jù)庫的權(quán)限 HIVE需要的是

'hive'@'192-168-103-43' 這個(gè)IP地址

解決:

然后試著在mysql中加上權(quán)限:

  1. GRANT ALL PRIVILEGES ON*.* TO 'hive'@'192-168-103-43' Identified by 'hive';  
  2. flush privileges 

再次登錄hive

  1. hive> show tables; 

OK

[[179248]]

2、Hive出現(xiàn)異常 FAILED: Error In Metadata: Java.Lang.RuntimeException: Unable To Instan

問題:

在公司的虛擬機(jī)上運(yùn)行hive計(jì)算,因?yàn)橐?jì)算的數(shù)據(jù)量較大,頻繁,導(dǎo)致了服務(wù)器負(fù)載過高,mysql也出現(xiàn)無法連接的問題,最后虛擬機(jī)出現(xiàn)The remote system refused the connection.重啟虛擬機(jī)后,進(jìn)入hive。 

  1. hive> show tables; 

出現(xiàn)了下面的問題:

  1. FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient 
  2. FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTaskFAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClientFAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask 

 

原因:

用下面的命令,重新啟動hive

  1. ./hive -hiveconf hive.root.logger=DEBUG,console 
  2. hive> show tables;  

能夠看到更深層次的原因的是: 

  1. Caused by: java.lang.reflect.InvocationTargetException 
  2.     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
  3.     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 
  4.     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 
  5.     at java.lang.reflect.Constructor.newInstance(Constructor.java:513) 
  6.     at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1076) 
  7.     … 23 more 
  8. Caused by: javax.jdo.JDODataStoreException: Exception thrown obtaining schema column information from datastore 
  9. NestedThrowables: 
  10. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘hive.DELETEME1370713761025′ doesn’t exist  

根據(jù)提示的信息,登陸mysql或者mysql客戶端查看hive的數(shù)據(jù)庫的表信息

  1. mysql -u root -p 
  2. mysql> use hive; 
  3. mysql> show tables; 
  4. +—————————+ 
  5. | Tables_in_hive | 
  6. +—————————+ 
  7. | BUCKETING_COLS | 
  8. | CDS | 
  9. | COLUMNS_V2 | 
  10. | DATABASE_PARAMS | 
  11. | DBS | 
  12. | DELETEME1370677637267 | 
  13. | DELETEME1370712928271 | 
  14. | DELETEME1370713342355 | 
  15. | DELETEME1370713589772 | 
  16. | DELETEME1370713761025 | 
  17. | DELETEME1370713792915 | 
  18. | IDXS | 
  19. | INDEX_PARAMS | 
  20. | PARTITIONS | 
  21. | PARTITION_KEYS | 
  22. | PARTITION_KEY_VALS | 
  23. | PARTITION_PARAMS | 
  24. | PART_COL_PRIVS | 
  25. | PART_COL_STATS | 
  26. | PART_PRIVS | 
  27. | SDS | 
  28. | SD_PARAMS | 
  29. | SEQUENCE_TABLE | 
  30. | SERDES | 
  31. | SERDE_PARAMS | 
  32. | SKEWED_COL_NAMES | 
  33. | SKEWED_COL_VALUE_LOC_MAP | 
  34. | SKEWED_STRING_LIST | 
  35. | SKEWED_STRING_LIST_VALUES | 
  36. | SKEWED_VALUES | 
  37. | SORT_COLS | 
  38. | TABLE_PARAMS | 
  39. | TAB_COL_STATS | 
  40. | TBLS | 
  41. | TBL_COL_PRIVS | 
  42. | TBL_PRIVS | 
  43. +—————————+ 
  44. 36 rows in set (0.00 sec)  

能夠看到“DELETEME1370713792915”這個(gè)表,問題明確了,由于計(jì)算的壓力過大,服務(wù)器停止響應(yīng),mysql也停止了響應(yīng),mysql進(jìn)程被異常終止,在運(yùn)行中的mysql表數(shù)據(jù)異常,hive的元數(shù)據(jù)表異常。

解決問題的辦法有兩個(gè):

1.直接在mysql中drop 異常提示中的table;

mysql>drop table DELETEME1370713761025;

2.保守的做法,根據(jù)DELETEME*表的結(jié)構(gòu),創(chuàng)建不存在的表

CREATE TABLE `DELETEME1370713792915` ( `UNUSED` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

通過實(shí)踐,第一個(gè)方法就能夠解決問題,如果不行可以嘗試第二個(gè)方法。

3、hive錯(cuò)誤show tables無法使用 : Unable to instantiate rg.apache.hadoop.hive.metastore.

問題:

hive異常show tables無法使用:

Unable to instantiate rg.apache.hadoop.hive.metastore.HiveMetaStoreClient

異常:

  1. hive> show tables; 
  2. FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate rg.apache.hadoop.hive.metastore.HiveMetaStoreClient  
  3. FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask  

原因:

在其他shell 開了hive 沒有關(guān)閉

解決:

使用 ps -ef | grep hive

kill -9

殺死進(jìn)程

4、FAILED: Error in metadata: java.lang.RuntimeException: Unable to in(2)(08-52-23)

問題:安裝配置Hive時(shí)報(bào)錯(cuò):

  1. FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient 
  2. FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask  

用調(diào)試模式報(bào)錯(cuò)如下: 

  1. [root@hadoop1 bin]# hive -hiveconf hive.root.logger=DEBUG,console 
  2. 13/10/09 16:16:27 DEBUG common.LogUtils: Using hive-site.xml found on CLASSPATH at /opt/hive-0.11.0/conf/hive-site.xml 
  3. 13/10/09 16:16:27 DEBUG conf.Configuration: java.io.IOException: config() 
  4.     at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:227) 
  5.     at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:214) 
  6.     at org.apache.hadoop.hive.conf.HiveConf.<init>(HiveConf.java:1039) 
  7.     at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:636) 
  8.     at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:614) 
  9.     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
  10.     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
  11.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
  12.     at java.lang.reflect.Method.invoke(Method.java:597) 
  13.     at org.apache.hadoop.util.RunJar.main(RunJar.java:156) 
  14.   
  15. 13/10/09 16:16:27 DEBUG conf.Configuration: java.io.IOException: config() 
  16.     at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:227) 
  17.     at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:214) 
  18.     at org.apache.hadoop.mapred.JobConf.<init>(JobConf.java:330) 
  19.     at org.apache.hadoop.hive.conf.HiveConf.initialize(HiveConf.java:1073) 
  20.     at org.apache.hadoop.hive.conf.HiveConf.<init>(HiveConf.java:1040) 
  21.     at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:636) 
  22.     at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:614) 
  23.     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
  24.     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
  25.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
  26.     at java.lang.reflect.Method.invoke(Method.java:597) 
  27.     at org.apache.hadoop.util.RunJar.main(RunJar.java:156) 
  28.   
  29. Logging initialized using configuration in file:/opt/hive-0.11.0/conf/hive-log4j.properties 
  30. 13/10/09 16:16:27 INFO SessionState:  
  31. Logging initialized using configuration in file:/opt/hive-0.11.0/conf/hive-log4j.properties 
  32. 13/10/09 16:16:27 DEBUG parse.VariableSubstitution: Substitution is on: hive 
  33. Hive history file=/tmp/root/hive_job_log_root_4666@hadoop1_201310091616_1069706211.txt 
  34. 13/10/09 16:16:27 INFO exec.HiveHistory: Hive history file=/tmp/root/hive_job_log_root_4666@hadoop1_201310091616_1069706211.txt 
  35. 13/10/09 16:16:27 DEBUG conf.Configuration: java.io.IOException: config() 
  36.     at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:227) 
  37.     at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:214) 
  38.     at org.apache.hadoop.security.UserGroupInformation.ensureInitialized(UserGroupInformation.java:187) 
  39.     at org.apache.hadoop.security.UserGroupInformation.isSecurityEnabled(UserGroupInformation.java:239) 
  40.     at org.apache.hadoop.security.UserGroupInformation.getLoginUser(UserGroupInformation.java:438) 
  41.     at org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroupInformation.java:424) 
  42.     at org.apache.hadoop.hive.shims.HadoopShimsSecure.getUGIForConf(HadoopShimsSecure.java:491) 
  43.     at org.apache.hadoop.hive.ql.security.HadoopDefaultAuthenticator.setConf(HadoopDefaultAuthenticator.java:51) 
  44.     at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62) 
  45.     at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117) 
  46.     at org.apache.hadoop.hive.ql.metadata.HiveUtils.getAuthenticator(HiveUtils.java:365) 
  47.     at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:270) 
  48.     at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:670) 
  49.     at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:614) 
  50.     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
  51.     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
  52.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
  53.     at java.lang.reflect.Method.invoke(Method.java:597) 
  54.     at org.apache.hadoop.util.RunJar.main(RunJar.java:156) 
  55.   
  56. 13/10/09 16:16:27 DEBUG security.Groups:  Creating new Groups object 
  57. 13/10/09 16:16:27 DEBUG security.Groups: Group mapping impl=org.apache.hadoop.security.ShellBasedUnixGroupsMapping; cacheTimeout=300000 
  58. 13/10/09 16:16:27 DEBUG security.UserGroupInformation: hadoop login 
  59. 13/10/09 16:16:27 DEBUG security.UserGroupInformation: hadoop login commit 
  60. 13/10/09 16:16:27 DEBUG security.UserGroupInformation: using local user:UnixPrincipal錛?root 
  61. 13/10/09 16:16:27 DEBUG security.UserGroupInformation: UGI loginUser:root 
  62. 13/10/09 16:16:27 DEBUG security.Groups: Returning fetched groups for 'root' 
  63. 13/10/09 16:16:27 DEBUG security.Groups: Returning cached groups for 'root' 
  64. 13/10/09 16:16:27 DEBUG conf.Configuration: java.io.IOException: config(config) 
  65.     at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:260) 
  66.     at org.apache.hadoop.hive.conf.HiveConf.<init>(HiveConf.java:1044) 
  67.     at org.apache.hadoop.hive.ql.security.authorization.DefaultHiveAuthorizationProvider.init(DefaultHiveAuthorizationProvider.java:30) 
  68.     at org.apache.hadoop.hive.ql.security.authorization.HiveAuthorizationProviderBase.setConf(HiveAuthorizationProviderBase.java:108) 
  69.     at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62) 
  70.     at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117) 
  71.     at org.apache.hadoop.hive.ql.metadata.HiveUtils.getAuthorizeProviderManager(HiveUtils.java:339) 
  72.     at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:272) 
  73.     at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:670) 
  74.     at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:614) 
  75.     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
  76.     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
  77.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
  78.     at java.lang.reflect.Method.invoke(Method.java:597) 
  79.     at org.apache.hadoop.util.RunJar.main(RunJar.java:156) 
  80.   
  81. 13/10/09 16:16:27 DEBUG conf.Configuration: java.io.IOException: config() 
  82.     at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:227) 
  83.     at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:214) 
  84.     at org.apache.hadoop.mapred.JobConf.<init>(JobConf.java:330) 
  85.     at org.apache.hadoop.hive.conf.HiveConf.initialize(HiveConf.java:1073) 
  86.     at org.apache.hadoop.hive.conf.HiveConf.<init>(HiveConf.java:1045) 
  87.     at org.apache.hadoop.hive.ql.security.authorization.DefaultHiveAuthorizationProvider.init(DefaultHiveAuthorizationProvider.java:30) 
  88.     at org.apache.hadoop.hive.ql.security.authorization.HiveAuthorizationProviderBase.setConf(HiveAuthorizationProviderBase.java:108) 
  89.     at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62) 
  90.     at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117) 
  91.     at org.apache.hadoop.hive.ql.metadata.HiveUtils.getAuthorizeProviderManager(HiveUtils.java:339) 
  92.     at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:272) 
  93.     at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:670) 
  94.     at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:614) 
  95.     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
  96.     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
  97.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
  98.     at java.lang.reflect.Method.invoke(Method.java:597) 
  99.     at org.apache.hadoop.util.RunJar.main(RunJar.java:156)  

原因:

這個(gè)錯(cuò)誤應(yīng)該是你集成了mysql,從而報(bào)錯(cuò)

解決:

修改hive-site.xml,參照:

  1. <property>    
  2.     <name>javax.jdo.option.ConnectionURL</name>    
  3.     <value>jdbc:mysql://192.168.1.101:3306/hive?createDatabaseIfNotExist=true</value>    
  4.     <description>JDBC connect string for a JDBC metastore</description>  
  5. </property>  

5、Hive的--auxpath使用相對路徑遇到的一個(gè)奇怪的異常

問題:

在使用Hive的--auxpath過程中,如果我使用的是相對路徑(例如,--auxpath=abc.jar),會產(chǎn)生下面的一個(gè)異常: 

  1. java.lang.IllegalArgumentException: Can not create a Path from an empty string 
  2.     at org.apache.hadoop.fs.Path.checkPathArg(Path.java:91) 
  3.     at org.apache.hadoop.fs.Path.<init>(Path.java:99) 
  4.     at org.apache.hadoop.fs.Path.<init>(Path.java:58) 
  5.     at org.apache.hadoop.mapred.JobClient.copyRemoteFiles(JobClient.java:619) 
  6.     at org.apache.hadoop.mapred.JobClient.copyAndConfigureFiles(JobClient.java:724) 
  7.     at org.apache.hadoop.mapred.JobClient.copyAndConfigureFiles(JobClient.java:648)  

原因:

從異常的內(nèi)容來看,是由于使用了一個(gè)空字符串來創(chuàng)建一個(gè)Path對象。

經(jīng)過分析發(fā)現(xiàn),使用"--auxpath=abc.jar"來啟動Hive時(shí),Hive會自動在abc.jar前面補(bǔ)上"file://"。也就是說Hive最后使用的路徑是"file://abc.jar"。

當(dāng)我們使用"file://abc.jar"來生成一個(gè)Path時(shí),調(diào)用這個(gè)Path的getName將會返回""(空字符串)。而Hive在提交MapReduce的Job時(shí),會使用getName來獲取文件名,并創(chuàng)建一個(gè)新的Path對象。下面的示例代碼演示了一下這個(gè)過程,會拋出上文提到的異常。

  1. Path path = new Path("file://abc.jar"); 
  2. System.out.println("path name:" + path.getName()); 
  3. System.out.println("authority:" + path.toUri().getAuthority()); 
  4. Path newPath = new Path(path.getName());  

上文的代碼輸出

path name:

authority:abc.jar

并拋出了異常"Can not create a Path from an empty string"

那么為什么"file://abc.jar"生成的Path的getName返回的是""而不是"abc.jar"呢,而且"abc.jar"卻成了authority?在Path中的處理代碼如下: 

  1. if (pathString.startsWith("//", start) && (pathString.length()-start > 2)) { // has authority 
  2.     int nextSlash = pathString.indexOf('/', start+2); 
  3.     int authEnd = nextSlash > 0 ? nextSlash : pathString.length(); 
  4.     authority = pathString.substring(start+2, authEnd); 
  5.     start = authEnd; 
  6. // uri path is the rest of the string -- query & fragment not supported 
  7. String path = pathString.substring(start, pathString.length());  

pathString就是傳進(jìn)去的"file://abc.jar",由于我們只有兩個(gè)"/"因此,從第二個(gè)"/"到結(jié)尾的字符串("abc.jar")都被當(dāng)成了authority,path(內(nèi)部的成員)則設(shè)置成了""而getName返回的就是path,因此也就為""了。

解決:

如果使用Hive的--auxpath來設(shè)置jar,必須使用絕對路徑,或者使用"file:///.abc.jar"這樣的表示法。這個(gè)才是Hadoop的Path支持的方式。事實(shí)上,hadoop許多相關(guān)的Path的設(shè)置,都存在這個(gè)問題,所以在無法確定的情況下,就不要使用相對路徑了。

6、啟動hive hwi服務(wù)時(shí)出現(xiàn) HWI WAR file not found錯(cuò)誤

問題:

  1. hive --service hwi 
  2. [niy@niy-computer /]$ $HIVE_HOME/bin/hive --service hwi 
  3. 13/04/26 00:21:17 INFO hwi.HWIServer: HWI is starting up 
  4. 13/04/26 00:21:18 FATAL hwi.HWIServer: HWI WAR file not found at /usr/local/hive/usr/local/hive/lib/hive-hwi-0.12.0-SNAPSHOT.war  

原因:

可以看出/usr/local/hive/usr/local/hive/lib/hive-hwi-0.12.0-SNAPSHOT.war肯定不是正確路徑,真正路徑是/usr/local/hive/lib/hive-hwi-0.12.0-SNAPSHOT.war,斷定是配置的問題

解決:將hive-default.xml中關(guān)于 hwi的設(shè)置拷貝到hive-site.xml中即可

  1. <property>   
  2.     <name>hive.hwi.war.file</name>   
  3.     <value>lib/hive-hwi-0.12.0-SNAPSHOT.war</value>   
  4.     <description>This sets the path to the HWI war file, relative to ${HIVE_HOME}. </description>   
  5. </property>   
  6. <property>   
  7.     <name>hive.hwi.listen.host</name>   
  8.     <value>0.0.0.0</value>   
  9.     <description>This is the host address the Hive Web Interface will listen on</description>   
  10. </property>     
  11. <property>   
  12.     <name>hive.hwi.listen.port</name>   
  13.     <value>9999</value>   
  14.     <description>This is the port the Hive Web Interface will listen on</description>   
  15. </property>  

7、問題:當(dāng)啟動Hive的時(shí)候報(bào)錯(cuò): 

  1. Caused by: javax.jdo.JDOException: Couldnt obtain a new sequence (unique id) : Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENTandat least one table uses a storage engine limited to row-based logging.  
  2. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.  
  3. NestedThrowables: java.sql.SQLException: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT andat least one table uses a storage engine limited to row-based logging.  
  4. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED

 原因:

這個(gè)問題是由于hive的元數(shù)據(jù)存儲MySQL配置不當(dāng)引起的

解決辦法: 

  1. mysql> setglobal binlog_format='MIXED'

8、問題:

當(dāng)在Hive中創(chuàng)建表的時(shí)候報(bào)錯(cuò):

  1. create table years (year string, eventstring) row format delimited fields terminated by'\t'; FAILED: Execution Error, return code 1from org.apache.hadoop.hive.ql.exec.DDLTask.  
  2. MetaException(message:For direct MetaStore DB connections, we don't support retries at the client level.)  

原因:

這是由于字符集的問題,需要配置MySQL的字符集:

解決辦法:

  1. mysql> alter database hive character set latin1; 

9、問題:

當(dāng)執(zhí)行Hive客戶端時(shí)候出現(xiàn)如下錯(cuò)誤:

WARN conf.HiveConf: HiveConf of name hive.metastore.localdoesnot exist

原因:這是由于在0.10 0.11或者之后的HIVE版本 hive.metastore.local 屬性不再使用。

解決辦法:

將該參數(shù)從hive-site.xml刪除即可。

10、問題:

在啟動Hive報(bào)如下錯(cuò)誤:

(Permission denied: user=anonymous, access=EXECUTE, inode="/tmp":hadoop:supergroup:drwx------

原因:這是由于Hive沒有hdfs:/tmp目錄的權(quán)限,

解決辦法:

賦權(quán)限即可:hadoop dfs -chmod -R 777 /tmp

11、Hive查詢數(shù)據(jù)庫時(shí),出現(xiàn)null。無數(shù)據(jù)顯示。

問題如下: 

 

 

 

解決辦法:

  1. LOAD DATA LOCAL INPATH '/tmp/sanple.txt' overwrite into table animal FIELDS TERMINATED BY '\t'

解釋:

數(shù)據(jù)分隔符的問題,定義表的時(shí)候需要定義數(shù)據(jù)分隔符,

  1. FIELDS TERMINATED BY '\t' 

這個(gè)字段就說明了數(shù)據(jù)分隔符是tab。

具體分割符請以自己的文化中具體的情況來定。

12、ERROR beeline.ClassNameCompleter: Fail to parse the class name from the Jar file due to

在使用beeline鏈接Hive服務(wù)的時(shí)候,報(bào)了下面的這個(gè)錯(cuò)誤:

  1. beeline> !connect jdbc:hive2//h2slave1:10000 
  2. scan complete in 1ms 
  3. 16/07/27 11:40:54 [main]: ERROR beeline.ClassNameCompleter: Fail to parse the class name from the Jar file due to the exception:java.io.FileNotFoundException: minlog-1.2.jar (沒有那個(gè)文件或目錄) 
  4. 16/07/27 11:40:54 [main]: ERROR beeline.ClassNameCompleter: Fail to parse the class name from the Jar file due to the exception:java.io.FileNotFoundException: objenesis-1.2.jar (沒有那個(gè)文件或目錄) 
  5. 16/07/27 11:40:54 [main]: ERROR beeline.ClassNameCompleter: Fail to parse the class name from the Jar file due to the exception:java.io.FileNotFoundException: reflectasm-1.07-shaded.jar (沒有那個(gè)文件或目錄) 
  6. scan complete in 596ms 
  7. No known driver to handle "jdbc:hive2//h2slave1:10000" 

 解決:

其實(shí)這個(gè)問題是由于jdbc協(xié)議地址寫錯(cuò)造成的,在hive2之后少了個(gè)“:”

改成以下這個(gè)形式即可:

  1. beeline> !connect jdbc:hive2://h2slave1:10000 

13、Missing Hive Execution Jar: /.../hive-exec-*.jar

運(yùn)行hive時(shí)顯示Missing Hive Execution Jar: /usr/hive/hive-0.11.0/bin/lib/hive-exec-*.jar

運(yùn)行hive時(shí)顯示Missing Hive Execution Jar: /usr/hive/hive-0.11.0/bin/lib/hive-exec-*.jar

細(xì)細(xì)分析這個(gè)目錄/bin/lib,在hive安裝文件夾中這兩個(gè)目錄是并列的,而系統(tǒng)能夠找到這樣的鏈接,說明hive在centos系統(tǒng)配置文件中的路徑有誤,打開 /etc/profile會發(fā)現(xiàn)hive的配置路徑為

  1. export PATH=$JAVA_HOME/bin:$PATH:/usr/hive/hive-0.11.0/bin 

明顯可以看出是路徑配置的問題,這樣的配置系統(tǒng)會在hive安裝文件夾中的bin目錄下尋找它所需要的jar包,而bin和lib文件夾是并列的,所以我們需要在centos系統(tǒng)配置文件中將hive路徑配置為文件夾安裝路徑,即

  1. export PATH=$JAVA_HOME/bin:$PATH:/usr/hive/hive-0.11.0 

注意:這種問題一般都是出在環(huán)境變量上面的配置。請認(rèn)真檢查etc/profile跟你hive的安裝路徑。

14、hive啟動報(bào)錯(cuò): Found class jline.Terminal, but interface was expected

錯(cuò)誤如下: 

  1. [ERROR] Terminal initialization failed; falling back to unsupported 
  2. java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected 
  3.     at jline.TerminalFactory.create(TerminalFactory.java:101) 
  4.     at jline.TerminalFactory.get(TerminalFactory.java:158) 
  5.     at jline.console.ConsoleReader.<init>(ConsoleReader.java:229) 
  6.     at jline.console.ConsoleReader.<init>(ConsoleReader.java:221) 
  7.     at jline.console.ConsoleReader.<init>(ConsoleReader.java:209) 
  8.     at org.apache.hadoop.hive.cli.CliDriver.getConsoleReader(CliDriver.java:773) 
  9.     at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:715) 
  10.     at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675) 
  11.     at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:615) 
  12.     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
  13.     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
  14.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
  15.     at java.lang.reflect.Method.invoke(Method.java:606) 
  16.     at org.apache.hadoop.util.RunJar.main(RunJar.java:212)  

原因:

jline版本沖突不一致導(dǎo)致的,hadoop目錄下存在老版本jline:

/hadoop-2.6.0/share/hadoop/yarn/lib:

jline-0.9.94.jar

解決:

把hive中的新版本jline拷貝一份到hadoop的share/hadoop/yarn/lib即可

同時(shí)要把那個(gè)老版本的給刪除 

  1. cp /hive/apache-hive-1.1.0-bin/lib/jline-2.12.jar /hadoop-2.5.2/share/hadoop/yarn/lib 

15、MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes

在使用hive時(shí),使用mysql存儲元數(shù)據(jù)的時(shí)候,遇到下面的錯(cuò)誤:

  1. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes 
  2.     at sun.reflect.GeneratedConstructorAccessor31.newInstance(Unknown Source) 
  3.     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
  4.     at java.lang.reflect.Constructor.newInstance(Constructor.java:526) 
  5.     at com.mysql.jdbc.Util.handleNewInstance(Util.java:377) 
  6.     at com.mysql.jdbc.Util.getInstance(Util.java:360)  

解決辦法:

用mysql做元數(shù)據(jù),要修改數(shù)據(jù)字符集

  1. alter database hive character set latin1  

【本文為51CTO專欄作者“王森豐”的原創(chuàng)稿件,轉(zhuǎn)載請注明出處】

責(zé)任編輯:龐桂玉 來源: 神算子
相關(guān)推薦

2016-12-14 15:59:31

HBase分布式數(shù)據(jù)

2016-12-14 14:47:59

Zookeeper服務(wù)器

2016-12-19 15:32:12

Linux問題集

2016-12-13 16:36:15

Hadoopwindows

2011-03-28 17:51:10

nagios

2010-03-25 16:20:44

CentOS安裝

2011-02-22 14:21:49

vsftpd

2009-10-09 17:40:38

VB.Net問題集

2011-02-25 14:25:04

Proftpd

2011-02-22 14:40:25

vsftpd

2018-07-12 09:25:07

磁盤陣列數(shù)據(jù)恢復(fù)

2009-07-01 00:23:40

MySQL字符集亂碼

2009-12-31 15:28:02

Silverlight

2011-03-03 13:41:36

Pureftpd防火墻

2011-05-16 13:15:55

MySQL存儲字符集

2011-03-03 14:26:15

PureftpdSSHFTP

2021-08-04 07:21:31

Hive 數(shù)據(jù)排查

2014-03-26 11:15:26

Hive

2010-05-17 10:01:09

MySql字符集

2011-03-03 14:56:56

Pureftpd腳本
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號