Hive問題集
1、FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org
問題:
起因是我重裝了mysql數(shù)據(jù)庫。
安裝之后 把訪問權(quán)限都配置好 :
- GRANT ALL PRIVILEGES ON*.* TO 'hive'@'%' Identified by 'hive';
- GRANT ALL PRIVILEGES ON*.* TO 'hive'@'localhost' Identified by 'hive';
- GRANT ALL PRIVILEGES ON*.* TO 'hive'@'127.0.0.1' Identified by 'hive';
本機(jī)地址: 192.168.103.43 機(jī)器名字:192-168-103-43
- flush privileges;
啟動hive 發(fā)生下面的錯(cuò)誤:
- hive> show tables;FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
- 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
- cd ${HIVE_HOME}/bin
- ./hive -hiveconf hive.root.logger=DEBUG,console
- hive> show tables;
得到如下的錯(cuò)誤信息(當(dāng)然 不同的問題所產(chǎn)生的日志是不同的):
- Caused by: javax.jdo.JDOFatalDataStoreException: Access denied for user 'hive'@'192-168-103-43' (using password: YES)
- NestedThrowables:
- java.sql.SQLException: Access denied for user 'hive'@'192-168-103-43' (using password: YES)
- at org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:298)
- at org.datanucleus.jdo.JDOPersistenceManagerFactory.freezeConfiguration(JDOPersistenceManagerFactory.java:601)
- at org.datanucleus.jdo.JDOPersistenceManagerFactory.createPersistenceManagerFactory(JDOPersistenceManagerFactory.java:286)
- at org.datanucleus.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:182)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:597)
- at javax.jdo.JDOHelper$16.run(JDOHelper.java:1958)
- at java.security.AccessController.doPrivileged(Native Method)
- at javax.jdo.JDOHelper.invoke(JDOHelper.java:1953)
- at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1159)
- at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:803)
- at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:698)
- at org.apache.hadoop.hive.metastore.ObjectStore.getPMF(ObjectStore.java:262)
- at org.apache.hadoop.hive.metastore.ObjectStore.getPersistenceManager(ObjectStore.java:291)
- at org.apache.hadoop.hive.metastore.ObjectStore.initialize(ObjectStore.java:224)
- at org.apache.hadoop.hive.metastore.ObjectStore.setConf(ObjectStore.java:199)
- at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62)
- at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
- at org.apache.hadoop.hive.metastore.RetryingRawStore.<init>(RetryingRawStore.java:62)
- at org.apache.hadoop.hive.metastore.RetryingRawStore.getProxy(RetryingRawStore.java:71)
- at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.newRawStore(HiveMetaStore.java:413)
- at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.getMS(HiveMetaStore.java:401)
- at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB(HiveMetaStore.java:439)
- at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:325)
- at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.<init>(HiveMetaStore.java:285)
- at org.apache.hadoop.hive.metastore.RetryingHMSHandler.<init>(RetryingHMSHandler.java:53)
- at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:58)
- at org.apache.hadoop.hive.metastore.HiveMetaStore.newHMSHandler(HiveMetaStore.java:4102)
- at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:121)
- ... 28 more
原因:
發(fā)現(xiàn)數(shù)據(jù)庫的權(quán)限 HIVE需要的是
'hive'@'192-168-103-43' 這個(gè)IP地址
解決:
然后試著在mysql中加上權(quán)限:
- GRANT ALL PRIVILEGES ON*.* TO 'hive'@'192-168-103-43' Identified by 'hive';
- flush privileges;
再次登錄hive
- hive> show tables;
OK
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。
- hive> show tables;
出現(xiàn)了下面的問題:
- FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
- 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
- ./hive -hiveconf hive.root.logger=DEBUG,console
- hive> show tables;
能夠看到更深層次的原因的是:
- Caused by: java.lang.reflect.InvocationTargetException
- at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
- at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
- at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
- at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
- at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1076)
- … 23 more
- Caused by: javax.jdo.JDODataStoreException: Exception thrown obtaining schema column information from datastore
- NestedThrowables:
- com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘hive.DELETEME1370713761025′ doesn’t exist
根據(jù)提示的信息,登陸mysql或者mysql客戶端查看hive的數(shù)據(jù)庫的表信息
- mysql -u root -p
- mysql> use hive;
- mysql> show tables;
- +—————————+
- | Tables_in_hive |
- +—————————+
- | BUCKETING_COLS |
- | CDS |
- | COLUMNS_V2 |
- | DATABASE_PARAMS |
- | DBS |
- | DELETEME1370677637267 |
- | DELETEME1370712928271 |
- | DELETEME1370713342355 |
- | DELETEME1370713589772 |
- | DELETEME1370713761025 |
- | DELETEME1370713792915 |
- | IDXS |
- | INDEX_PARAMS |
- | PARTITIONS |
- | PARTITION_KEYS |
- | PARTITION_KEY_VALS |
- | PARTITION_PARAMS |
- | PART_COL_PRIVS |
- | PART_COL_STATS |
- | PART_PRIVS |
- | SDS |
- | SD_PARAMS |
- | SEQUENCE_TABLE |
- | SERDES |
- | SERDE_PARAMS |
- | SKEWED_COL_NAMES |
- | SKEWED_COL_VALUE_LOC_MAP |
- | SKEWED_STRING_LIST |
- | SKEWED_STRING_LIST_VALUES |
- | SKEWED_VALUES |
- | SORT_COLS |
- | TABLE_PARAMS |
- | TAB_COL_STATS |
- | TBLS |
- | TBL_COL_PRIVS |
- | TBL_PRIVS |
- +—————————+
- 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
異常:
- hive> show tables;
- FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate rg.apache.hadoop.hive.metastore.HiveMetaStoreClient
- 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ò):
- FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
- FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
用調(diào)試模式報(bào)錯(cuò)如下:
- [root@hadoop1 bin]# hive -hiveconf hive.root.logger=DEBUG,console
- 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
- 13/10/09 16:16:27 DEBUG conf.Configuration: java.io.IOException: config()
- at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:227)
- at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:214)
- at org.apache.hadoop.hive.conf.HiveConf.<init>(HiveConf.java:1039)
- at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:636)
- at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:614)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:597)
- at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
- 13/10/09 16:16:27 DEBUG conf.Configuration: java.io.IOException: config()
- at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:227)
- at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:214)
- at org.apache.hadoop.mapred.JobConf.<init>(JobConf.java:330)
- at org.apache.hadoop.hive.conf.HiveConf.initialize(HiveConf.java:1073)
- at org.apache.hadoop.hive.conf.HiveConf.<init>(HiveConf.java:1040)
- at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:636)
- at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:614)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:597)
- at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
- Logging initialized using configuration in file:/opt/hive-0.11.0/conf/hive-log4j.properties
- 13/10/09 16:16:27 INFO SessionState:
- Logging initialized using configuration in file:/opt/hive-0.11.0/conf/hive-log4j.properties
- 13/10/09 16:16:27 DEBUG parse.VariableSubstitution: Substitution is on: hive
- Hive history file=/tmp/root/hive_job_log_root_4666@hadoop1_201310091616_1069706211.txt
- 13/10/09 16:16:27 INFO exec.HiveHistory: Hive history file=/tmp/root/hive_job_log_root_4666@hadoop1_201310091616_1069706211.txt
- 13/10/09 16:16:27 DEBUG conf.Configuration: java.io.IOException: config()
- at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:227)
- at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:214)
- at org.apache.hadoop.security.UserGroupInformation.ensureInitialized(UserGroupInformation.java:187)
- at org.apache.hadoop.security.UserGroupInformation.isSecurityEnabled(UserGroupInformation.java:239)
- at org.apache.hadoop.security.UserGroupInformation.getLoginUser(UserGroupInformation.java:438)
- at org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroupInformation.java:424)
- at org.apache.hadoop.hive.shims.HadoopShimsSecure.getUGIForConf(HadoopShimsSecure.java:491)
- at org.apache.hadoop.hive.ql.security.HadoopDefaultAuthenticator.setConf(HadoopDefaultAuthenticator.java:51)
- at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62)
- at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
- at org.apache.hadoop.hive.ql.metadata.HiveUtils.getAuthenticator(HiveUtils.java:365)
- at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:270)
- at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:670)
- at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:614)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:597)
- at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
- 13/10/09 16:16:27 DEBUG security.Groups: Creating new Groups object
- 13/10/09 16:16:27 DEBUG security.Groups: Group mapping impl=org.apache.hadoop.security.ShellBasedUnixGroupsMapping; cacheTimeout=300000
- 13/10/09 16:16:27 DEBUG security.UserGroupInformation: hadoop login
- 13/10/09 16:16:27 DEBUG security.UserGroupInformation: hadoop login commit
- 13/10/09 16:16:27 DEBUG security.UserGroupInformation: using local user:UnixPrincipal錛?root
- 13/10/09 16:16:27 DEBUG security.UserGroupInformation: UGI loginUser:root
- 13/10/09 16:16:27 DEBUG security.Groups: Returning fetched groups for 'root'
- 13/10/09 16:16:27 DEBUG security.Groups: Returning cached groups for 'root'
- 13/10/09 16:16:27 DEBUG conf.Configuration: java.io.IOException: config(config)
- at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:260)
- at org.apache.hadoop.hive.conf.HiveConf.<init>(HiveConf.java:1044)
- at org.apache.hadoop.hive.ql.security.authorization.DefaultHiveAuthorizationProvider.init(DefaultHiveAuthorizationProvider.java:30)
- at org.apache.hadoop.hive.ql.security.authorization.HiveAuthorizationProviderBase.setConf(HiveAuthorizationProviderBase.java:108)
- at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62)
- at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
- at org.apache.hadoop.hive.ql.metadata.HiveUtils.getAuthorizeProviderManager(HiveUtils.java:339)
- at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:272)
- at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:670)
- at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:614)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:597)
- at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
- 13/10/09 16:16:27 DEBUG conf.Configuration: java.io.IOException: config()
- at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:227)
- at org.apache.hadoop.conf.Configuration.<init>(Configuration.java:214)
- at org.apache.hadoop.mapred.JobConf.<init>(JobConf.java:330)
- at org.apache.hadoop.hive.conf.HiveConf.initialize(HiveConf.java:1073)
- at org.apache.hadoop.hive.conf.HiveConf.<init>(HiveConf.java:1045)
- at org.apache.hadoop.hive.ql.security.authorization.DefaultHiveAuthorizationProvider.init(DefaultHiveAuthorizationProvider.java:30)
- at org.apache.hadoop.hive.ql.security.authorization.HiveAuthorizationProviderBase.setConf(HiveAuthorizationProviderBase.java:108)
- at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:62)
- at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
- at org.apache.hadoop.hive.ql.metadata.HiveUtils.getAuthorizeProviderManager(HiveUtils.java:339)
- at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:272)
- at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:670)
- at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:614)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:597)
- at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
原因:
這個(gè)錯(cuò)誤應(yīng)該是你集成了mysql,從而報(bào)錯(cuò)
解決:
修改hive-site.xml,參照:
- <property>
- <name>javax.jdo.option.ConnectionURL</name>
- <value>jdbc:mysql://192.168.1.101:3306/hive?createDatabaseIfNotExist=true</value>
- <description>JDBC connect string for a JDBC metastore</description>
- </property>
5、Hive的--auxpath使用相對路徑遇到的一個(gè)奇怪的異常
問題:
在使用Hive的--auxpath過程中,如果我使用的是相對路徑(例如,--auxpath=abc.jar),會產(chǎn)生下面的一個(gè)異常:
- java.lang.IllegalArgumentException: Can not create a Path from an empty string
- at org.apache.hadoop.fs.Path.checkPathArg(Path.java:91)
- at org.apache.hadoop.fs.Path.<init>(Path.java:99)
- at org.apache.hadoop.fs.Path.<init>(Path.java:58)
- at org.apache.hadoop.mapred.JobClient.copyRemoteFiles(JobClient.java:619)
- at org.apache.hadoop.mapred.JobClient.copyAndConfigureFiles(JobClient.java:724)
- 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è)過程,會拋出上文提到的異常。
- Path path = new Path("file://abc.jar");
- System.out.println("path name:" + path.getName());
- System.out.println("authority:" + path.toUri().getAuthority());
- 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中的處理代碼如下:
- if (pathString.startsWith("//", start) && (pathString.length()-start > 2)) { // has authority
- int nextSlash = pathString.indexOf('/', start+2);
- int authEnd = nextSlash > 0 ? nextSlash : pathString.length();
- authority = pathString.substring(start+2, authEnd);
- start = authEnd;
- }
- // uri path is the rest of the string -- query & fragment not supported
- 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ò)誤
問題:
- hive --service hwi
- [niy@niy-computer /]$ $HIVE_HOME/bin/hive --service hwi
- 13/04/26 00:21:17 INFO hwi.HWIServer: HWI is starting up
- 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中即可
- <property>
- <name>hive.hwi.war.file</name>
- <value>lib/hive-hwi-0.12.0-SNAPSHOT.war</value>
- <description>This sets the path to the HWI war file, relative to ${HIVE_HOME}. </description>
- </property>
- <property>
- <name>hive.hwi.listen.host</name>
- <value>0.0.0.0</value>
- <description>This is the host address the Hive Web Interface will listen on</description>
- </property>
- <property>
- <name>hive.hwi.listen.port</name>
- <value>9999</value>
- <description>This is the port the Hive Web Interface will listen on</description>
- </property>
7、問題:當(dāng)啟動Hive的時(shí)候報(bào)錯(cuò):
- 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.
- InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
- 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.
- InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
原因:
這個(gè)問題是由于hive的元數(shù)據(jù)存儲MySQL配置不當(dāng)引起的
解決辦法:
- mysql> setglobal binlog_format='MIXED';
8、問題:
當(dāng)在Hive中創(chuàng)建表的時(shí)候報(bào)錯(cuò):
- 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.
- MetaException(message:For direct MetaStore DB connections, we don't support retries at the client level.)
原因:
這是由于字符集的問題,需要配置MySQL的字符集:
解決辦法:
- 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ù)顯示。
問題如下:
解決辦法:
- LOAD DATA LOCAL INPATH '/tmp/sanple.txt' overwrite into table animal FIELDS TERMINATED BY '\t';
解釋:
數(shù)據(jù)分隔符的問題,定義表的時(shí)候需要定義數(shù)據(jù)分隔符,
- 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ò)誤:
- beeline> !connect jdbc:hive2//h2slave1:10000
- scan complete in 1ms
- 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è)文件或目錄)
- 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è)文件或目錄)
- 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è)文件或目錄)
- scan complete in 596ms
- No known driver to handle "jdbc:hive2//h2slave1:10000"
解決:
其實(shí)這個(gè)問題是由于jdbc協(xié)議地址寫錯(cuò)造成的,在hive2之后少了個(gè)“:”
改成以下這個(gè)形式即可:
- 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的配置路徑為
- export PATH=$JAVA_HOME/bin:$PATH:/usr/hive/hive-0.11.0/bin
明顯可以看出是路徑配置的問題,這樣的配置系統(tǒng)會在hive安裝文件夾中的bin目錄下尋找它所需要的jar包,而bin和lib文件夾是并列的,所以我們需要在centos系統(tǒng)配置文件中將hive路徑配置為文件夾安裝路徑,即
- 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ò)誤如下:
- [ERROR] Terminal initialization failed; falling back to unsupported
- java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
- at jline.TerminalFactory.create(TerminalFactory.java:101)
- at jline.TerminalFactory.get(TerminalFactory.java:158)
- at jline.console.ConsoleReader.<init>(ConsoleReader.java:229)
- at jline.console.ConsoleReader.<init>(ConsoleReader.java:221)
- at jline.console.ConsoleReader.<init>(ConsoleReader.java:209)
- at org.apache.hadoop.hive.cli.CliDriver.getConsoleReader(CliDriver.java:773)
- at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:715)
- at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675)
- at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:615)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:606)
- 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è)老版本的給刪除
- 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ò)誤:
- com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
- at sun.reflect.GeneratedConstructorAccessor31.newInstance(Unknown Source)
- at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
- at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
- at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
- at com.mysql.jdbc.Util.getInstance(Util.java:360)
解決辦法:
用mysql做元數(shù)據(jù),要修改數(shù)據(jù)字符集
- alter database hive character set latin1
【本文為51CTO專欄作者“王森豐”的原創(chuàng)稿件,轉(zhuǎn)載請注明出處】