Dear Learner,
I hope you are doing good.
Before we work with HCatalog we need to few setting in Edureka VM. Please follow the steps given below that would guide you in doing that.
-
Edit the .bashrc
Command: sudo gedit ~/.bashrc
Add the below lines and save the file.
export HIVE_HOME=/usr/lib/hive-0.13.1-bin
export HCAT_HOME=/usr/lib/hive-0.13.1-bin/hcatalog
export PIG_HOME=/usr/lib/pig-0.12.0
export PATH=$PATH:$HCAT_HOME/bin
export PATH=$PATH:$PIG_HOME/bin
export PIG_CLASSPATH=$HCAT_HOME/share/hcatalog/hive-hcatalog-core-0.13.1.jar:\
$HCAT_HOME/share/hcatalog/hive-hcatalog-pig-adapter-0.13.1.jar:\
$HIVE_HOME/lib/hive-metastore-0.13.1.jar:$HIVE_HOME/lib/libthrift-0.9.0.jar:\
$HIVE_HOME/lib/hive-exec-0.13.1.jar:$HIVE_HOME/lib/libfb303-0.9.0.jar:\
$HIVE_HOME/lib/jdo-api-3.0.1.jar:$HIVE_HOME/conf:$HADOOP_HOME/conf
- Edit hive-site.xml
Command: sudo gedit /usr/lib/hive-0.13.1-bin/conf/hive-site.xml
It would create a new file. edit as follows.
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hive.metastore.uris</name>
<value>thrift://localhost:9083</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:;databaseName=metastore_db;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.EmbeddedDriver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
</configuration>
- Restart the Edureka VM
- Make sure that both the adapters - Auto eth1 and System eth0 are enabled. If not enable them.
- Check if all the Hadoop daemons are running fine. If not, please start them by running below commands.
Command: sudo service hadoop-master stop
Command: sudo service hadoop-master stop
Command: hadoop dfsadmin -safemode leave
- Starting the Hive metastore
Command: hive --service metastore &
- Testing it if it is working fine
Command: netstat -an | grep 9083
You should receive the message similar to the one in the below screenshot.
-
Now login to the grunt sheel using below command.
Command: pig -useHCatalog
Later try to use the load command and check.