Hadoop Hive installation

1. Embedded mode installation

1. Download the Hive installation package
https://archive.apache.org/dist/hive/hive-1.2.1/
2. Upload it to /root/export/software/
rz apache-hive-1.2.1-bin.tar. gz
3. Unzip

tar apache-hive-1.2.1-bin.tar.gz -C /root/export/servers/
cd /root/export/servers/apache-hive-1.2.1-bin

4. Start

bin/hive

The effect is as follows:
insert image description here

5. Check the database

show databases;

insert image description here

Two: local mode installation

1. Install mysql online

yum install mysql mysql-server mysql-devel

# Append the following command:
insert image description here

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-server

# start mysql

service mysqld start/stop/status

Enter mysql;
set password:

use mysql;
Update user SET Password=PASSWORD('123456') Where User='root';

#Set to allow remote access

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

# refresh write

FLUSH PRIVILEGES;

2. Hive configuration
(1), modify the hive-env.sh configuration file, and configure hadoop environment variables

cd /root/export/servers/apache-hive-1.2.1-bin/conf/
cp hive-env.sh.template hive-env.sh

(2) Modify the hadoop directory

vim hive-env.sh
HADOOP_HOME=/root/export/servers/hadoop-2.7.4

(3), create hive-site.xml configuration

<configuration>
        <property>
                <name>javax.jdo.option.ConnectionURL</name>
                <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>
                <description>Mysql连接协议</description>
        </property>
                <property>
                <name>javax.jdo.option.ConnectionDriverName</name>
                <value>com.mysql.jdbc.Driver</value>
                <description>Mysql连接协议</description>
        </property>
        <property>
                <name>javax.jdo.option.ConnectionUserName</name>
                <value>root</value>
                <description>用户名</description>
        </property>
        <property>
                <name>javax.jdo.option.ConnectionPassword</name>
                <value>123456</value>
                <description>密码</description>
        </property>
</configuration>

(4), upload mysql-connector-java-5.1.32.jar to the bin directory of hive

cd /root/export/servers/apache-hive-1.2.1-bin/bin
rz mysql-connector-java-5.1.32.jar

Remarks after the installation is complete
: If you use the remote mode installation method, you only need to modify the localhost in the hive-site.xml configuration to have the MySQL service node IP, so that no matter what path the user uses to start the Hive client, they can access the same metadata information.

Guess you like

Origin blog.csdn.net/MortShi/article/details/131728004