极品邪龙全文阅读,首乌的功效,朱晓辉4000激照
hive概述
hive是基于hadoop的一个数据仓库工具,可以将结构化的数据文件映射为一张表,并提供类sql查询功能。
hive本质是:将hql转化成mapreduce程序。
hive处理的数据存储在hdfs中,分析数据底层的实现可以是mapreduce、tes或者spark,其执行程序运行在yarn上。
hive优缺点
优点:
1.使用简单,类sql语法易于使用。
2.可扩展性,可以随时扩展集群规模。
3.延展性,支持自定义函数。
4.无需开发mapreduce程序。
缺点:
1.效率低延迟高,对处理大数据有优势。
2.不支持记录级别的增删改操作。
3.不支持事物。
4.调优困难。
hive安装
只在集群中的主节点服务器中进行安装配置即可,安装包可以去官方主页进行下载:
使用xftp将安装包上传到hadoop-1的/usr目录下:
进入/user目录,使用tar命令将压缩包进行解压,执行命令:
1 # tar zxvf apache-hive-2.3.6-bin.tar.gz
1 # vim /etc/profile
1 export hive_home=/usr/apache-hive-2.3.6-bin 2 export path=$hive_home/bin:$path
1 # source /etc/profile
1 # hadoop fs -mkdir -p /root/tmp 2 # hadoop fs -mkdir -p /root/hive/warehouse
1 # hadoop fs -chmod a+w /root/tmp 2 # hadoop fs -chmod a+w /root/hive/warehouse
1 # cd /usr/apache-hive-2.3.6-bin/conf 2 # ll
1 # cp hive-default.xml.template hive-site.xml
1 # vim hive-site.xml
1 <property> 2 <name>hive.metastore.warehouse.dir</name> 3 <value>/root/hive/warehouse</value> 4 <description>location of default database for the warehouse</description> 5 </property> 6 <property> 7 <name>hive.exec.scratchdir</name> 8 <value>/root/tmp</value> 9 <description>hdfs root scratch dir for hive jobs which gets created with write all (733) permission. for each connecting user, an hdfs scratch dir: ${hive.exec.scratchdir}/<username> is created, with ${hive.scratch.dir.permission}.</description> 10 </property> 11 <property> 12 <name>javax.jdo.option.connectionurl</name> 13 <value>jdbc:mysql://localhost:3306/metastore_db?createdatabaseifnotexist=true&usessl=false</value> 14 <description> 15 jdbc connect string for a jdbc metastore. 16 to use ssl to encrypt/authenticate the connection, provide database-specific ssl flag in the connection url. 17 for example, jdbc:postgresql://myhost/db?ssl=true for postgres database. 18 </description> 19 </property> 20 <property> 21 <name>javax.jdo.option.connectiondrivername</name> 22 <value>com.mysql.jdbc.driver</value> 23 <description>driver class name for a jdbc metastore</description> 24 </property> 25 <property> 26 <name>javax.jdo.option.connectionusername</name> 27 <value>root</value> 28 <description>username to use against metastore database</description> 29 </property> 30 <property> 31 <name>javax.jdo.option.connectionpassword</name> 32 <value>password@123!</value> 33 <description>password to use against metastore database</description> 34 </property> 35 <property> 36 <name>hive.metastore.schema.verification</name> 37 <value>true</value> 38 <description> 39 enforce metastore schema version consistency. 40 true: verify that version information stored in is compatible with one from hive jars. also disable automatic 41 schema migration attempt. users are required to manually migrate schema after hive upgrade which ensures 42 proper metastore schema migration. (default) 43 false: warn if the version information stored in metastore doesn't match with one from in hive jars. 44 </description> 45 </property>
1 # mkdir /usr/apache-hive-2.3.6-bin/tmp 2 # chmod a+w /usr/apache-hive-2.3.6-bin/tmp
1 # cp hive-env.sh.template hive-env.sh
1 # vim hive-env.sh
1 hadoop_home=/usr/hadoop-2.7.7
1 # schematool -initschema -dbtype mysql
1 > show databases;
1 > use metastore_db; 2 > show tables;
1 # hive
1 > show databases;
1 > create database testhive;
1 > use testhive;
1 > show tables;
1 > create table testtable(id int,name string,age int) row format delimited fields terminated by ' ' lines terminated by '\n';
1 > desc testtable;
1 > drop database if exists testhive;
1 1 dcl_snow 18 2 2 dcl 19 3 3 snow 20
1 > load data local inpath '/home/test.txt' into table testhive.testtable;
1 > select * from testhive.testtable;
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
浅析我对 String、StringBuilder、StringBuffer 的理解
使用IDEA搭建SSM框架的详细教程(spring + springMVC +MyBatis)
Springboot整合freemarker 404问题解决方案
引入mybatis-plus报 Invalid bound statement错误问题的解决方法
网友评论