Hive,Hadoop – JDBC Configurations & Settings

1.For Hive to work Hadoop should be installed first.

2.Download hive jar extract it.

3.In bin/hive file give HADOOP_HOME=/path_to_hadoop_folder.

4.in conf/hive-env.sh.template file give HADOOP_HOME_CONF=/path_to_hadoop_folder/conf.

5.Then create a /tmp and /user/hive/warehouse directory in hadoop interface by following command
$ $HADOOP_HOME/bin/hadoop dfs -mkdir /tmp
$ $HADOOP_HOME/bin/hadoop dfs -mkdir /user/hive/warehouse

6.Give permission to those directory by following command
$ $HADOOP_HOME/bin/hadoop dfs -chmod g+w /tmp
$ $HADOOP_HOME/bin/hadoop dfs -chmod g+w /user/hive/warehouse

7.Then start the hive server by giving following command
bin/hive –service hiveserver
this starts hive server with hostname=localhost and port=10000

8.Through this hostname and port we can connect to it through jdbc

9.Sample syntax for hive jdbc connection is shown below

Class.forName(“org.apache.hadoop.hive.jdbc.HiveDriver”);
Connection con = DriverManager.getConnection(“jdbc:hive://localhost:10000/default”, “”, “”);
Statement stmt = con.createStatement();
stmt.executeQuery(“create table test_table (key int, value string)row format delimited fields terminated by ‘,'”);

10.To run this java code hadoop core jar and hive lib jar are required.

11.For a webinterface of hive following properties should be configured in conf/hive-site.xml

hive.hwi.war.file
/usr/local/hive-0.8.1/lib/hive-hwi-0.8.1.war
This sets the path to the HWI war file, relative to ${HIVE_HOME}.

hive.hwi.listen.host
localhost
This is the host address the Hive Web Interface will listen on

hive.hwi.listen.port
9999
This is the port the Hive Web Interface will listen on

12.To start the webinterface of hive execute the following command
bin/hive –service hwi

13.Then once hive webinterface goto http://localhost:9999/hwi in your browser

Advertisements

About ashokabhat

I am a C,C ,JAVA,Adobe Flex,.NET Programmer Currently working as a Software Developer
This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to Hive,Hadoop – JDBC Configurations & Settings

  1. raj says:

    plz help me.

    i am getting following error

    Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient

    • ashokabhat says:

      Fallow the steps : 1]Stop all the nodes
      2]Restart system
      3]Check the appropriate jar library files present or not or version mismatch
      4]Start the Hadoop and all Nodes
      5]Execute your program/code.

  2. mahesh says:

    nice information…good website

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s