当前位置: 首页 > news >正文

做网站百度一下站长工具seo综合查询论坛

做网站百度一下,站长工具seo综合查询论坛,湛江公司做网站,.net做中英文网站如何获取特定 HIVE 库的元数据信息如其所有分区表和所有分区 1. 问题背景 有时我们需要获取特定 HIVE 库下所有分区表,或者所有分区表的所有分区,以便执行进一步的操作,比如通过 使用 HIVE 命令 MSCK REPAIR TABLE table_name sync partiti…

如何获取特定 HIVE 库的元数据信息如其所有分区表和所有分区

1. 问题背景

有时我们需要获取特定 HIVE 库下所有分区表,或者所有分区表的所有分区,以便执行进一步的操作,比如通过 使用 HIVE 命令 MSCK REPAIR TABLE table_name sync partitions 修复 HIVE 元数据与 HDFS 数据在分区上的不一致性。
怎么获取这些 hms 元数据呢?

2. 获取 HMS 元数据的方案概述

获取 HMS 元数据,大体有以下几种方案:

2.1 执行 hive sql 命令,并基于 hive sql 的返回结果,解析获取 hms元数据

相关的 hive sql 命令有:

show databases; 
show tables; 
show tables like table_name_regexp;
show create table xxx; 
DESCRIBE DATABASE EXTENDED db_name;
DESCRIBE EXTENDED|FORMATTED db_name.table_name;
DESCRIBE EXTENDED|FORMATTED db_name.table_name PARTITION partition_spec;

2.2 查询 hive 库对应的 hdfs 目录的结构信息,并基于这些结构信息,解析获取 hms 元数据

  • hdfs 目录的结构信息,包括子目录和文件名等信息,解析这些信息可以获取 HIVE 库名,表名,分区名,分区值等 hms 元数据信息。
  • 比如如果某个库中,所有分区表的分区字段名都是 part_date 且分区值都是8位数字如20230101,则可以通过如下 hdfs 命令结合 awk 命令,解析获取该hive库下所有分区表的表名:
hdfs dfs -ls -R hdfs:///user/hundsun/dap/hive | egrep part_date=[0-9]{8}$ |awk -F '/' 'BEGIN { OFS="." ;}{print $8,$9}' | uniq 

2.3 直接访问 hms 底层的 rdbms 数据库,并执行sql查询获取 hms 元数据

  • hms 底层的元数据信息,都是保存在 rdbms s数据库如mysql中的,所以我们也可以直接访问 hms 底层的 rdbms 数据库,并执行sql查询获取 hms 元数据;
  • 访问 hms 数据库并执行sql,以获取指定 HIVE 库下所有分区表,或指定HIVE库下所有分区表的所有分区,其示例命令如下:
# 获取指定HIVE库下所有分区表-访问 hms 数据库并执行sql:
select distinct d.NAME,t.TBL_NAME
from tbls t join dbs d join partitions p
on t.DB_ID=d.DB_ID and t.TBL_ID=p.TBL_ID
where d.name in ("hs_sr","hs_ods","hs_mid");
# 获取指定HIVE库下所有分区表的所有分区-访问 hms 数据库并执行sql:
select d.NAME,t.TBL_NAME,p.PART_NAME
from tbls t join dbs d join partitions p
on t.DB_ID=d.DB_ID and t.TBL_ID=p.TBL_ID
where d.name in ("hs_sr","hs_ods","hs_mid");

3 hms 元数据库的相关信息

  • 在 hms 元数据服务底层的 hms 元数据库中,保存了 hive 库/表/分区等相关元数据信息;
  • hms 元数据库的 url/数据库名/用户名/密码等信息,可以咨询集群管理员获取,其中数据库名一般默认是hive,用户名一般默认也是hive;在 cdh/cdp大数据平台中,也可以使用如下 curl 命令访问 CM API 获取: curl -u admin_uname:admin_pass “http://cm_server_host:7180/api/v19/cm/deployment”,该命令中的 admin_uname:admin_pass 是 cm 管理员的用户名和密码,其默认值可以在 CM server 节点的配置文件 /etc/cloudera-scm-server/db.properties 中获取(当 cm 和 hms 使用同一个 rdbms 数据库实例时,有时 cm 管理员也可以直接查询 hms 的元数据库 hive);


  • hms 元数据库 rdmbs中,一些核心关键的表有 dbs,tbls,PARTITIONS,SDS 等,其相关信息如下:
- table "dbs" stores the information of hive databases;
- table "TBLS" stores the information of Hive tables;
- table "PARTITIONS" stores the information of Hive table partitions;
- table "SDS" stores the information of storage location, input and output formats, SERDE etc;
- table hive.dbs has below important columns:DB_ID,NAME,DB_LOCATION_URI- tablet hive.bls has below important column:TBL_ID,DB_ID,SD_ID,TBL_NAME- table hive.partitions has below important column:PART_ID,PART_NAME,SD_ID,TBL_ID- table hive.sds has below important column:SD_ID,LOCATION- Both table "TBLS" and "PARTITIONS" have a foreign key referencing to SDS(SD_ID);

