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

商城软件开发/温州seo排名优化

商城软件开发,温州seo排名优化,深圳网络推广公司怎么样,做的网站需要什么技术支持场景: 如果事先建立了一张分区表,然后手动(比如使用 cp 或者 mv )将分区数据拷贝到刚刚新建的表进行数据初始化;但是对于分区表,需要在hive里面手动将刚刚初始化的数据分区加入到hive里面,这样才…
场景:
如果事先建立了一张分区表,然后手动(比如使用 cp 或者 mv )将分区数据拷贝到刚刚新建的表进行数据初始化;但是对于分区表,需要在hive里面手动将刚刚初始化的数据分区加入到hive里面,这样才能够查询使用。通常的做法是使用 alter table add partition命令手动添加分区;但是如果初始化的分区太多,这样一条一条地手动添加分区不免过于麻烦(虽然可以写个脚本生成添加分区的命令)。
这时候,MSCK命令就派上用场了。
语法:
MSCK REPAIR TABLE table_name;
执行后,Hive会检测如果HDFS目录下存在但表的metastore中不存在的partition元信息,更新到metastore中。
实例:
1、建表
CREATE TABLE `xxxxxx_uid_online`(`datehour` string, `halfhourtype` string, `uid` string, `roomid` string, `roomcreatoruid` string, `staytime` string)
PARTITIONED BY ( `pt_day` string)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' 
STORED AS INPUTFORMAT 'org.apache.hadoop.mapred.TextInputFormat' 
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION'hdfs://emr-cluster/user/hive/warehouse/xxxxxx_uid_online'
TBLPROPERTIES ('transient_lastDdlTime'='1516865482')
2、查看分区信息
hive> show partitions xxxxxx_uid_online;
OK
Time taken: 0.048 seconds
3、复制数据
hadoop  distcp  hdfs://10.28.28.177:9000/user/hive/warehouse/xxxxxx_uid_online/2018-01-01 hdfs://emr-cluster/user/hive/warehouse/xxxxxx_uid_online/pt_day=2018-01-01
hadoop  distcp  hdfs://10.28.28.177:9000/user/hive/warehouse/xxxxxx_uid_online/2017-12-31 hdfs://emr-cluster/user/hive/warehouse/xxxxxx_uid_online/pt_day=2017-12-31
hadoop  distcp  hdfs://10.28.28.177:9000/user/hive/warehouse/xxxxxx_uid_online/2017-12-30 hdfs://emr-cluster/user/hive/warehouse/xxxxxx_uid_online/pt_day=2017-12-30
hadoop  distcp  hdfs://10.28.28.177:9000/user/hive/warehouse/xxxxxx_uid_online/2017-12-29 hdfs://emr-cluster/user/hive/warehouse/xxxxxx_uid_online/pt_day=2017-12-29
hadoop  distcp  hdfs://10.28.28.177:9000/user/hive/warehouse/xxxxxx_uid_online/2017-12-28 hdfs://emr-cluster/user/hive/warehouse/xxxxxx_uid_online/pt_day=2017-12-28
4、执行修复命令
hive> MSCK REPAIR TABLE xxxxxx_uid_online;  
OK
Partitions not in metastore:    xxxxxx_uid_online:pt_day=2017-12-28     xxxxxx_uid_online:pt_day=2017-12-29     xxxxxx_uid_online:pt_day=2017-12-30     xxxxxx_uid_online:pt_day=2017-12-31
Repair: Added partition to metastore xxxxxx_uid_online:pt_day=2017-12-28
Repair: Added partition to metastore xxxxxx_uid_online:pt_day=2017-12-29
Repair: Added partition to metastore xxxxxx_uid_online:pt_day=2017-12-30
Repair: Added partition to metastore xxxxxx_uid_online:pt_day=2017-12-31
Time taken: 0.133 seconds, Fetched: 5 row(s)
如果目录格式不对,则会报错:
hive> MSCK REPAIR TABLE xxxxxx_uid_online;  
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
5、查看分区信息
hive> show partitions xxxxxx_uid_online;
OK
pt_day=2017-12-28
pt_day=2017-12-29
pt_day=2017-12-30
pt_day=2017-12-31
pt_day=2018-01-01
Time taken: 0.039 seconds, Fetched: 5 row(s)
注意
为了让MSCK命令工作,分区的目录名必须是【 /partition_name=partition_value/】结构的( 且表级目录中不得存在非此种格式的目录名),否则将无法添加分区。这时候就必须使用add partition命令了。
http://www.lbrq.cn/news/1414909.html

相关文章:

  • 专业网站建设集团/seo优化推广教程
  • 12306网站是哪家公司做开发的/域名查询 ip
  • 团购网站大全/廊坊seo排名收费
  • 好看的模板/武汉seo关键词优化
  • 广州网站建设报价单/企业信息查询
  • 网站开发可以做什么/北京seo邢云涛
  • 通过身份证号查房产/网站seo公司
  • 简单的公司网站系统/秦洁婷seo博客
  • 天翼云主机 网站服务器/百度手机怎么刷排名多少钱
  • 浙江省建设厅官方网站/seo排名软件免费
  • 做一个动态网站多少钱/网站如何才能被百度收录
  • 分销/郑州seo优化外包公司
  • 江阴网络公司做网站/百度站长工具使用方法
  • 青海网站建设公司/网页设计制作网站html代码大全
  • ppt模板怎么做 下载网站/新闻稿范文300字
  • 网站logo怎么改/网站推广要点
  • 做网站的代码难吗/软文推广文案范文
  • 怎么做旅游网站推广/windows优化大师如何卸载
  • 破解php网站后台密码/nba最新排名
  • 做网站需要哪些流程/充电宝关键词优化
  • 黄岛网站建设/天堂tv在线观看
  • 做网站是怎么赚钱的/辅导机构
  • 如果一个网站没有备案/今日预测足球比分预测
  • 建行网站会员是什么/广州网站推广服务
  • 大连公司名称大全/河北seo
  • 口碑好的网站建设哪家好/网络seo优化推广
  • 淮安做网站的公司/最近的国际新闻
  • 网站设计与制作/百度推广如何获取精准的客户
  • 政府门户网站 建设方案/南通百度seo代理
  • 一个主机可以建设多少个网站/站长工具seo推广 站长工具查询
  • 数据结构:查找表
  • 开发者说 | EmbodiedGen:为具身智能打造可交互3D世界生成引擎
  • 安卓14系统应用收不到开机广播
  • Java基础面试题(3)—Java(String字符串的存储方式,字面量)
  • C语言指针运算题
  • cPanel Python 应用部署流程