hive部署

恩慈2年前技术文章897

安装前准备

修改环境变量

vi /etc/profile

 

添加内容如下:(hive节点都要执行)

export HIVE_HOME=/opt/hive

export PATH=$PATH:$HIVE_HOME/bin

 

source  /etc/profile

创建用户和用户组

groupadd hive

useradd -g hive hive

usermod -aG hadoop hive

安装hive

上传安装包并解压

tar -zxf apache-hive-3.1.3-bin.tar.gz -C /opt/

ln -s apache-hive-3.1.3-bin /opt/hive

 

上传驱动包

mysql-connector-java.jar

复制文件

scp -rp /opt/apache-hive-3.1.3-bin xxx.xxx.xxx.220:/opt/

ln -s /opt/apache-hive-3.1.3-bin /opt/hive

 

cp /usr/share/java/mysql-connector-java.jar /opt/hive/lib/

cp /opt/hadoop/share/hadoop/common/lib/guava-27.0-jre.jar /opt/hive/lib/

(复制完成后删除之前的guava)

 

cp alluxio-2.9.3-client.jar /opt/hive/lib/

 

创建文件并修改权限

hdfs dfs -mkdir -p  /user/hive/warehouse

hdfs dfs -mkdir /tmp

hdfs dfs -chmod g+w /tmp  /user/hive/warehouse

hdfs dfs -chmod 777  /user/hive/warehouse

 

mkdir /log/hive

mkdir /log/hadoop

chown -R hive:hadoop /opt/hive/

chown -R hive:hadoop /log/hive /log/hadoop

 

配置hive

修改hive-env.sh

vi /opt/hive/conf/hive-env.sh

 

添加如下内容:

export HADOOP_HOME=/opt/hadoop

export HIVE_LOG_DIR=/log/hive

 

export HIVE_HOME=/opt/hive

 

export HIVE_CONF_DIR=/opt/hive/conf

 

if [ "$SERVICE" = "hiveserver2" ] ; then

 

        HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Dhive.log.dir=/log/hive -Dhive.log.file=hiveserver2.log -Dcom.sun.management.jmxremote.authenticate=false    -Dcom.sun.management.jmxremote.ssl=false    -Dcom.sun.management.jmxremote.local.only=false  -Dcom.sun.management.jmxremote.port=9611   -javaagent:/opt/prometheus/jmx_prometheus_javaagent-0.3.1.jar=9511:/opt/prometheus/hiveserver2.yml"

 

fi

 

if [ "$SERVICE" = "metastore" ] ; then

 

        HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Dhive.log.dir=/log/hive -Dhive.log.file=metastore.log -Dcom.sun.management.jmxremote.authenticate=false    -Dcom.sun.management.jmxremote.ssl=false    -Dcom.sun.management.jmxremote.local.only=false  -Dcom.sun.management.jmxremote.port=9606   -javaagent:/opt/prometheus/jmx_prometheus_javaagent-0.3.1.jar=9506:/opt/prometheus/hive_metastore.yml"

 

fi

 

export HIVE_AUX_JARS_PATH=/opt/hive/lib/alluxio-2.9.3-client.jar:${HIVE_AUX_JARS_PATH}

启动服务

初始化

创建hive元数据库,连接mysql数据库

create database metastore;

create user 'hive'@'%' identified by 'xxxxxxxx';

grant all privileges on metastore.* to 'hive'@'%' ;

 

cd /opt/hive/bin

schematool -dbType mysql -initSchema

启动服务

su - hive

$HIVE_HOME/bin/hive --service hiveserver2 > /log/hive/hiveserver2.log 2>&1 &

$HIVE_HOME/bin/hive --service metastore> /log/hive/metastore.log 2>&1 &

 


相关文章

Ldap部署

安装ldapyum -y install openldap compat-openldap openldap-clients openldap-servers openldap-servers-sql...

Hive3 on spark 集成

Hive3 on spark 集成

前置条件hadoop yarn环境正常oracle jdk 1.8版本1、spark2 下载准备https://archive.apache.org/dist/spark/spark-2.4.5/sp...

Hdfs3.x新特性详解

Hdfs3.x新特性详解

HDFS Disk Balancer(磁盘均衡器)HDFS Disk Balancer与HDFS Balancer的区别?两者都是实现负载均衡功能HDFS Balancer是之前Hadoop2.x中本...

Phoenix 安装使用文档

Phoenix 安装使用文档

Phoenix 安装使用文档下载Phoenix直接到Phoenix官网下载安装包,官网地址为:http://mirror.bit.edu.cn/apache/phoenix/备注:Phoenix 版本...

Dockerfile编写指南

Dockerfile编写指南

一、背景  在k8s提出抛弃docker,拥抱其他的cri插件的情况下,为什么还有这篇指南呢?首先Dockerfile作为容器打包的标准,已经存在了很多年了。其中的编写技巧到现在也是一直延续的,所以并...

企业级大数据安全架构(六)

企业级大数据安全架构(六)

本节详细介绍企业级大数据架构中的第六部分,数据授权和审计管理1.Ranger简介Apache Ranger是一款被设计成全面掌管Hadoop生态系统的数据安全管理框架,为Hadoop生态系统...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。