我的mysql是装在本地机器win7操作系统下的,服务正常,本地登录正常。
hive装在linux虚拟机上,虚拟机与本机网络没有问题,防火墙已关,hadoop安装也没有问题。
我在liunx虚拟机上安装了mysql的客户端,通过命令mysql -uhive -paxx1314 -h192.168.120.1 正常登录,信息如下
[root@zchlinux conf]# mysql -uhive -paxx1314 -h192.168.120.1
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9 to server version: 5.0.18-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| hivedb |
| test |
+--------------------+
3 rows in set (0.03 sec)
mysql>
但当我启动hive时报错,报错信息如下:
[root@zchlinux conf]# hive
Logging initialized using configuration in jar:file:/opt/apache-hive-0.13.0-bin/lib/hive-common-0.13.0.jar!/hive-
log4j.properties
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate
org.apache.hadoop.hive.metastore.HiveMetaStoreClient
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:344)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:681)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:625)
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:601)
at org.apache.hadoop.util.RunJar.main(RunJar.java:160)
Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1412)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.(RetryingMetaStoreClient.java:62)
at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:72)
at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:2444)
at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:2456)
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:338)
... 7 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1410)
... 12 more
Caused by: javax.jdo.JDOFatalDataStoreException: Unable to open a test connection to the given database. JDBC url =
jdbc:mysql://192.168.120.1:3306/hivedb?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8, username =
hive. Terminating connection pool (set lazyInit to true if you expect to start your database after your app). Original
Exception: ------
java.sql.SQLException: Access denied for user 'hive'@'192.168.120.128' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
.........
.....
..
hive的配置文件hivehive-site.xml内容如下:
<?xml version="1.0"?>
< ?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
javax.jdo.option.ConnectionURL
jdbc:mysql://192.168.120.1:3306/hivedb?
createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
javax.jdo.option.ConnectionUserName
hive
javax.jdo.option.ConnectionPassWord
axx1314
Finit