Friday, December 26, 2014

Setup and Configure Hive

Step 1: 
Download latest Hive from Apache Download Mirrors and derby db.
https://archive.apache.org/dist/hive/hive-0.13.1/
http://db.apache.org/derby/releases/release-10.10.2.0.cgi

Step 2: 
Un-tar the files to your working directory.

Step 3: 
Set environment variable  for the Hive home directory in .bashrc file.
export HIVE_HOME="/home/satishkumar/WORK/apache-hive-0.13.1-bin"
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HIVE_HOME

Step 4: 
Close the terminal and open to verify the environment variable for the Hive is configured or not.
$echo $HIVE_HOME

Step 5: Start derby
Here we are using default db as derby for storing Hive Metadata. Start derby by using following commands
./startNetworkServer -h 0.0.0.0 &   
    or in case of any exception  
./startNetworkServer -noSecurityManager 

Step 6: 
Add/Update Configurations in hive-site.xml
<configuration>  
<property>  
  <name>javax.jdo.option.ConnectionURL</name>  
  <value>jdbc:derby://localhost:1527/myderby1;create=true</value>  
 <description>JDBC connect string for a JDBC metastore</description>
</property>  
  <property>  
 <name>javax.jdo.option.ConnectionDriverName</name>  
 <value>org.apache.derby.jdbc.ClientDriver</value>  
 <description>Driver class name for a JDBC metastore</description>  
</property>  
</configuration>

Step 7:
Copy derby librarires to hive/lib. (Here we are using derby as MetaData, so copying all the derby libraries to Hive)
1) Delete if any derby lib is already there in hive/lib folder. 
2) copy derby.jar, derbyclient.jar, derbytools.jar from derby/lib into hive/lib.

Step 8:
Start Hive with following command
$> bin/hive 

1 comment: