hive 安装教程

时间:2023-03-09 04:08:13
hive 安装教程

1. 下载hadoop-1.2.1-bin.tar.gz

解压,修改名称为hive

mv 到 /opt/hive

2.配置hive

cp hive-default.xml.template hive-site.xml

修改hive-site.xml

hive 安装教程

cp hive-log4j.properties.template hive-log4j.properties

修改hive-env.sh,配置环境变量

hive 安装教程

3.安装mysql

sudo yum install mysql-server

修改root 密码

mysqld admin -uroot password root

创建hive用户

mysql>create user 'hive'@'localhost' identfied by 'hive';

赋予hive 全部权限

mysql>grant privileges on *.* to hive@localhost ;

刷新

mysql>flush privileges;

登录hive,然后创建hive 数据库

mysql>create database hive;

4.创建hdfs 目录

hive 默认数据库配置目录为 /user/hive/warehouse

创建/user/hive/warehouse

hadoop fs -mkdir -p /user/hive/warehouse

更新权限

hadoop fs -chmod g+w /user/hive/warehouse

创建 /tmp/hive

hadoop fs -chmod 777 /tmp/hive

5.添加hive环境变量

vi  ~/.bashrc

export PATH=$PATH:/opt/hive/bin

source ~/.bashrc

5.使用hive

>hive

hive>create table test(id int ,name string);

附图:hive 运行UDAF

hive 安装教程