手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Hive安装(本地独立模式,MySQL为元数据库)

[日期:2014-06-28] 来源:Linux社区  作者:Criss [字体:大 中 小]

3. 复制一份hive-default.xml.template重命名为hive-site.xml

cp hive-default.xml.template hive-site.xml

4. 更改hive-site.xml 内容

注意:

Javax.jdo.option.ConnectionURL

jdbc:MySQL://localhost/hive_metastore?createDatabaseIfNotExist=true

JDBC connect string for a JDBC metastore

标红位置是使用的mysql数据库名字,所以一定要赋予mysql用户对hive_metastore的全部权限。

这里是配置用户名和密码,mysql 的

最后这部分可以不添加(我使用的版本不需要),有些本版需要,有些版本不需要…

详细的配置方式可参考:

[url=http://blog.csdn.net/reesun/article/details/8556078]http://blog.csdn.net/reesun/article/details/8556078[/url]

5. 添加lib目录下缺少的mysql-connector-java-5.1.29.tar 包。

到官网下载即可

6. 配置环境变量

7. 切换进hvie目录,启动thrift服务

./bin/hive --service hiveserver 注意:两个杠

切换进hvie目录,进入hive

./bin/hive

验证启动成功,效果应如下图:

Show tables;

Create table;

hive> create table t_demo(d_id string,d_str string)

> row format delimited

> fields terminated by '|'

> stored as textfile

> ;

查看Hadoop hdfs 是否生成了文件

三.过程中可能遇到的问题

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.DDLTask

用下面的命令,重新启动hive

[b]./hive -hiveconf hive.root.logger=DEBUG,console [/b][b]进行[/b][b]debug[/b]

问题1.

Caused by: org.datanucleus.store.rdbms.datasource.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.

解决方法:

这说明没有添或者添加错了mysql-connector-java-5.1.29.jar 包添加jar包即可

问题2.

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user 'hadoopuser'@'localhost' to database 'hive_metastore'

解决方法:

这是因为mysql数据库用户hadoopuser 的权限不足,赋予权限

grant all on hive_metastore.* to 'hadoopuser'@'localhost' ;

Hive 的详细介绍:请点这里
Hive 的下载地址:请点这里

本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-06/103822.htm

linux
相关资讯       Hive安装 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款