hive常见问题及解决方法

Hive常见问题及解决方法

问题1:Specified key was too long; max key length is 1536 bytes

 

 

hive.log :  2018-01-05 13:31:29,072 ERROR [main]: DataNucleus.Datastore (Log4JLogger.java:error(115)) - An exception was thrown while adding/validating class(es) : Specified key was too long; max key length is 1536 bytes

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 1536 bytes

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

 

 

解决方案

在mysql机器的上运行: alter database hive character set latin1;

问题解决.

 

 

问题2:message from server: "Host '192.168.152.129' is not allowed to connect to this MySQL server"

分析:经排查应该是hive无法远程授权

 

--注意192.168.152.129 该ip换成自己的

grant all privileges on *.* to 'hive'@'192.168.152.129' identified by 'hive123';

flush privileges;

 

grant all privileges on *.* to 'hive'@'localhost' identified by 'hive123';

flush privileges;

 

grant all privileges on *.* to 'hive'@'%' identified by 'hive123';

flush privileges;

 

 

 

 

 

 

 

 

 

 

 

问题3:拒绝连接

on exception: java.net.ConnectException: 拒绝连接; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused

...

Caused by: java.net.ConnectException: Call From Qunar/127.0.0.1 to localhost:9000 failed on connection exception: java.net.ConnectException: 拒绝连接; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused

...

Caused by: java.net.ConnectException: 拒绝连接

at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)

at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)

at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)

at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:531)

at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:495)

at org.apache.hadoop.ipc.Client$Connection.setupConnection(Client.java:614)

at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:712)

at org.apache.hadoop.ipc.Client$Connection.access$2900(Client.java:375)

at org.apache.hadoop.ipc.Client.getConnection(Client.java:1528)

at org.apache.hadoop.ipc.Client.call(Client.java:1451)

... 29 more

 

 

解决方案

有可能是Hadoop没有启动,使用jps查看一下当前进程发现:

~/opt/hive-2.1.0$ jps

7317 Jps

可以看见,我们确实没有启动Hadoop。开启Hadoop的NameNode和DataNode守护进程

问题4:缺少MySQL驱动包

问题描述

Caused by: org.datanucleus.store.rdbms.connectionpool.DatastoreDriverNotFoundException: The specified datastore driver ("com.mysql.jdbc.Driver") was not found in the CLASSPATH. Please check your CLASSPATH specification, and the name of the driver.

at org.datanucleus.store.rdbms.connectionpool.AbstractConnectionPoolFactory.loadDriver(AbstractConnectionPoolFactory.java:58)

at org.datanucleus.store.rdbms.connectionpool.BoneCPConnectionPoolFactory.createConnectionPool(BoneCPConnectionPoolFactory.java:54)

at org.datanucleus.store.rdbms.ConnectionFactoryImpl.generateDataSources(ConnectionFactoryImpl.java:213)

 

 

解决方案

上述问题很可能是缺少mysql的jar包,下载mysql-connector-java-5.1.32.tar.gz,复制到hive的lib目录下:

cp mysql-connector-java-5.1.34-bin.jar opt/hive-2.1.0/lib/

 

posted @ 2018-04-15 16:07  跳出  阅读(1271)  评论(0编辑  收藏  举报