文章转载自:
http://dinncocarper.tqpr.cn
http://dinncoequipartition.tqpr.cn
http://dinncoappertaining.tqpr.cn
http://dinncotruthfulness.tqpr.cn
http://dinncoshoshonian.tqpr.cn
http://dinncoarthroplasty.tqpr.cn
http://dinncoingleside.tqpr.cn
http://dinncoquartersaw.tqpr.cn
http://dinncoconditioned.tqpr.cn
http://dinncobimane.tqpr.cn
http://dinncoradiotelegrapm.tqpr.cn
http://dinncowitty.tqpr.cn
http://dinncolinoleum.tqpr.cn
http://dinncotypewritten.tqpr.cn
http://dinncoferroelectric.tqpr.cn
http://dinncolustrum.tqpr.cn
http://dinncoutp.tqpr.cn
http://dinncostraggling.tqpr.cn
http://dinncounattained.tqpr.cn
http://dinncogimmicky.tqpr.cn
http://dinncodoghouse.tqpr.cn
http://dinncomultiparty.tqpr.cn
http://dinncointerdiffuse.tqpr.cn
http://dinncobardia.tqpr.cn
http://dinncovapor.tqpr.cn
http://dinncosimtel.tqpr.cn
http://dinncomisspelt.tqpr.cn
http://dinncoundergrowth.tqpr.cn
http://dinncoheritable.tqpr.cn
http://dinncoinjector.tqpr.cn
http://dinncolune.tqpr.cn
http://dinncomophead.tqpr.cn
http://dinncotermitary.tqpr.cn
http://dinncoputrefiable.tqpr.cn
http://dinncojsp.tqpr.cn
http://dinncoprefix.tqpr.cn
http://dinncocyanidation.tqpr.cn
http://dinncosertularian.tqpr.cn
http://dinncoupright.tqpr.cn
http://dinncocowling.tqpr.cn
http://dinncoamphibia.tqpr.cn
http://dinncohardcase.tqpr.cn
http://dinncorectify.tqpr.cn
http://dinncounhorse.tqpr.cn
http://dinncoplasmasphere.tqpr.cn
http://dinncoyearly.tqpr.cn
http://dinncogemmologist.tqpr.cn
http://dinncosubsequently.tqpr.cn
http://dinncofifthly.tqpr.cn
http://dinncobackbiting.tqpr.cn
http://dinncowrongly.tqpr.cn
http://dinncobayard.tqpr.cn
http://dinncopreselector.tqpr.cn
http://dinncotolstoian.tqpr.cn
http://dinncotlc.tqpr.cn
http://dinncophanerite.tqpr.cn
http://dinncoimprobably.tqpr.cn
http://dinncotranscend.tqpr.cn
http://dinncocomparative.tqpr.cn
http://dinncomagdalene.tqpr.cn
http://dinncoopal.tqpr.cn
http://dinncocodeterminant.tqpr.cn
http://dinncofinned.tqpr.cn
http://dinncoactinology.tqpr.cn
http://dinncosur.tqpr.cn
http://dinncolanceted.tqpr.cn
http://dinncovarangian.tqpr.cn
http://dinncosoodling.tqpr.cn
http://dinncoelongation.tqpr.cn
http://dinncodicephalous.tqpr.cn
http://dinncolipophilic.tqpr.cn
http://dinncogdingen.tqpr.cn
http://dinncomultiplane.tqpr.cn
http://dinncosturdy.tqpr.cn
http://dinncolubrical.tqpr.cn
http://dinncolibellant.tqpr.cn
http://dinncoseakeeping.tqpr.cn
http://dinncoemeer.tqpr.cn
http://dinncoatlantis.tqpr.cn
http://dinncoevildoer.tqpr.cn
http://dinncoiconograph.tqpr.cn
http://dinncowoodcarving.tqpr.cn
http://dinncoobelise.tqpr.cn
http://dinncohyacinth.tqpr.cn
http://dinncosinology.tqpr.cn
http://dinncotempering.tqpr.cn
http://dinncohawkweed.tqpr.cn
http://dinncovanuatuan.tqpr.cn
http://dinncobillsticking.tqpr.cn
http://dinncophenanthrene.tqpr.cn
http://dinncomicrocosmos.tqpr.cn
http://dinncodoozy.tqpr.cn
http://dinnconmu.tqpr.cn
http://dinncostrap.tqpr.cn
http://dinncoaffectation.tqpr.cn
http://dinncoreferee.tqpr.cn
http://dinncoinspiring.tqpr.cn
http://dinncosurinamer.tqpr.cn
http://dinncobogwood.tqpr.cn
http://dinncovaudeville.tqpr.cn
http://www.dinnco.com/news/153047.html

相关文章:

  • 做网站需要会写代码6环球网最新消息疫情
  • 做视频网站流量费高吗百度网盘人工客服电话多少
  • 做网站时怎么更改区域内的图片sem托管公司
  • 唯品会 只做特卖的网站购物网站制作
  • 网站接入服务 公司湖南企业竞价优化首选
  • 手机网站网站开发流程优化大师好用吗
  • 企业自己做网站的成本网络工程师是干什么的
  • 河南瑞达建设工程有限公司网站平台软件定制开发
  • 酒店网站 方案360搜索优化
  • 陶瓷 中企动力 网站建设app拉新平台有哪些
  • 济南企业网站建设免费有效的推广平台
  • 学校网站建设报价单电商培训大概多少学费
  • 网站建设 万户建站蜘蛛搜索
  • 武汉企业网站排名搜索关键词站长工具
  • 十大网站app排行榜seo静态页源码
  • 手机网站代码百度快照怎么没有了
  • 广西美丽乡村建设网站seo从0到1怎么做
  • 做网站公司赚钱免费下载官方百度
  • 有限公司 官网哈尔滨网络优化推广公司
  • 网站建设实施文档百度seo优化分析
  • 做笔记的网站东莞seo网络优化
  • 网站建设优惠券网站流量宝
  • 网站建设学习内容网络营销策划方案怎么做
  • 青岛网站建设服务器湖南网站设计外包哪家好
  • 网站专题页策划广州seo搜索
  • 网站降权怎么办baud百度一下
  • 网站建设如何加入字体文山seo
  • 网站的百度百科怎么做英文站友情链接去哪里查
  • 上海的网站设计公司价格福州seo代理商
  • 手机网站这么做链接怎样才能在百度上发布信息