Ubuntu16 under Hive Installation

Source: Internet
Author: User

0. Installation environment and version

Ubuntu16,Hadoop version is 2.7.2, choose Hive version to hive-2.1.17

1. Hive installation package Download

Address: https://mirrors.tuna.tsinghua.edu.cn/apache/hive/

2. Unzip after uploading to the server
sudo mv apache-hive-2.1.1-bin.tar.gz/usr/localsudo tar zxvf apache-hive-2.1.1-bin.tar.gzsudo mv Apache -hive-2.1.1-bin  hivesudo chown–r hadoop:hadoop Hive

3. Configuration
sudo vi/etc/profile.d/hadoop.sh

Add the following content :

# For Hive export hive_home=/usr/local/hiveexport hive_conf_dir=$HIVE _home/Confexport CLASSPATH=$CLASSPATH:$HIVE _home/libexport PATH=$PATH:$HIVE _home /bin

use command after saving:source/etc/profile make environment variables effective immediately

4. Download and set up a goodJDBC Connector

Download from here: https://dev.mysql.com/downloads/connector/j/

Remember to put the extracted jar into the Lib of Hive

$HIVE _home/lib/

Or

$HIVE _home/lib/mysql-connector-java-5.1.42-bin.jar

5. ConfigurationMysqlas aHivethe metadata repository

if not installed properly MySQL, install MySQL on the server first .

1) Create hive database and user

GRANT  All Privileges  on *. *  to ' Hive '  by ' [email protected] ' ; Create Database  Privileges;  

6.ConfigurationHive-site.xmlfile

1) Configure the hive-site.xml file

$HIVE _home/CONFCP HIVE-default. Xml.template hive-site.xml

Modify :

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

Switch

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

To set the hive metabase connection information :

<property><name>javax.jdo.option.ConnectionURL</name><value>jdbc:mysql://master:3306/hive?createdatabaseifnotexist=true</value><description&GT;JDBC connect string forA JDBC metastore</description></property><property><name>javax.jdo.option.ConnectionDriverName</name><value>com.mysql.jdbc.Driver</value><description>driver class Name forA JDBC metastore</description></property><property><name>javax.jdo.option.ConnectionUserName</name><value>hive</value><description>username to use against Metastore database</description></property><property><name>javax.jdo.option.ConnectionPassword</name><value>hive</value><description>password to use against Metastore database</description></property>
6. Initializing the database

the database needs to be initialized before it can be run using hive or the hive--service CLI , and if the above command has been run and failed before initialization, you need to delete the resulting metastore_db File

Using the command schematool-initschema-dbtype MySQL to initialize mysql database

the following lines appear to illustrate the success of the initialization :

7. StartHive Service

Start hive Two services that are commonly used

# using this service, you can have metastore run as a separate (remote) process

Nohup Hive--service metastore 2>&1 >>/var/log.log &

# Let Hive run as a server that provides trift services, allowing clients written in different languages to access

Nohup Hive-–service hiveserver2 2>&1 >>/var/log.log &

8. Copying hive to other slave nodes

SCP The hive folder to other slave nodes so that hive can also be accessed on other servers

9. Error Resolution

1) Exception information:

Exception information:

Exception in thread "main" Java.lang.RuntimeException:java.lang.IllegalArgumentException: Java.net.URISyntaxException:Relative path in absolute URI: ${system:java.io.tmpdir%7d/$%7bsystem:user.name%7d

At Org.apache.Hadoop.hive.ql.session.SessionState.start (sessionstate.java:444)

Solve:

To view the hive-site.xml configuration, you see a configuration item with the configuration value "System:java.io.tmpdir"

2. new Folder Create a new tmp directory under Hive directory

3. ${system:java.io.tmpdir}/${system:user.name} These two are replaced with the /usr/local/hive/tmp path , There are two places to replace

Ubuntu16 under Hive Installation

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.