Raj
Raj

Reputation: 2398

Configuring Hive to run in Local Mode

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

Upvotes: 2

Views: 4992

Answers (1)

Vinkal
Vinkal

Reputation: 2984

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/

Upvotes: 3

Related Questions