{"id":328,"date":"2019-07-27T15:31:12","date_gmt":"2019-07-27T10:01:12","guid":{"rendered":"https:\/\/techieshouts.com\/?p=328"},"modified":"2022-08-09T19:07:22","modified_gmt":"2022-08-09T13:37:22","slug":"hive-installation-steps","status":"publish","type":"post","link":"https:\/\/techieshouts.com\/home\/hive-installation-steps\/","title":{"rendered":"Hive Installation steps"},"content":{"rendered":"\n<div class=\"wp-block-media-text alignwide\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" width=\"200\" height=\"140\" src=\"https:\/\/techieshouts.com\/wp-content\/uploads\/2019\/07\/HiveInstallation.jpg\" alt=\"\" class=\"wp-image-329\"\/><\/figure><div class=\"wp-block-media-text__content\">\n<p style=\"text-align:left\">In this post, we will see how to install Hive in your Ubuntu machine. Hive is a tool to query and process data from HDFS. Hive uses HQL(Hive Query Language) for processing data. It follows MySQL syntax so people from SQL background will find it easy to work with the hive. Let&#8217;s get into the installation steps for installing this hive tool. <\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-ub-divider\"><div class=\"ub_divider\" style=\"border-top:2px solid #0693e3;margin-top:20px;margin-bottom:20px\"><\/div><\/div>\n\n\n\n<ul><li><a rel=\"noreferrer noopener\" href=\"http:\/\/www-eu.apache.org\/dist\/hive\/\" target=\"_blank\"><strong>Download<\/strong>&nbsp;<\/a>hive to your local machine. Keep the downloaded tarball in the home directory of your Ubuntu machine.<\/li><li>Uncompress hive tarball. You can either right-click and uncompress or use the command to do it \u201c<strong>tar -xzvf apache-hive-1.2.1-bin.tar.gz<\/strong>\u201d. <\/li><li>Now we have to set the path for the hive&nbsp;in the .bashrc file under the home directory. In case if you are not able to see the file press Ctrl+H(to make the hidden files visible). Open the <strong>.bashrc<\/strong> file and add the below lines<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"classic\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">export HIVE_HOME=\/home\/user\/apache-hive-1.2.1-bin&lt;br>export PATH=$PATH:$HIVE_HOME\/bin<\/pre>\n\n\n\n<ul><li>After appending these lines you can just save and close the file. For the values to get updated and set for the current shell we need to source the .bashrc file by running the command  &#8220;<strong>~$source ~\/.bashrc<\/strong>\u201d<\/li><li> Hive is installed and you can log in to hive client using \u201c<strong>hive<\/strong>\u201d command in your terminal.<\/li><li>By default, the meta-information about the hive schema, tables, and other objects will be stored in derby. We have to change it to MySQL so that the \u201c<strong>metastore<\/strong>\u201d details will not be created again and again whenever you log in to hive client.<\/li><\/ul>\n\n\n\n<h2>Steps to connect hive with MySQL metastore<\/h2>\n\n\n\n<ul><li>Here I assume that you have already installed MySQL in your machine and if not please check this&nbsp;post&nbsp;for installing MySQL and continue. <\/li><li>Navigate to the MySQL folder inside the hive installed folder using the below command.<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"classic\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cd $HIVE_HOME\/scripts\/metastore\/upgrade\/mysql<\/pre>\n\n\n\n<ul><li> Next, run the below commands to create the metastore for hive in MySQL <\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"classic\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mysql -uroot -proot\nCREATE DATABASE metastore;\nUSE metastore;\nSOURCE hive-schema-1.2.0.mysql.sql;<\/pre>\n\n\n\n<ul><li>After that, you have to&nbsp;download&nbsp;the MySQL connector and copy it to the hive lib directory.<\/li><li>Similar to hdfs-site.xml, we have&nbsp;<strong>hive-site.xml<\/strong>&nbsp;that needs to be configured.<\/li><\/ul>\n\n\n\n<p>There are few&nbsp;properties mandatory properties that need to be added in the hive-site.xml file. The properties are,<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"xml\" data-enlighter-theme=\"classic\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?>\n&lt;property>\n   &lt;name>javax.jdo.option.ConnectionURL&lt;\/name>\n   &lt;value>jdbc:mysql:\/\/localhost\/metastore&lt;\/value>\n   &lt;description>the URL of the MySQL database&lt;\/description>\n&lt;\/property>\n&lt;property>\n   &lt;name>javax.jdo.option.ConnectionDriverName&lt;\/name>\n   &lt;value>com.mysql.jdbc.Driver&lt;\/value>\n&lt;\/property>\n&lt;property>\n   &lt;name>javax.jdo.option.ConnectionUserName&lt;\/name>\n   &lt;value>root&lt;\/value>\n&lt;\/property>\n&lt;property>\n   &lt;name>javax.jdo.option.ConnectionPassword&lt;\/name>\n   &lt;value>root&lt;\/value>\n&lt;\/property>\n<\/pre>\n\n\n\n<ul><li>You can also&nbsp;<a rel=\"noreferrer noopener\" href=\"http:\/\/www.f1foru.com\/Downloads\/hive-site.rar\" target=\"_blank\"><strong>download<\/strong>&nbsp;<\/a>the hive-site.xml with the required properties from our site.<\/li><li>Copy this hive-site.xml file to the conf folder inside the hive installed directory.<\/li><li>We are all set to start hive now. Hive can be started from the terminal window in the Ubuntu machine with the following command. <\/li><\/ul>\n\n\n\n<p><strong>nohup hive \u2013service metastore &amp; <\/strong><\/p>\n\n\n\n<p>nohup is used to run the Linux commands in the background. You can also use the command &#8220;<strong>hive \u2013service metastore &amp;<\/strong>&#8221; if you don&#8217;t want to run this in background<\/p>\n\n\n\n<p>Incase if we want to access hive from third party tools like HUE, we need to start another hive daemon &#8211; hive server using the command <\/p>\n\n\n\n<p>\u201c<strong>hive \u2013service hiveserver2 &amp;<\/strong>\u201c <\/p>\n\n\n\n<p>That&#8217;s it. You have successfully installed hive. Happy querying \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post, we will see how to install Hive in your Ubuntu machine. Hive is a tool to query and process data from HDFS. Hive uses HQL(Hive Query Language) for processing data. It follows MySQL syntax so people from SQL background will find it easy to work with the hive. Let&#8217;s get into the\u2026 <span class=\"read-more\"><a href=\"https:\/\/techieshouts.com\/home\/hive-installation-steps\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":329,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[11,135],"tags":[25,18,22],"_links":{"self":[{"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/posts\/328"}],"collection":[{"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/comments?post=328"}],"version-history":[{"count":8,"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/posts\/328\/revisions"}],"predecessor-version":[{"id":975,"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/posts\/328\/revisions\/975"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/media\/329"}],"wp:attachment":[{"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/media?parent=328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/categories?post=328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techieshouts.com\/home\/wp-json\/wp\/v2\/tags?post=328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}