问题描述
你好,我试图在本地模式下运行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发行版
问题。以下是步骤(包括试用和错误),我也跟着修复了这些步骤。
-
转至
/ etc / hive / conf
&重命名为hive-site.xml
,由cloudera生成。 对/ tmp / hive
的许可,并给予适当的许可。目前,只是为了测试,我给出了:
[cloudera @ quickstart〜] $ sudo chmod 777 / tmp / hive /
-
配置本地模式:
[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'
-
创建表:
hive>创建表doc_one(文本字符串)以'\ n'结尾的行格式定界字段,存储为文本文件;
-
创建表成功地在
/ 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.
go to
/etc/hive/conf
& renamehive-site.xml
generated by cloudera.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/
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'
Create table:
hive> Create table doc_one(text string) row format delimited fields terminated by '\n' stored as textfile;
Table is created successfully in
/home/cloudera/hivelocal/
这篇关于配置Hive以本地模式运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!