Hive简单部署

一、下载hive

1、/opt/software/目录下
weget http://archive.cloudera.com/cdh5/cdh/5/hive-1.1.0-cdh5.7.0.tar.gz

2、解压到/opt/app/路径下

[root@hadoop001 software]# tar -zxvf hive-1.1.0-cdh5.7.0.tar.gz -C /opt/app/

3、hive-1.1.0-cdh5.7.0即为解压后的文件

[root@hadoop001 app]# ls
2.6.0-cdh5.7.0  hive-1.1.0-cdh5.7.0

二、配置
1、进入/opt/app/hive-1.1.0-cdh5.7.0/conf目录,将hive-env.sh.template拷贝一份并命名为hive-env.sh

cp hive-env.sh.template  hive-env.sh

2、在hive-env.sh设置hadoop路径

# Set HADOOP_HOME to point to a specific hadoop install directory
 HADOOP_HOME=/opt/app/2.6.0-cdh5.7.0

3、在/opt/app/hive-1.1.0-cdh5.7.0/conf目录编辑,hive-site.xml

vim hive-site.xml

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration> 
    <property>
        <name>javax.jdo.option.ConnectionURL</name>
##将默认数据库derby更改为mysql,且启动hive时在mysql中自动创建hive数据库
        <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>
    </property>

    <property>
    #设置驱动连接名
        <name>javax.jdo.option.ConnectionDriverName</name>
        <value>com.mysql.jdbc.Driver</value>
    </property>

    <property>
    #mysql登录名
        <name>javax.jdo.option.ConnectionUserName</name>
        <value>root</value>
    </property>

    <property>
    #mysql密码
        <name>javax.jdo.option.ConnectionPassword</name>
        <value>root</value>
    </property>
</configuration>

三、将mysql驱动拷贝到hive/lib下

cp mysql-connector-java-5.1.39-bin.jar /opt/app/hive-1.1.0-cdh5.7.0/lib/

四、将hive配置到环境变量

[root@hadoop001 conf]# cat /etc/profile
export HIVE_HOME=/opt/app/hive-1.1.0-cdh5.7.0
export PATH=$HIVE_HOME/bin:$PATH

五、启动hive

[root@hadoop001 conf]# hive
which: no hbase in (/opt/app/hive-1.1.0-cdh5.7.0/bin:/bin:/opt/app/2.6.0-cdh5.7.0/bin:/usr/local/mysql/bin:/opt/software/findbugs-1.3.9/bin:/usr/local/protobuf/bin:/opt/software/maven-3.3.9/bin:/usr/java/jdk1.8/bin:/bin:/opt/sourcecode/hadoop/bin:/usr/local/mysql/bin:/opt/software/findbugs-1.3.9/bin:/usr/local/protobuf/bin:/opt/software/maven-3.3.9/bin:/usr/java/jdk1.8/bin:/bin:/opt/sourcecode/hadoop/bin:/usr/local/mysql/bin:/opt/software/findbugs-1.3.9/bin:/usr/local/protobuf/bin:/opt/software/maven-3.3.9/bin:/bin:/bin:/opt/sourcecode/hadoop/bin:/bin:/opt/software/findbugs-1.3.9/bin:/usr/local/protobuf/bin:/opt/software/maven-3.3.9/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin)

Logging initialized using configuration in jar:file:/opt/app/hive-1.1.0-cdh5.7.0/lib/hive-common-1.1.0-cdh5.7.0.jar!/hive-log4j.properties
WARNING: Hive CLI is deprecated and migration to Beeline is recommended.
hive>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值