Build Hive environment under RedHat

Source: Internet
Author: User
Build a Hive environment in RedHat. 1. First confirm the Hadoop and hive versions. For details, refer to h.

Build Hive environment under RedHat

1. Check the Hadoop and hive versions as follows:
Hive-0.10.0 corresponds to Hadoop 0.20.x, 0.23.x.y, 1. x. y, 2. x. y

Hive-0.9.0 corresponds to Hadoop 0.20.x and 1.x

Hive-0.8.1 corresponds to Hadoop0.20.1 and 0.20.2

2. Download necessary software
Hadoop-1.1.1.tar.gz

Hive-0.10.0.tar.gz

JDK1.6

Mysql-connector-java-5.1.18-bin.jar

3. Install and set Environment Variables
Create a system user uhive

Install JDK

Unzip hadoop and hive to the root path of the uhive user.

Configure Environment Variables

Add the following information to the. bash_profile file under the root path of user uhive:

ExportJAVA_HOME =/home/weblogic/jdk160_14_R27.6.5-32/jre

Export HADOOP_HOME =/home/uhive/hadoop

Export HIVE_HOME =/home/uhive/hive

Export HIVE_CONF_DIR = $ HIVE_HOME/conf

Export HIVE_LIB = $ HIVE_HOME/lib

ExportCLASSPATH = $ HIVE_HOME/lib: $ JAVA_HOME/jre/lib: $ HADOOP_HOME

ExportPATH = $ HIVE_HOME/bin: $ HADOOP_HOME/bin: $ JAVA_HOME/bin:/sbin/:/bin: $ PATH

The jdk path is subject to the personal installation path;

Copy the mysql-connector-java-5.1.18-bin.jar file to the $ HIVE_HOME/lib path;

Establish a Distributed File System

/Home/uhive/hadoop/bin/hadoop fs-ls/home/uhive/fsdir

Create a mysql user

Mysql> create user 'hive' identified by 'hive ';

Mysql> grant all privileges on *. * to 'hive' @ '%' with grant option;

Mysql> grant all privileges on *. * to 'hive' @ 'localhost' with grant option;

Mysql> update mysql. user setpassword = password ('hive') where User = "hive" andHost = "localhost ";

Mysql> flush privileges;

Mysql> create database hive;

Modify the configuration file

Go to the $ HIVE_HOME/conf directory and run the following command:

Cp hive-default.xml.template hive-default.xml

Cp hive-exec-log4j.properties.template hive-exec-log4j.properties

Cp hive-log4j.properties.template hive-log4j.properties

Path home/uhive/fsdir

Create a file hive-site.xml with the following content:

  Hive. metastore. local

  True

  Javax. jdo. option. ConnectionURL

  Jdbc: mysql: // localhost: 3306/hive? CreateDatabaseIfNotExist = true

  Javax. jdo. option. ConnectionDriverName

  Com. mysql. jdbc. Driver

  Javax. jdo. option. ConnectionUserName

  Hive

  Javax. jdo. option. ConnectionPassword

  Hive

  Datanucleus. fixedDatastore

  False

  Hive. metastore. warehouse. dir

  /Home/uhive/fsdir/warehouse

  Location of default database for thewarehouse

Ø use verification

A. Use hive to enter the command line. If the following information appears:

WARNING: org. apache. hadoop. metrics. jvm. EventCounter is deprecated. Please useorg. apache. hadoop. log. metrics. EventCounter in all the log4j. properties files

Modify the value of log4j. appender. EventCounter in the hive-log4j.properties to org. apache. hadoop. log. metrics. EventCounter

B. create table hwz2 (id int, name string) rowformat delimited FIELDS TERMINATED ',';

C. load data local inpath'/home/uhive/testdir/hwz2.txt 'overwrite into table hwz2;

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.