Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Hive installation

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Hive can only be installed on one node

1. Upload tar package

two。 Decompression

Tar-zxvf hive-0.9.0.tar.gz-C / cloud/

3. Install the mysql database (switch to root users) (there is no limit where to install it, only nodes that can connect to the hadoop cluster)

Mysql installation is for reference only. Different versions of mysql have their own installation process.

Rpm-qa | grep mysql

Rpm-e mysql-libs-5.1.66-2.el6_3.i686-- nodeps

Rpm-ivh MySQL-server-5.1.73-1.glibc23.i386.rpm

Rpm-ivh MySQL-client-5.1.73-1.glibc23.i386.rpm

Change the password of mysql

/ usr/bin/mysql_secure_installation

(note: delete anonymous users and allow users to connect remotely)

Log in to mysql

Mysql-u root-p

4. Configure hive

(a) configure the HIVE_HOME environment variable vi conf/hive-env.sh to configure the $hadoop_home in it

(B) configure Metabase information vi hive-site.xml

Add the following:

Javax.jdo.option.ConnectionURL

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

JDBC connect string for a JDBC metastore

Javax.jdo.option.ConnectionDriverName

Com.mysql.jdbc.Driver

Driver class name for a JDBC metastore

Javax.jdo.option.ConnectionUserName

Root

Username to use against metastore database

Javax.jdo.option.ConnectionPassword

Root

Password to use against metastore database

5. After installing hive and mysq, copy the connection jar package of mysql to the $HIVE_HOME/lib directory

If there is a problem with no permissions, authorize on mysql (execute on the machine where mysql is installed)

Mysql-uroot-p

# (execute the following statement *. *: all tables under all libraries%: any IP address or host can connect)

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

FLUSH PRIVILEGES

6. For the problem of inconsistent version of Jline package, you need to copy the jar package of jline.2.12.jar in the lib directory of hive and replace the one in hadoop.

/ home/hadoop/app/hadoop-2.6.4/share/hadoop/yarn/lib/jline-0.9.94.jar

Start hive

Bin/hive

-

6. Create a table (internal table by default)

Create table trade_detail (id bigint, account string, income double, expenses double, time string) row format delimited fields terminated by't'

Build partition table

Create table td_part (id bigint, account string, income double, expenses double, time string) partitioned by (logdate string) row format delimited fields terminated by'\ t'

Build an external table

Create external table td_ext (id bigint, account string, income double, expenses double, time string) row format delimited fields terminated by'\ t 'location' / td_ext'

7. Create a partition table

The difference between a regular table and a partition table: a partition table needs to be built if there is a large increase in data.

Create table book (id bigint, name string) partitioned by (pubdate string) row format delimited fields terminated by

Partition table load data

Load data local inpath'. / book.txt' overwrite into table book partition (pubdate='2010-08-22')

Load data local inpath'/ root/data.am' into table beauty partition (nation= "USA")

Select nation, avg (size) from beauties group by nation order by avg (size)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report