问题描述一: java
Caused by: java.sql.SQLException: Unable to open a test connection to the given database. JDBC url = jdbc:mysql://192.168.64.11:3306/hive?characterEncoding=UTF-8, username = hive. Terminating connection pool (set lazyInit to true if you expect to start your database after your app). Original Exception: ------mysql
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: sql
错误缘由:中止mysql服务以后修改hive密码,以后没有重启mysql,虽然在主机上能够用 mysql -uroot -p登录,可是运行hive命令却拒绝远程连接。
解决方法:
#/etc/init.d/mysql restart #重启mysql服务
或service mysql restart
便可解决以上问题。shell
问题描述2:数据库
当在Hive
中建立表的时候报错:apache
create table years (year string, event string) row format delimited fields terminated by '\t';FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(m
字符集问题、乱码的、显示字符长度问题的,这是因为字符集的问题,须要配置MySQL
的字符集:服务器
mysql> alter database hive character set latin1;
修改后问题解决。
app
问题描述3:ide
hadoop安装完之后,常常会提示一下警告:
oop
WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
搜了好多文章,都说是跟系统位数有关系,我使用的是Centos 6.5 64位系统。
首先下载hadoop-native-64-2.6.0.tar:
http://dl.bintray.com/sequenceiq/sequenceiq-bin/hadoop-native-64-2.6.0.tar
下载完之后,解压到hadoop的native目录下,覆盖原有文件便可。操做以下:
tar -xvf hadoop-native-64-2.4.0.tar -C hadoop/lib/native/
问题描述4:
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:For direct MetaStore DB connections, we don’t support retries at the client level.) 这个是因为个人mysql再也不本地(默认使用本地数据库),这里须要配置远端元数据服务器 <property> <name>hive.metastore.uris</name> <value>thrift://10.24.32.169:9083</value> </property>
在后台启动hive服务端程序
$nohup hive --service metastore &
客户端直接使用hive命令便可
问题描述5:
java.lang.IllegalArgumentException: java.net.UnknownHostException: dfscluster 解决办法: 找不到hdfs集群名字dfscluster,这个文件在HADOOP的etc/hadoop下面,有个文件hdfs-site.xml,复制到hive的conf下,重启便可 [hadoop@slave4 hadoop]$ cp hdfs-site.xml $HIVE_HOME/conf/
问题描述6:
hive删除表时报错以下: hive> drop table spider_log; FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:javax.jdo.JDODataStoreException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT' at line 1 解决办法: 是mysql的版本和驱动的版本不匹配致使的,个人mysql版本是5.6的,刚开始使用的驱动是5.1.18, ,可是mysql5.6已经抛弃了这个参数,因此会报上面错误,换成驱动mysql-connector-java-5.1.31-bin.jar后解决。 (注意:更高的驱动版本也不必定能行,我下载了驱动是5.1.51也不能用,必须是5.1.31) 下载驱动: http://dev.mysql.com/downloads/connector/j/ 选择平台,下载(mysql-connector-java-5.1.31.tar.gz) 或者http://download.csdn.net/detail/sallivan/1855957下载