大数据集群搭建(4)——Hive的安装

Hive安装

1.在/usr目录下新建tools目录,上传并解压文件

cd /usr

mkdir tools

cd tools

rz(选中上传准备好的hive安装包)

tar –zxvf apache-hive-2.0.0-bin.tar.gz

2.添加环境变量:

vi /etc/profile

#Hive

export HIVE_HOME=/usr/tools/apache-hive-2.3.3-bin

export PATH=$PATH:$HIVE_HOME/bin

保存后使其生效:

source /etc/profile

3.安装Mysql

详见mysql安装文档

https://blog.csdn.net/Copper01/article/details/84068953

4.配置hive

4.1.在hdfs中新建目录/user/hive/warehouse

hdfs dfs –mkdir /tmp

hdfs dfs –mkdir /user

hdfs dfs –mkdir /user/hive

hdfs dfs –mkdir /user/hive/warehouse

 4.2.更改目录的权限

hadoop fs -chmod g+w /tmp

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

4.3.将mysql的驱动jar包拷入hive的lib目录下面

4.4.进入conf目录,复制hive-default.xml.template并命名为:hive-site.xml

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

更改配置文件:(只需要更改标红的部分,其余为文件中本身拥有的)

    javax.jdo.option.ConnectionURL

    jdbc:mysql://127.0.0.1:3306/hive?createDatabaseIfNotExist=true&SSL=false

    JDBC connect string for a JDBC metastore

  

  

    javax.jdo.option.ConnectionDriverName

    com.mysql.jdbc.Driver

    Driver class name for a JDBC metastore

  

  

    javax.jdo.option.ConnectionUserName

    root

    Username to use against metastore database

  

  

    javax.jdo.option.ConnectionPassword

    123456

    password to use against metastore database

  

  

    hive.exec.local.scratchdir

    /usr/tools/apache-hive-2.0.0-bin/tmp

    Local scratch space for Hive jobs

  

  

    hive.downloaded.resources.dir

    /usr/tools/apache-hive-2.0.0-bin/tmp/resources

    Temporary local directory for added resources in the remote file system.

  

  

    hive.querylog.location

    /usr/tools/apache-hive-2.0.0-bin/tmp

    Location of Hive run time structured log file

  

  

    hive.server2.logging.operation.log.location

    /usr/tools/apache-hive-2.0.0-bin/tmp/operation_logs

    Top level directory where operation logs are stored if logging functionality is enabled

  

4.5.使用schematool 初始化metastore的schema:

schematool -initSchema -dbType mysql

5.运行hive

hive

你可能感兴趣的:(大数据集群搭建(4)——Hive的安装)