hiveserver2修改线程数
hive.server2.thrift.min.worker.threads 最小工作线程数默认5 hive.server2.thrift.max.worker.threads 最大工作线程数默认500 本文转自 yntmdr 51CTO博客,原文链接:http://blog.51cto.com/yntmdr/1885508,如需转载请自行联系原作者
利用以下命令可以查看Hive中的数据库和表格。
show databases; #查看数据库
show tables; #查看表格
(一)将本地/home/training/student.csv表格导入到Hive中
1.在Hive中创建新表格,与本地csv的数据类型一致
create table if not exists student1
(ID int, AGE int, SEX string, BIRTHDAY date, SCORE int)
row format delimited fields terminated by ','
stored as textfile;
2.查看新建的表格
describe student1;
describe formatted student1;
3.导入本地数据
load data local inpath '/home/training/student.csv' overwrite into table student1;
set hive.cli.print.header=true; #显示列名
select * from student1;
Bingo,导入本地数据成功!
(二)将hdfs端的/test/student.csv表格导入到Hive中
hdfs dfs -mkdir /test #新建文件夹
hdfs dfs -put /home/training/student.csv /test #上传本地student.csv到hdfs端的test文件夹下
create table if not exists student2
(ID int, AGE int, SEX string, BIRTHDAY date, SCORE int)
row format delimited fields terminated by ','
stored as textfile;
load data inpath 'hdfs://localhost:8020/test/student.csv' overwrite into table student2;
select * from student2;
Bingo,导入hdfs端数据成功!
(二)将MySQL中的表格导入到Hive中
如果hive的metastore数据库不是MySQL的话,可以利用Sqoop先将mysql数据库中的表导入hdfs端,再把hdfs端的数据导入到Hive中。
下面仅展示如何利用Sqoop先将mysql数据库中test数据库的student_mysql表导入hdfs端。
sqoop import \
--connect jdbc:mysql://localhost/test \
--username training --password training \
--table student_mysql \
--target-dir /lmj/student_hdfs \
--null-non-string '\\N';
其中,import为Sqoop内置的导入单张表的命令,jdbc:mysql://localhost/test为本地MySQL的test数据库,username和password分别为MySQL数据库的账号与密码,table student_mysql为所要导入的表,target-dir为hdfs端的文件地址,null-non-string ‘\N’将数据库表中的null值转化为Hive和Impala中的\N,便于兼容。
微信关注我们
转载内容版权归作者及来源网站所有!
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。
Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。
Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。
WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。