我在hadoop
的同一台服务器上安装了hive
,MySQL
和CENT OS
。我还设置了MySQL
和用户ID - hive可以通过以下步骤访问数据库。
mysql> CREATE DATABASE metastore;
mysql> USE metastore;
mysql> SOURCE $HIVE_HOME/scripts/metastore/upgrade/mysql/hive-schema-0.10.0.mysql.sql;
mysql> CREATE USER 'hiveuser'@'%' IDENTIFIED BY 'hivepassword';
mysql> GRANT all on *.* to 'hiveuser'@localhost identified by 'hivepassword';
mysql> flush privileges;
我的Hive-site.xml文件属性如下:
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost/metastorecreateDatabaseIfNotExist=true</value>
<description>metadata is stored in a MySQL server</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>MySQL JDBC driver class</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hiveuser</value>
<description>user name for connecting to mysql server</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hivepassword</value>
<description>password for connecting to mysql server</description>
</property>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
<description> warehouse </description>
</property>
当我在hive shell
内提供 show tables命令时,我收到以下错误:
蜂房&GT;显示表; FAILED:元数据错误:java.lang.RuntimeException:无法实例化 org.apache.hadoop.hive.metastore.HiveMetaStoreClient FAILED:执行 错误,从org.apache.hadoop.hive.ql.exec.DDLTask返回代码1
我在互联网上搜索了所有内容,但无法找到问题的解决方案。有人可以指导我,我在这里缺少什么?
答案 0 :(得分:0)
1. First just check your hadoop daemons. All are up or not.
2. Else restart your hadoop cluster once.
3. Have you copied the jar (mysql-connector-java.***) into Hive's lib dir?
4. Which mysql version you are using. If it is very old then :
mysql>alter database metastore_Db character set latin1;
I think step 1 and 2 will solve your problem.