欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

Hive的安装步骤

程序员文章站 2022-04-26 18:50:05
mysql">安装Mysql yum安装Mysql yum -y install mysql-server 启动Mysql Service服务 service mysqld s...

yum安装Mysql

yum -y install mysql-server

启动Mysql Service服务

service mysqld start

加入到开机启动项

chkconfig mysqld on

创建用户并赋予权限

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; 
delete from mysql.user where host != '%'; 
flush privileges; 

重新登录Mysql

mysql -u root -p

Hive安装

解压Hive

tar -zxvf apache-hive-2.1.0-bin.tar.gz

配置环境变量

vi ~/.bash_profile 
export HIVE_HOME=/home/apache-hive-1.2.1-bin
export PATH=$PATH:HIVE_HOME/bin

修改hive-env.sh

export JAVA_HOME=/usr/java/jdk1.7.0_67
export HADOOP_HOME=/home/hadoop-2.6.5
export HIVE_HOME=/home/apache-hive-1.2.1-bin

修改hive-site.xml


    javax.jdo.option.ConnectionURL
    jdbc:mysql://node001:3306/hive?createDatabaseIfNotExist=true

    javax.jdo.option.ConnectionDriverName
    com.mysql.jdbc.Driver

    javax.jdo.option.ConnectionUserName
    root

    javax.jdo.option.ConnectionPassword
    123456

    hive.querylog.location
    /opt/hive/

    hive.exec.local.scratchdir
    /opt/hive/

    hive.downloaded.resources.dir
    /opt/hive/

把JDBC驱动包放到Hive lib目录下

让hadoop的jline包和hive的 jline包版本保持一致(高版本替换低版本)

cd /home/apache-hive-1.2.1-bin/lib/
cp jline-2.12.jar /home/hadoop-2.6.5/share/hadoop/yarn/lib/
cd /home/hadoop-2.6.5
rm -f jline-0.9.94.jar 

启动Hive