Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Hive - Help required

Hive - Help required



 Please help me if possible?

1)   Hive metastore stored in postgresql databse[credentilas==> hive2/hive2]

2)   thrift server2 started on port 10000

3)   hive> create database mydb; // created DB successfully


The queries are

4) where is the location of "mydb" stored is it in "/user/hive/warehouse"

5) how do i set username,password along with url for jdbc connection url, now without setting username, password accessible able to acces "jdbc:hive2://localhost:10000/mydb"


Re: Hive - Help required

Unless you use special syntax in your create database syntax, creating a database means there will be a folder with the same name in the warehouse directory. In your case, this would be /user/hive/warehouse (in HDFS, not the local file system).

To secure HiveServer2, you can either configure Kerberos on your cluster, or use a different authentication mechanism for HiveServer2. Kerberos is recommended, though other systems can work as well.

Kerberos guide:

Also consult the CDH guide for HiveServer2 Security, which covers the syntax of the JDBC URL when using Kerberos, and alternatives to Kerberos:


Re: Hive - Help required



Thanks for the help and useful.


I went through lot of google articles but i dont see any where setting up username, password for the database which we created.(Always showcased : create database <dbname>)

I saw  from apache wiki alter db owner name but not the password setup.


Please help me here how to set username, password for the db which i created.



ALTER DATABASE database_name SET OWNER [USER|ROLE] user_or_role;   (Hive 0.13.0 and later)



This is something different settings for properties


CREATE DATABASE <DB_NAME> WITH DBPROPERTIES ('mapred.jobtracker.url'='','hive.warehouse.dir' = '/user/hive/warehouse');


Can we setup like this? will it work? i havent test this


CREATE DATABASE db1 WITH DBPROPERTIES ('username'='hive', 'password'='hive')





I have seen 3 things

==== NO FIREWALLS ====

1) Hive metastore database created in postgresql listening on embedded DB port : 7432.

2) Port on which Hive Metastore Server will listen for connections : 9083

3) Port on which HiveServer2 will listen for connections. : 10000


Point 2 and 3 running on the same box say


1) /opt/cloudera/parcels/CDH-5.1.0-1.cdh5.1.0.p0.53/lib/hive/bin$ hive  ===> what is the default host and port connects by this shell script? I believe on port 9083? is this correct?

   /opt/cloudera/parcels/CDH-5.1.0-1.cdh5.1.0.p0.53/lib/hive/bin$ hive

  hive> show databases;

  Time taken: 1.469 seconds, Fetched: 3 row(s)


2) These commands hangs - why?

    /opt/cloudera/parcels/CDH-5.1.0-1.cdh5.1.0.p0.53/lib/hive/bin$ hive -h -p 9083 -v

    [] hive> show databases;


    /opt/cloudera/parcels/CDH-5.1.0-1.cdh5.1.0.p0.53/lib/hive/bin$ hive -h localhost -p 9083 -v

    [localhost:9083] hive> show databases;


   /opt/cloudera/parcels/CDH-5.1.0-1.cdh5.1.0.p0.53/lib/hive/bin$ hive -h -p 10000 -v

   [] hive> show databases;


   /opt/cloudera/parcels/CDH-5.1.0-1.cdh5.1.0.p0.53/lib/hive/bin$ hive -h localhost -p 10000 -v

   [localhost:10000] hive> show databases;


Re: Hive - Help required

It sounds like you want fine-grained authorization to control access a particular Hive database. This is done through Sentry. Authentication (which is where you prove you are who you say you are, often via username / password), is usually done by Kerberos or Active Directory, then Sentry does the Authorization - checking that your user has been granted access to the database, table, etc.

The hive script is deprecated in CDH 5. You should use HiveServer2 instead, which has a client called "beeline". The syntax for beeline is totally different, so be sure to read about it.

When you use the hive script, it will talk directly with the Hive Metastore and MapReduce. You can examine /etc/hive/conf/hive-site.xml to see the URL it uses to talk to the Metastore, and in either /etc/hive/conf or /etc/hadoop/conf you can see the configuration used to talk to MapReduce (mapred-site.xml).

I am not familiar with the -h and -p flags when using the hive command, so I'm not sure what they're doing. I've never had to use them. Normally you just type "hive" if using the CLI, and when talking to HiveServer2 via beeline then you specify the appropriate JDBC URL via different syntax.