HIVE学习(待更新)
1 安装hive

下载
http://mirrors.shu.edu.cn/apache/hive/hive-1.2.2/,红框中的不需要编译。
由于hive是默认将元数据保存在本地内嵌的 Derby 数据库中,但是这种做法缺点也很明显,Derby不支持多会话连接,因此本文将选择mysql作为元数据存储。
安装mysql
yum安装mysql wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm yum -y install mysql57-community-release-el7-.noarch.rpm yum -y install mysql-community-server 启动MySQL
systemctl start mysqld.service
查看MySQL运行状态
systemctl status mysqld.service mysql -uroot -p # 回车后会提示输入密码
此时MySQL已经开始正常运行,不过要想进入MySQL还得先找出此时root用户的密码,通过如下命令可以在日志文件中找出密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
12345 具体请参考
https://www.cnblogs.com/brianzhu/p/8575243.html

tar -zxvf apache-hive-1.2.3-bin.tar.gz 后的内容如下,进入到conf

cp hive-default.xml.template hive-site.xml
编辑文件hive-site.xml
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<configuration>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>xxxx</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>xxxx</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>mysql
<value>jdbc:mysql://hostIP:3306/hive?createDatabaseIfNotExist=true&useSSL=false&nullNamePatternMatchesAll=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
</configuration>
复制mysql的驱动程序到hive/lib下面
2 hive启动方式
运行hive之前首先要确保meta store服务已经启动, nohup hive --service metastore > metastore.log >& & 如果需要用到远程客户端(比如 Tableau)连接到hive数据库,还需要启动hive service nohup hive --service hiveserver2 > hiveserver2.log >& & [sms@gc64 conf]$ hive --help
Usage ./hive <parameters> --service serviceName <service parameters>
Service List: beeline cli help hiveburninclient hiveserver2 hiveserver hwi jar lineage metastore metatool orcfiledump rcfilecat schemaTool version
Parameters parsed:
--auxpath : Auxillary jars
--config : Hive configuration directory
--service : Starts specific service/component. cli is default
Parameters used:
HADOOP_HOME or HADOOP_PREFIX : Hadoop install directory
HIVE_OPT : Hive options
For help on a particular service:
./hive --service serviceName --help
Debug help: ./hive --debug --help
hive2.0一下没有web查看
[sms@gc64 ~]$ hive Logging initialized using configuration in jar:file:/home/sms/app/apache-hive-1.2.-bin/lib/hive-common-1.2..jar!/hive-log4j.properties
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
hive>
>
>
> show databases;
OK
default
Time taken: 1.285 seconds, Fetched: row(s)
hive>
>
>
>
>
>
>
>
>
>
from pyspark.sql import HiveContext,Row
from pyspark import SparkConf, SparkContext
conf = SparkConf().setMaster("local").setAppName("count")
sc = SparkContext(conf=conf)
hiveCtx=HiveContext(sc)
hiveCtx.sql("show tables").show()
hiveCtx.sql("select count(1) from (select msid from raw_data group by msid) a").show()
HIVE学习(待更新)的更多相关文章
- hive学习
大数据的仓库Hive学习 10期-崔晓光 2016-06-20 大数据 hadoop 10原文链接 我们接着之前学习的大数据来学习.之前说到了NoSql的HBase数据库以及Hadoop中 ...
- [转]实现Hive数据同步更新的shell脚本
引言: 上一篇文章<Sqoop1.4.4 实现将 Oracle10g 中的增量数据导入 Hive0.13.1 ,并更新Hive中的主表>http://www.linuxidc.com/Li ...
- hive学习笔记之六:HiveQL基础
欢迎访问我的GitHub https://github.com/zq2599/blog_demos 内容:所有原创文章分类汇总及配套源码,涉及Java.Docker.Kubernetes.DevOPS ...
- Hive学习路线图(转)
Hadoophivehqlroadmap学习路线图 1 Comment Hive学习路线图 Hadoop家族系列文章,主要介绍Hadoop家族产品,常用的项目包括Hadoop, Hive, Pig ...
- 【转】Hive学习路线图
原文博客出自于:http://blog.fens.me/hadoop-hive-roadmap/ 感谢! Hive学习路线图 Hadoop家族系列文章,主要介绍Hadoop家族产品,常用的项目包括Ha ...
- Hive学习之六 《Hive进阶— —hive jdbc》 详解
接Hive学习五 http://www.cnblogs.com/invban/p/5331159.html 一.配置环境变量 hive jdbc的开发,在开发环境中,配置Java环境变量 修改/etc ...
- Hive学习路线图--张丹老师
前言 Hive是Hadoop家族中一款数据仓库产品,Hive最大的特点就是提供了类SQL的语法,封装了底层的MapReduce过程,让有SQL基础的业务人员,也可以直接利用Hadoop进行大数据的操作 ...
- Hive学习 系列博客
原 Hive作业优化 原 Hive学习六:HIVE日志分析(用户画像) 原 Hive学习五--日志案例分析 原 Hive学习三 原 Hive学习二 原 Hive学习一 博客来源,https://blo ...
- hive学习路线
hive学习路线图:
- Hive学习之修改表、分区、列
Hive学习之修改表.分区.列 https://blog.csdn.net/skywalker_only/article/details/30224309 https://www.cnblogs.co ...
随机推荐
- python16_day25【crm】
一.CRM模拟admin功能 1.过滤功能 2.显示数据分页 3.动态菜单 项目:https://github.com/willianflasky/growup/tree/master/s16/hom ...
- CSS实现文本超过指定长度显示省略号
<style type="text/css"> li { width:200px;/*宽度,超过即会溢出*/ line-height:25px;/*设置行间距*/ te ...
- Linux系统——NFS网络文件系统
在企业集群架构的工作场景中,NFS网络文件系统一般被用来存储共享视频,图片,附件等静态资源文件,通常网站用户上传的文件都会放到NFS共享里,然后前端所有的节点访问这些静态资源时都会读取NFS存储上的资 ...
- [Windows Powershell]-学习笔记(1)
Powershell 快捷键 Powershell的快捷键和cmd,linux中的shell,都比较像. ALT+F7 清除命令的历史记录 PgUp PgDn 显示当前会话的第 ...
- jar打包方法使用整理
dos窗口下操作jar:(JDK的命令) jar命令能够把Java应用打包成一个文件,这个文件的扩展名为.jar,称为JAR文件.JAR 文件非常类似 ZIP 文件.准确的说,它就是 ZIP 文件,所 ...
- 后缀自动机模板 SAM
一点疑问: 当创建nq节点时,要不要把nq的cnt标记赋值为1? 讲道理nq节点也是代表一个子串啊,不过网上的模板都没赋值. 2017.9.18 update: 把memset部分重写,改成用节点用到 ...
- PHP开发之apache mac上配置
我使用的Mac OS X版本是10.8.2,Mac自带了Apache环境. 启动Apache 设置虚拟主机 启动Apache 打开“终端(terminal)”,输入 sudo apachectl -v ...
- 【Python】高阶函数
filter def is_palindrome(n): L = str(n) i = 0 j = len(L) - 1 while i != j: if L[i] != L[j]: return F ...
- KVM网络性能调优
首先,我给大家看一张图,这张图是数据包从虚拟机开始然后最后到物理网卡的过程. 我们分析下这张图,虚拟机有数据包肯定是先走虚拟机自身的那张虚拟网卡,然后发到中间的虚拟化层,再然后是传到宿主机里的内核网桥 ...
- jz2440使用openjtag+openocd+eclipse调试【学习笔记】
平台:jz2440 作者:庄泽彬(欢迎转载,请注明作者) 说明:韦东山二期视频学习笔记 交叉编译工具:arm-linux-gcc (GCC) 3.4.5 eclipse版本:eclipse-cpp-l ...