Ubuntu16.04 install apache-hive-2. X.x-bin.tar.gz

Source: Internet
Author: User
Tags mysql version

Pre-preparatory work:

  Note: If the following command is not sufficient, please add sudo to the command, and the following configuration for all CQB-LENOVO-B40 please replace your hostname or localhost!!!

Installing the mysql5.x versionInstalling the hadoop2.x versionInstall hive2.x.x:Open Terminal:

Ctrl+alt+t

Download Hadoop:

wget http://mirrors.hust.edu.cn/apache/hive/hive-2.3.0/apache-hive-2.3.0-bin.tar.gz

to create the installation directory for Hadoop:

Mkdir-p/data/service/

unzip to the/data/service/directory:

TAR-ZXVF apache-hive-2.3.0-bin.tar.gz -c/data/service/

Enter The/data/service/directory:

cd/data/service/

Add the file name to Hadoop:

MvApache-hive-2.3.0-bin/Hive

into hive configuration directory

cd/data/ service/hive/conf/

< Span style= "Font-family:courier new, Courier" > < Span style= "Font-family:courier new, Courier" > configuration hive.site.xml in fact, the configuration directory does not have this file, to create our own, directly copy hive-default.xml.template this configuration file Modify the name Hive.site.xml:

CP Hive-default.xml.template hive.site.xml

configuring Hive.site.xml files with Gedit

sudo gedit/data/service/hive/conf/Hive-site.xml

Configuration:

<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>

<name>javax.jdo.option.ConnectionPassword</name>
<value>root</value>

The following configuration MySQL configuration two select one:

View MySQL version: Mysql-u root-p log in to MySQL to see the version number. Example: Server version:5.7.19 MySQL Community Server (GPL)

        

mysql5.5 version:

<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>

mysql5.7 version:

<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true&amp;useSSL=false</value>

<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>

<name>hive.metastore.schema.verification</name>
<value>false</value>

The following few configurations do not replicate to the penultimate line as follows:

<property>
<name>datanucleus.schema.autoCreateSchema</name>
<value>true</value>
</property>

<property>
<name>datanucleus.schema.autoCreateTables</name>
<value>true</value>
</property>

<property>
<name>datanucleus.schema.autoCreateColumns</name>

<value>true</value>
</property>

            

Replace all of the ${system:java.io.tmpdir} to/tmp

Replace all of the ${system:user.name} to root

Hive.site.xml file configuration is complete.

The hive connection to MySQL requires MySQL's JDBC rack package, so we have no MySQL JDBC Rack package in the/data/service/hive/lib/directory.

Enter the Lib directory:

cd/data/service/hive/lib/

To see if a JDBC Rack package exists:

Ls-l mysql-connector-java-x.x.xx.tar.gz

If not, please download the MySQL JDBC package on the website:

sudo wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.44.tar.gz

Wait for the download to complete, unzip the JDBC package:

sudo tar zxvf mysql-connector-java-5.1.44.tar.gz

Because the extract is a directory, we only need the inside of the Mysql-connector-java-5.1.44-bin.jar on the line:

Into the directory that has been unzipped:

CD mysql-connector-java-5.1.44/

Cut Mysql-connector-java-5.1.44-bin.jar to cd/data/service/hive/lib/directory

sudo mv mysql-connector-java-5.1.44-bin.jar/data/service/hive/lib/

set environment Variables for hive:

sudo vim/etc/profile.d/hive-en.sh

    

Execute the hive-en.sh environment variable:

source/etc/profile.d/hive-en.sh

Verify the hive-en.sh path location:

Echo $HIVE-home

This is the end of the configuration, and then you can start hive. you need to start Hadoop before you start hive, or you will see a deny connection:

    

Terminal input hive will allow hive to run, and if successful it will enter hive> edit mode, such as:

    

If hive fails to start unexpectedly--you can use the Tail-f/tmp/user directory/hive.log to see the exception.Press CTRL + C to exit hive.   open a terminal to MySQL, check the MySQL database, if there is a hive database to build hive success:

    

Ubuntu16.04 install apache-hive-2. X.x-bin.tar.gz

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.