本文介绍了配置Hive以本地模式运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我试图在本地模式下运行Hive,我已经设置了HIVE_OPTS环境变量

  export HIVE_OPTS =' - hiveconf 
mapred.job.tracker = local
-hiveconf fs.default.name = file:////< myhomedir> / hivelocal / tmp
-hiveconf hive.metastore.warehouse。 dir = file:////< myhomedir> / hivelocal / warehouse
-hiveconf javax.jdo.option.ConnectionURL = jdbc:derby:; databaseName = /< myhomedir> / hivelocal / metastore_db; create = true '

并使用 hive 客户端连接到配置单元



在创建表(名称 demo )时,我仍然看到表正在创建<$ HDFS中的c $ c> default 数据库。我希望在本地文件系统( file:/// )中创建表,因为我使用 hive.metastore设置仓库.warehouse.dir = file:////< myhomedir> / hivelocal / warehouse



我在这里错过了什么吗?



PS:我正在使用Cloudera发行版

解决方案

问题。以下是步骤(包括试用和错误),我也跟着修复了这些步骤。


  1. 转至 / etc / hive / conf &重命名为 hive-site.xml ,由cloudera生成。 / tmp / hive 的许可,并给予适当的许可。目前,只是为了测试,我给出了:



    [cloudera @ quickstart〜] $ sudo chmod 777 / tmp / hive /


  2. 配置本地模式:

    [cloudera @ quickstart〜] $ export HIVE_OPTS =' - hiveconf mapred.job.tracker = local -hiveconf fs.default.name = file:/// home / cloudera / hivelocal / tmp -hiveconf hive.metastore.warehouse.dir = file:/// home / cloudera / hivelocal / warehouse -hiveconf javax.jdo.option .ConnectionURL = jdbc:derby:; databaseName = / home / cloudera / hivelocal / metastore_db; create = true'


  3. 创建表:

    hive>创建表doc_one(文本字符串)以'\ n'结尾的行格式定界字段,存储为文本文件;


  4. 创建表成功地在 / home / cloudera / hivelocal /



Hi I am trying to run Hive in local mode, I have set the HIVE_OPTS environment variable

export HIVE_OPTS='-hiveconf
mapred.job.tracker=local
-hiveconf fs.default.name=file:////<myhomedir>/hivelocal/tmp
-hiveconf hive.metastore.warehouse.dir=file:////<myhomedir>/hivelocal/warehouse
-hiveconf javax.jdo.option.ConnectionURL=jdbc:derby:;databaseName=/<myhomedir>/hivelocal/metastore_db;create=true'

and connected to hive using hive client

when I create the table(name demo), I still see the table is getting created in the default database in HDFS. I was expecting the table to be created in the local file system(file:///) as I have the set the warehouse using hive.metastore.warehouse.dir=file:////<myhomedir>/hivelocal/warehouse

Am I missing something here?

PS : I am using Cloudera distribution

解决方案

I too was facing the same problem. Below are the steps (with trial & error), I had followed to fix the same.

  1. go to /etc/hive/conf & rename hive-site.xml generated by cloudera.

  2. check the permission for the /tmp/hive and give appropriate permission.For the time being, just to test, I had given:

    [cloudera@quickstart ~]$ sudo chmod 777 /tmp/hive/

  3. Configure local mode:

    [cloudera@quickstart ~]$ export HIVE_OPTS='-hiveconf mapred.job.tracker=local -hiveconf fs.default.name=file:///home/cloudera/hivelocal/tmp -hiveconf hive.metastore.warehouse.dir=file:///home/cloudera/hivelocal/warehouse –hiveconf javax.jdo.option.ConnectionURL=jdbc:derby:;databaseName=/home/cloudera/hivelocal/metastore_db;create=true'

  4. Create table:

    hive> Create table doc_one(text string) row format delimited fields terminated by '\n' stored as textfile;

  5. Table is created successfully in /home/cloudera/hivelocal/

这篇关于配置Hive以本地模式运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-12 18:05