hadoop生态搭建(3节点)-07.hive配置
# http://archive.apache.org/dist/hive/hive-2.1.1/
# ==================================================================安装 hive
tar -zxvf apache-hive-2.1.1-bin.tar.gz -C /usr/local
mv /usr/local/apache-hive-2.1.1-bin /usr/local/hive-2.1.1
rm –r ~/apache-hive-2.1.1-bin.tar.gz cp ~/mysql-connector-java-5.1.46.jar /usr/local/hive-2.1.1/lib/
# 配置环境变量
# ==================================================================node1 node2 node3
vi /etc/profile # 在export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL下添加
export JAVA_HOME=/usr/java/jdk1.8.0_111
export ZOOKEEPER_HOME=/usr/local/zookeeper-3.4.12
export HADOOP_HOME=/usr/local/hadoop/hadoop-2.7.6
export MYSQL_HOME=/usr/local/mysql
export HBASE_HOME=/usr/local/hbase-1.2.4
export HIVE_HOME=/usr/local/hive-2.1.1 export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$ZOOKEEPER_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$MYSQL_HOME/bin:$HBASE_HOME/bin:$HIVE_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export HADOOP_INSTALL=$HADOOP_HOME
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
# ==================================================================node1
# 使环境变量生效
source /etc/profile # 查看配置结果
echo $HIVE_HOME mkdir -p $HIVE_HOME/data/hive
mkdir -p $HIVE_HOME/data/hive/operaion_logs
mkdir -p $HIVE_HOME/data/resources # 配置 hive
cp $HIVE_HOME/conf/hive-env.sh.template $HIVE_HOME/conf/hive-env.sh
cp $HIVE_HOME/conf/hive-default.xml.template $HIVE_HOME/conf/hive-site.xml
cp $HIVE_HOME/conf/hive-exec-log4j2.properties.template $HIVE_HOME/conf/hive-exec-log4j2.properties
cp $HIVE_HOME/conf/hive-log4j2.properties.template $HIVE_HOME/conf/hive-log4j2.properties
# ${system:java.io.tmpdir}/${system:user.name} 替换为本机路径 /usr/local/hive-2.1.1/data/hive
# ${system:java.io.tmpdir}/${hive.session.id}_resources替换为本机路径 /usr/local/hive-2.1.1/data/resources
# ${system:java.io.tmpdir}/${system:user.name}/operation_logs 替换为本机路径 /usr/local/hive-2.1.1/data/hive/operation_logs
vi $HIVE_HOME/conf/hive-site.xml
# esc 后输入
:%s#${system:java.io.tmpdir}/${system:user.name}#/usr/local/hive-2.1.1/data/hive#
:%s#${system:java.io.tmpdir}/${hive.session.id}_resources#/usr/local/hive-2.1.1/data/resources#
# esc / 输入 hive.exec.scratchdir 找到后<value> 点击 Insert 键后进行修改
<property>
<name>hive.exec.scratchdir</name>
<value>/hive/tmp</value>
</property> <property>
<name>hive.metastore.warehouse.dir</name>
<value>/hive/warehouse</value>
</property> <!-- 通过jdbc协议连接mysql的hive库 -->
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://node1:3306/hive?createDatabaseIfNotExist=true&useSSL=false</value>
</property> <!-- jdbc的mysql驱动 -->
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property> <!-- mysql用户名 -->
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
</property> <!-- mysql用户密码 -->
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>Hive-123</value>
</property> <!--hiveserver2的HA-->
<property>
<name>hive.server2.support.dynamic.service.discovery</name>
<value>true</value>
</property> <property>
<name>hive.zookeeper.quorum</name>
<value>node1:2181,node2:2181,node3:2181</value>
</property> <!-- hive的web页面暂时不配置 -->
<property>
<name>hive.hwi.war.file</name>
<value>/usr/local/hive-2.1.1/lib/hive-hwi-2.1.1.jar</value>
</property>
# 从hbase/lib下复制必要jar包到hive/lib下
cp $HBASE_HOME/lib/hbase-client-1.2.4.jar $HBASE_HOME/lib/hbase-common-1.2.4.jar $HIVE_HOME/lib # 同步hive和hadoop的jline版本
cp $HIVE_HOME/lib/jline-2.12.jar $HADOOP_HOME/share/hadoop/yarn/lib # 查看版本
# cd $HADOOP_HOME/share/hadoop/yarn/lib
# find ./ -name "*jline*jar" # 删除低版本的jline 0.9
# rm jline-0.9.94.jar # 复制jdk的tools.jar到hive/lib下
cp $JAVA_HOME/lib/tools.jar $HIVE_HOME/lib # rm -f $HIVE_HOME/lib/log4j-slf4j-impl-2.4.1.jar vi $HIVE_HOME/conf/hive-env.sh HADOOP_HOME=/usr/local/hadoop-2.7.6
export HIVE_HOME=/usr/local/hive-2.1.1
export HIVE_CONF_DIR=/usr/local/hive-2.1.1/conf
export HIVE_AUX_JARS_PATH=/usr/local/hive-2.1.1/lib
# 如果hadoop之前没有配置hadoop.proxyuser.root.groups需配置
# ==================================================================node1 node2 node3
# 如果没有权限,在Hadoop的core-site.xml中增加配置:
vi $HADOOP_HOME/etc/hadoop/core-site.xml <property>
<name>hadoop.proxyuser.root.groups</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.root.hosts</name>
<value>*</value>
</property> # ==================================================================node1
# 使用超级用户刷新配置
yarn rmadmin -refreshSuperUserGroupsConfiguration
hdfs dfsadmin -refreshSuperUserGroupsConfiguration # ==================================================================node1 node2
# 如果是对namenode做过HA,则需要在主备namenode上执行
hdfs dfsadmin -fs hdfs://appcluster -refreshSuperUserGroupsConfiguration
# ==================================================================node2 node3
# 使环境变量生效
source /etc/profile # 查看配置结果
echo $HIVE_HOME
# ==================================================================node1
$HIVE_HOME/bin/schematool -initSchema -dbType mysql scp -r $HIVE_HOME node2:/usr/local/
scp -r $HIVE_HOME node3:/usr/local/
# 启动
# ==================================================================node1 node2 node3
# 启动 zookeeper
zkServer.sh start
zkServer.sh status # ==================================================================node1
# 启动hadoop所有进程
$HADOOP_HOME/sbin/start-all.sh $HADOOP_HOME/sbin/hadoop-daemon.sh start zkfc # ==================================================================node2
$HADOOP_HOME/sbin/yarn-daemon.sh start resourcemanager
$HADOOP_HOME/sbin/hadoop-daemon.sh start zkfc # ==================================================================node1
# 要实现Hbase的HA(High Availablity)
$HBASE_HOME/bin/hbase-daemon.sh start master # 启动Hbase(start-hbase.sh)
$HBASE_HOME/bin/start-hbase.sh # ==================================================================node2
# 开启Hbase的HA
$HBASE_HOME/bin/hbase-daemon.sh start master # ==================================================================node1
$HIVE_HOME/bin/hiveserver2 # ==================================================================node2
$HIVE_HOME/bin/hiveserver2 # ==================================================================node1
zkCli.sh ls /hiveserver2 get /hiveserver2/serverUri=node1:10000;version=2.1.1;sequence=0000000000 $HIVE_HOME/bin/beeline -u "jdbc:hive2://node1:2181,node2:2181,node3:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2" root 123456 # $HIVE_HOME/bin/beeline
# > !connect jdbc:hive2://node1:2181,node2:2181,node3:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2 root "123456" > create external table user_info(user_id int comment 'userID',user_name string comment 'userName')row format delimited fields terminated by '\t' lines terminated by '\n'; > show tables; mkdir /root/hive vi /root/hive/user_info.txt 1001 zhangsan
1002 lisi
1003 wangwu > load data local inpath '/root/hive/user_info.txt' into table user_info; > select * from user_info; > quit; hdfs dfs -ls / hdfs dfs -ls /hive/warehouse hdfs dfs -cat /hive/warehouse/user_info/user_info.txt hadoop fs -mkdir /hive_input_data vi /root/hive/user_info.txt 1001 zhangsan
1002 lisi
1003 wangwu
1004 liuliu
1005 qiqi hadoop fs -put /root/hive/user_info.txt /hive_input_data hdfs dfs -ls /hive_input_data # hdfs -dfs -chmod 777 /hive_input_data > select * from user_info; > load data inpath '/hive_input_data/user_info.txt' overwrite into table user_info; > select * from user_info; # ==================================================================node1
# stop已经启动的进程
$HBASE_HOME/bin/stop-hbase.sh $HADOOP_HOME/sbin/stop-all.sh # ==================================================================node1 node2 node3
# 停止 zookeeper
zkServer.sh stop # ==================================================================node1
$HADOOP_HOME/sbin/hadoop-daemon.sh stop zkfc # ==================================================================node2
$HADOOP_HOME/sbin/yarn-daemon.sh stop resourcemanager
$HADOOP_HOME/sbin/hadoop-daemon.sh stop zkfc shutdown -h now
# 快照 hive_hiveserver2集群
hadoop生态搭建(3节点)-07.hive配置的更多相关文章
- hadoop生态搭建(3节点)
软件:CentOS-7 VMware12 SSHSecureShellClient shell工具:Xshell 规划 vm网络配置 01.基础配置 02.ssh配置 03.zookeep ...
- hadoop生态搭建(3节点)-08.kafka配置
如果之前没有安装jdk和zookeeper,安装了的请直接跳过 # https://www.oracle.com/technetwork/java/javase/downloads/java-arch ...
- hadoop生态搭建(3节点)-04.hadoop配置
如果之前没有安装jdk和zookeeper,安装了的请直接跳过 # https://www.oracle.com/technetwork/java/javase/downloads/java-arch ...
- hadoop生态搭建(3节点)-09.flume配置
# http://archive.apache.org/dist/flume/1.8.0/# ===================================================== ...
- hadoop生态搭建(3节点)-10.spark配置
# https://www.scala-lang.org/download/2.12.4.html# ================================================= ...
- hadoop生态搭建(3节点)-13.mongodb配置
# 13.mongodb配置_副本集_认证授权# ==================================================================安装 mongod ...
- hadoop生态搭建(3节点)-15.Nginx_Keepalived_Tomcat配置
# Nginx+Tomcat搭建高可用服务器名称 预装软件 IP地址Nginx服务器 Nginx1 192.168.6.131Nginx服务器 Nginx2 192.168.6.132 # ===== ...
- hadoop生态搭建(3节点)-17.sqoop配置_单节点
# ==================================================================安装 sqoop tar -zxvf ~/sqoop-1.4.7 ...
- hadoop生态搭建(3节点)-03.zookeeper配置
# https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html # ===== ...
随机推荐
- 【Linux】 Linux编程规范&Linux 编程环境搭建
一.通过Samba映射网络驱动器 菜单栏-计算机-映射网络驱动器 English 菜单栏-Home -Easy access-Map as drive 编辑代码使用 Windows 编译 运行程序在 ...
- Linux --远程访问控制
1.SSH服务端 修改配置文件 vi /etc/ssh/sshd_config 监听选项 port 22 //监听端口地址 ListenAddress 192.168.1.50 //监听地址为本机地址 ...
- 二、Python安装扩展库
第一步:推荐easy_install工具 下载地址:https://pypi.python.org/pypi/setuptools 下载"ez_setup.py"文件; 通过运行c ...
- KMP算法的工作流程介绍
最近又想起了KMP算法,原来一直没搞明白工作原理,现在总算是开点窍了,推荐大家看这篇文章,写的很简单易懂 推荐理由:简单明了,是我看过介绍KMP算法流程的所有文章中,最易懂的一篇(这篇文章仅仅是介绍了 ...
- 别跑了,看看脚下有木有money
别跑了,看看脚下有木有money 1.长大论坛 本来是想做个博客的,无奈级别不够,博客过于复杂,所以就做了这个类似于贴吧的东西.在这里,你可以发帖:可以吐槽学校.可以向他人寻求帮助.甚至可以 ...
- OC static 和函数
#include <stdio.h> // 定义一个one函数 // 完整地定义一个外部函数需要extern关键字 //extern void one() { // printf(&quo ...
- [转]Ubuntu 配置 Android 开发 环境
转自:http://blog.csdn.net/shulianghan/article/details/20855541 1. 安装 Android Studio (1) 下载Android Stud ...
- Android进阶笔记09:Android 万能适配器
1. Android 万能适配器 项目中Listview GridView几乎是必用的组件,Android也提供一套机制,为这些控件绑定数据,那就是Adapter.用起来虽然还不错,但每次都 ...
- [18/12/01]super 关键字和final 关键字
一.super 关键字 1.super是直接父类对象的引用.可以通过super来访问父类中被子类覆盖的方法或属性. 使用super调用普通方法,语句没有位置限制,可以在子类中随便调用. 代码示例: c ...
- FastJSON、Gson、Jackson(简单了解使用)
下载地址(maven) Jackson:http://mvnrepository.com/search?q=jackson FastJson:http://mvnrepository.com/sear ...