hive的安装

1、下载hive2.1-tar.gz

2、解压、创建软连接

$>tar -xzvf hive-2.1.0.tar.gz     //tar开                
$>ln -s hive-2.1.0 hive            //符号连接

3、配置环境变量

编辑[/etc/profile]追加hive环境变量
      export HIVE_HOME=/soft/hive
      export PATH=$PATH:$HIVE_HOME/bin

source /etc/profile   //立即生效

4、复制mysql驱动程序到hive的lib目录下

5、配置hive-site.xml
     复制hive-default.xml.template为hive-site.xml
     修改连接信息为mysql链接地址,将${system:...字样替换成具体路径。

     [hive/conf/hive-site.xml]

<property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>root</value>
    <description>password to use against metastore database</description>
</property>
<property>
    <name>javax.jdo.option.ConnectionUserName</name>
    <value>root</value>
    <description>Username to use against metastore database</description>
</property>
<property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://192.168.231.1:3306/hive2</value>
</property>
<property>
    <name>javax.jdo.option.ConnectionDriverName</name>
    <value>com.mysql.jdbc.Driver</value>
    <description>Driver class name for a JDBC metastore</description>
</property>

下面几个修改为具体路径
<property>
    <name>hive.exec.local.scratchdir</name>
    <value>/home/centos/hive</value>
    <description>Local scratch space for Hive jobs</description>
</property>
<property>
    <name>hive.downloaded.resources.dir</name>
    <value>/home/centos/hive/downloads</value>
    <description>Temporary local directory for added resources in the remote file system.</description>
</property>
<property>
    <name>hive.querylog.location</name>
    <value>/home/centos/hive/querylog</value>
    <description>Location of Hive run time structured log file</description>
</property>
<property>
    <name>hive.server2.logging.operation.log.location</name>
    <value>/home/centos/hive/server2_logs</value>
    <description>Top level directory where operation logs are stored if logging functionality is enabled</description>
</property>

6、在msyql中创建存放hive信息的数据库
      mysql>create database hive2 ;

7、初始化hive的元数据(表结构)到mysql中。

$>cd /soft/hive/bin
$>schematool -dbType mysql -initSchema

8、验证是否安装成功

$>hive --v

 

posted @ 2020-08-12 11:31  人间草木~  阅读(106)  评论(0编辑  收藏  举报