Hive的安装步骤

安装Mysql

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

<property>
    <name>javax.jdo.option.ConnectionURLname>
    <value>jdbc:mysql://node001:3306/hive?createDatabaseIfNotExist=truevalue>
property>
<property>
    <name>javax.jdo.option.ConnectionDriverNamename>
    <value>com.mysql.jdbc.Drivervalue>
property>
<property>
    <name>javax.jdo.option.ConnectionUserNamename>
    <value>rootvalue>
property>
<property>
    <name>javax.jdo.option.ConnectionPasswordname>
    <value>123456value>
property>
<property>
    <name>hive.querylog.locationname>
    <value>/opt/hive/value>
property>
<property>
    <name>hive.exec.local.scratchdirname>
    <value>/opt/hive/value>
property>
<property>
    <name>hive.downloaded.resources.dirname>
    <value>/opt/hive/value>
property>

把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

你可能感兴趣的:(Study)