
Hive
hive
Knight_AL
这个作者很懒,什么都没留下…
展开
-
Hive的安装部署
Hive默认使用的元数据库为derby并且部署方式是内嵌式,在开启Hive之后就会独占元数据库,且不与其他客户端共享数据,如果想多窗口操作就会报错,操作比较局限。2)将/opt/software/目录下的apache-hive-3.1.2-bin.tar.gz到/opt/module/目录下面。3)启动hive服务(这里需要考虑元数据的访问方式,如何使用元数据服务的模式,需要提前开启元数据服务)(跨网络跨语言跨平台)1)执行/bin目录下的hive命令,就可以启动hive,并通过cli方式连接到hive。原创 2023-11-15 10:43:29 · 331 阅读 · 0 评论 -
Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
启动hive,查询时报错通过控制台的异常信息我们可以知道Hive的metadata服务未开启导致的。原创 2023-10-26 11:21:07 · 185 阅读 · 0 评论 -
org.apache.thrift.transport.TTransportException: Could not create ServerSocket on address 0.0.0.0/0.
重复启动了hive服务器进程,jps查看发现有RunJar进程存在,kill掉他即可。原创 2023-10-26 11:12:01 · 715 阅读 · 0 评论 -
Hive3.x安装部署
目录Hive安装部署Hive元数据配置到MySql拷贝驱动配置Metastore到MySql启动Hive初始化元数据库启动metastore和hiveserver2Hive安装部署1)把apache-hive-3.1.2-bin.tar.gz上传到linux的/opt/software目录下2)解压apache-hive-3.1.2-bin.tar.gz到/opt/module/目录下面tar -zxvf /opt/software/apache-hive-3.1.2-bin.tar.gz -C /原创 2021-08-23 21:25:42 · 739 阅读 · 0 评论 -
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;L
安装hive的时候,进行到初始化hive源数据的时候,报错:schematool -initSchema -dbType mysql --verboseException in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V at org.apache.hadoop.conf.Conf原创 2021-07-26 18:01:45 · 1600 阅读 · 0 评论 -
java.lang.ClassNotFoundException: org.apache.hive.service.rpc.thrift.TCLIService$Iface
java.lang.ClassNotFoundException: org.apache.hive.service.rpc.thrift.TCLIService$Iface at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(L原创 2021-03-16 22:07:11 · 5946 阅读 · 3 评论 -
hive中reflect的用法
编写java代码public class Reflect { public static String addInfo(String info){ return info+"-hive"; }}然后进行打包,上传到集群测试select reflect(‘参数一’,‘参数二’,‘参数三’);参数一:全类名参数二:方法名参数三:需要的数据...原创 2021-03-01 21:17:05 · 711 阅读 · 0 评论 -
Datagrip连接hive数据库
目录datagrip连接Hive客户端常用配置下载不起driver文件请看这里datagrip连接Hive客户端1)启动datagrip后的初始页面2)连接hive客户端3)启动hiveserver24)配置连接hive客户端参数5)显示hadoop102数据库6)显示控制台7)在控制台上选择操作hadoop102数据库常用配置1)进入配置页面2)修改字体大小通过鼠标滚动,设置字体大小。3)修改背景颜色为豆绿色下载不起driver文件请看这里解决方案点原创 2021-02-23 23:15:58 · 1115 阅读 · 1 评论 -
解决使用hive启动打印大量INFO日志问题
报错原因由于hbase和hive不匹配hbase2.3.4(最新的)和hive3.1.2解决方案hbase版本换低一点2.0.5查看效果没装hbase的时候安装hbase2.3.4启动安装hbase2.0.5启动原创 2021-02-22 18:46:03 · 5280 阅读 · 5 评论 -
hive parse_url函数的使用
常见的参数有:PROTOCOL,HOST,PATH,QUERY解析协议:hive > select parse_url('https://www.baidu.com/hzy?user_id=10000&platform=ios','PROTOCOL'); https 解析主机名:hive > select parse_url('https://www.baidu.com/hzy?user_id=10000&platform=ios','HOST'); www.b原创 2021-02-20 19:39:58 · 303 阅读 · 0 评论 -
hive什么时候用msck修复分区
举个例子创建分区表语法create table dept(name string,age int)partitioned by (month string)row format delimited fields terminated by '\t';插入数据方法load data local inpath '/export/data/dept.txt' into table default.dept partition(month='201709');Loading data to ta原创 2021-02-18 19:46:15 · 321 阅读 · 0 评论 -
FAILED: SemanticException Failed to get a spark session: org.apache.hadoop.hive.ql.metadata.HiveExce
FAILED: SemanticException Failed to get a spark session: org.apache.hadoop.hive.ql.metadata.HiveException: Failed to create Spark client due to invalid resource request: Required executor memory (2048), overhead (384 MB), and PySpark memory (0 MB) is above原创 2021-02-16 16:08:36 · 10379 阅读 · 0 评论 -
Fatal error occurred when node tried to create too many dynamic partitions. The maximum number of dy
Job failed with org.apache.hadoop.hive.ql.metadata.HiveFatalException: [Error 20004]: Fatal error occurred when node tried to create too many dynamic partitions. The maximum number of dynamic partitions is controlled by hive.exec.max.dynamic.partitions and原创 2021-02-15 21:10:23 · 859 阅读 · 0 评论 -
hive on spark编译
一.前置条件官网下载Spark源码Spark2.2.0版本文档地址:https://spark.apache.org/docs/2.4.5/必备条件:Maven requires Maven 3.5.4 and Java 8安装maven链接:https://pan.baidu.com/s/13sVa3Z6SktogXDlnNe89Yw 提取码:iuja 1.解压maven tar -zxvf apache-maven-3.6.1-bin.tar.gz -C /export/ser原创 2021-02-13 20:36:35 · 824 阅读 · 1 评论 -
hive和hadoop版本对应关系
hive和hadoop版本对应关系http://hive.apache.org/downloads.html原创 2021-02-12 13:54:57 · 5459 阅读 · 0 评论 -
Hive集合数据类型(STRUCK,MAP,ARRAY)
Hive有三种复杂数据类型ARRAY、MAP 和 STRUCT。ARRAY和MAP与Java中的Array和Map类似,而STRUCT与C语言中的Struct类似,它封装了一个命名字段集合,复杂数据类型允许任意层次的嵌套。案例实操1) 假设某表有如下一行,我们用JSON格式来表示其数据结构。在Hive下访问的格式为{ "name": "songsong", "friends": ["bingbing" , "lili"] , //列表Array, "childre原创 2020-12-08 19:59:40 · 954 阅读 · 0 评论 -
Hive-列转行(explode,lateral view)
1.函数说明EXPLODE(col):将hive一列中复杂的array或者map结构拆分成多行。LATERAL VIEW用法:LATERAL VIEW udtf(expression) tableAlias AS columnAlias解释:用于和split, explode等UDTF一起使用,它能够将一列数据拆成多行数据,在此基础上可以对拆分后的数据进行聚合。2.数据准备moviecategory《疑犯追踪》悬疑,动作,科幻,剧情《Lie to me》悬疑,警匪,原创 2020-11-21 18:00:38 · 1110 阅读 · 0 评论 -
Hive-(UDF和UDTF)
创建一个Maven工程Hive导入依赖<dependencies> <!-- https://mvnrepository.com/artifact/org.apache.hive/hive-exec --> <dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-exec</artifactId> <version&原创 2020-11-12 22:26:46 · 195 阅读 · 0 评论 -
Hive使用第三方的JDBC工具
我使用的idea连接hive你会遇到没有这个包,根据提示点击下载就行了,几分钟就可以了遇到的问题1.连接不起,主要版本好像至少3.1.22.是否在虚拟机上连接原创 2020-11-12 21:39:18 · 332 阅读 · 0 评论 -
如何在官网查看hive on spark兼容性问题
打开官方https://cwiki.apache.org/confluence/display/Hive/Homectrl+f搜索spark原创 2020-11-02 14:50:32 · 1014 阅读 · 0 评论 -
MetaException(message:Required table missing : “DBS“ in Catalog ““ Schema ““. DataNucleus requires t
2020-10-27 18:31:04: Starting Hive Metastore ServerMetaException(message:Required table missing : "DBS" in Catalog "" Schema "". DataNucleus requires this table to perform its persistence operations. Either your MetaData is incorrect, or you need to enabl原创 2020-10-28 11:33:45 · 2302 阅读 · 0 评论 -
Hive内部表和外部表的区别详讲
内部表和外部表区别元数据,原始数据删除数据时:内部表:元数据,原始数据全部删除外部表:只删除元数据在公司生产环境下,什么时候创建内部表,什么时候创建外部表?在公司中绝大多数场景都是外部表自己使用的临时表,才会创建内部表;测试理解创建内部表t1create table t1(name string,age int)row format delimited fields terminated by "/t";查看表的结构3.加载数据数据内容xiaoxin 5huya原创 2020-10-20 09:59:19 · 664 阅读 · 0 评论 -
hive中round、floor、ceil区别及用法
round(四舍五入)浮点数四舍五入:select round(1.4); 结果:1select round(1.6); 结果:2浮点数取两位小数:select round(1.04234,2); 结果:1.04select round(1.04634,2); 结果:1.05floor(向下取整)select floor(1.3); 结果:1ceil(向上取整)select ceil(1.3); 结果:2...原创 2020-10-17 21:57:31 · 1189 阅读 · 0 评论 -
Hive2.3的安装部署
安装Hive2.31)上传apache-hive-2.3.0-bin.tar.gz 到/opt/software目录下,并解压到/opt/module[donglin@hadoop102 software]$ tar -zxvf apache-hive-2.3.6-bin.tar.gz -C /opt/module/2)修改apache-hive-2.3.6-bin名称为hive[donglin@hadoop102 module]$ mv apache-hive-2.3.6-bin hive3原创 2020-10-16 12:47:38 · 580 阅读 · 0 评论 -
Failure to find org.pentaho:pentaho-aggdesigner-algorithm:pom:5.1.5-jhyde in http://maven.aliyun.com
编写Hive自定义UDF以及UDTF函数时,打包出现错误Failure to findorg.pentaho:pentaho-aggdesigner-algorithm:pom:5.1.5-jhyde inhttp://maven.aliyun.com/nexus/content/repositories/central/ was cachedin the local repository, resolution will not be reattempted until theupdate in原创 2020-05-19 21:22:50 · 2756 阅读 · 0 评论 -
In order to set a constant number of reducers: set mapreduce.job.reduces=<number>卡在这里不动
Query ID = root_20200922113537_352b88b7-f5e8-4865-8c1b-68a5182230abTotal jobs = 1Launching Job 1 out of 1Number of reduce tasks not specified. Estimated from input data size: 1In order to change the average load for a reducer (in bytes): set hive.exe原创 2020-09-26 16:19:23 · 2740 阅读 · 1 评论 -
Hive的优缺点
优点操作接口采用类SQL语法,提供快速开发的能力(简单、容易上手)。避免了去写MapReduce,减少开发人员的学习成本。Hive的执行延迟比较高,因此Hive常用于数据分析,对实时性要求不高的场合。Hive优势在于处理大数据,对于处理小数据没有优势,因为Hive的执行延迟比较高。Hive支持用户自定义函数,用户可以根据自己的需求来实现自己的函数。缺点1.Hive的HQL表达能力有限(1)迭代式算法无法表达(2)数据挖掘方面不擅长2.Hive的效率比较低(1)Hive自动生成的Map原创 2020-07-31 22:41:51 · 1042 阅读 · 0 评论 -
Hive中Rank,DENSE_RANK,ROW_NUMBER的区别
函数说明RANK() 排序相同时会重复,总数不会变DENSE_RANK() 排序相同时会重复,总数会减少ROW_NUMBER() 会根据顺序计算直接看一张图原创 2020-07-31 21:05:56 · 331 阅读 · 0 评论 -
Hive-2.x+Tez的安装
安装 Hive2.31)1)上传 apache-hive-2.3.0-bin.tar.gz 到/export/software 目录下,并解压到/export/serverstar-zxvf apache-hive-2.3.6-bin.tar.gz -C /export/servers/2)修改 apache-hive-2.3.6-bin 名称为 hivemv apache-hive-2.3.6-bin hive3)将 Mysql 的 mysql-connector-java-5.1.27-b原创 2020-07-30 23:15:26 · 354 阅读 · 0 评论 -
Union与Union all区别
准备两张表tableA tableBid name score id name score1 a 80 1 d 482 b 79 2 e 233 c 68 3 c 86采用union查询select name from tableA union原创 2020-07-29 23:07:54 · 177 阅读 · 0 评论 -
hive中with....as的用法
with...as的用法就相当于join....on的用法下面展示with怎么用(数据不用管,缩减版)withtmp_order as(selectsku_idfrom detail),tmp_payment as(selectsku_id,payment_countfrom refund)insert overwrite table daycountselectsku_id,payment_count,from(selectsku_id,0 payment_原创 2020-07-29 23:02:46 · 3354 阅读 · 0 评论 -
电商数仓中hive常用的函数
常用函数concat 函数concat_ws 函数STR_TO_MAP 函数collect_set 函数nvl 函数日期处理函数综合训练concat 函数concat 函数在连接字符串的时候,只要其中一个是 NULL,那么将返回 NULLhive> select concat('a','b');abhive> select concat('a','b',null);NULLconcat_ws 函数concat_ws 函数在连接字符串的时候,只要有一个字符串不是 NULL,就不原创 2020-07-29 22:11:11 · 450 阅读 · 1 评论 -
hive -e和hive -f的用法
hive -e“-e”不进入hive的交互窗口执行sql语句bin/hive -e "select id from student;"hive -f“-f”执行脚本中sql语句(1)在/export/servers/datas目录下创建hive.sql文件touch hive.sql文件中写入正确的sql语句select *from student;(2)执行文件中的sql语句bin/hive -f /export/servers/datas/hive.sql(3)执行文件中的s原创 2020-07-28 20:51:36 · 6310 阅读 · 3 评论 -
hive创建临时函数和永久函数
创建临时函数1.打包2.将hivefunction-1.0-SNAPSHOT上传到hadoop12的/export/servers/hive3.将jar包添加到Hive的classpathadd jar /export/servers/hive/hivefunction-1.0-SNAPSHOT.jar;4.创建临时函数与开发好的java class关联create temporary function base_analizer as 'com.udf.BaseFieldUDF';cre原创 2020-07-28 20:38:29 · 2846 阅读 · 1 评论 -
配置hive日志目录
在/hive/conf/下修改mv hive-log4j2.properties.template hive-log4j2.properties打开hive-log4j2.propertiesvi hive-log4j2.properties修改原创 2020-07-27 22:25:08 · 818 阅读 · 0 评论 -
hive中get_json_object 函数的使用
1.输入数据 xjsonXjson=[{"name":" 大 郎 ","sex":" 男 ","age":"25"},{"name":" 西 门 庆 ","sex":" 男","age":"47"}]2.取出第一个 json 对象SELECT get_json_object(xjson,"$.[0]") FROM person;结果是:{“name”:“大郎”,“sex”:“男”,“age”:“25”}3.取出第一个 json 的 age 字段的值SELECT get_json_object原创 2020-07-27 22:16:08 · 1951 阅读 · 0 评论 -
Exception in thread “main“ java.lang.StackOverflowError
错误信息Exception in thread "main" java.lang.StackOverflowError at sun.nio.cs.UTF_8$Encoder.encodeLoop(UTF_8.java:691) at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:579) at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:271) at sun.原创 2020-07-27 19:27:28 · 2479 阅读 · 0 评论 -
nohup bin/hive --service metastore &启动之后,自动退出
解决方案:在hive-site.xml下增加<property> <name>hive.metastore.schema.verification</name> <value>false</value></property><property> <name>datanucleus.schema.autoCreateAll</name> <value>true<原创 2020-07-25 20:59:52 · 4152 阅读 · 2 评论 -
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.tez.TezTask
解决方法:(1)关掉虚拟内存检查,修改 yarn-site.xml,在/export/servers/hadoop-2.7.7/etc/hadoop/yarn-site.xml<property> <name>yarn.nodemanager.vmem-check-enabled</name> <value>false</value> </property> (2)修改后一定要分发,并重新启动 hadoop 集群。 xs原创 2020-07-24 23:24:44 · 1042 阅读 · 0 评论 -
FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeExcepti
FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient注意: hive2.x版本需要启动两个服务metastore和hiveserver2,否则会报错Exception in thread原创 2020-07-24 23:09:18 · 2507 阅读 · 1 评论