1. 程式人生 > >hive-hadoop 常用命令

hive-hadoop 常用命令

1.檢視hadoop任務

yarn application -list |grep 使用者名稱
yarn application -kill application_1443009203033_86621

2.liunx nohup命令

nohup ./label_driver.sh > /home/disk4/bi/driver_label/label_driver20150325.log  2>&1 &
nohup ./testpass.sh > logs/testpass_20150323.log  2>&1 &

3.hive新增欄位

ALTER
TABLE label_driver_z add columns(total_miss_cnt int comment '累積爽約訂單數');

4.hive修改表分隔方式、修改空值描述符

ALTER TABLE city SET SERDEPROPERTIES ('field.delim' = '\t');
ALTER TABLE city SET SERDEPROPERTIES('serialization.format' = '\t');
ALTER TABLE city SET SERDEPROPERTIES('serialization.null.format' = '');
ALTER TABLE dm_market_acti_reg_d CHANGE dt dt int COMMENT '業務日期' FIRST boci; ALTER TABLE employee RENAME TO emp; ALTER TABLE dm_market_boci_first_call_d add COLUMNS (dt int comment '業務日期'); ALTER TABLE dw_customer add COLUMNS (ord_succ_d int comment '當日完成訂單數');

5.hive檢視函式的用法

desc function extended
add_months;

6.hive查看錶儲存實際路徑

desc extended ods_order partition(dt=20151010);

7.hive insert語法

insert OVERWRITE table test_an select 11111111111,'a' from label_driver_basic limit 1;
mysql -uhive -p'xiaojukeji' -hhdp999.qq -P3306 --default-character-set=utf8 test

8.不開啟優化

set hive.fetch.task.conversion=minimal,more
set hive.exec.parallel=true;

9.檢視使用的分割槽

explain dependency query_str

10.刪除檔案

hadoop fs -rmr /user/rd/bi_dm/dm_tag_pass_ord_tot_d;
dfs -rmr /user/rd/bi_dm/app_driver_ord_distri_d;

11.hive選擇執行引擎

set hive.execution.engine=tez,spark,mr
set mapred.reduce.tasks=20;

12.手機號碼正則表示式

'^1[35847][0-9]{9}$'

13.查詢某個檔案

find . -name app_tag_pass1_info.sh

14.COALESCE( value1,value2,… )

17.hive刪除分割槽

ALTER TABLE login DROP IF EXISTS PARTITION (dt='2008-08-08');

20.壓縮命令

tar -cvf /tmp/etc.tar /etc

21.改變檔案目錄許可權

chown -R xiaoju  /home/disk1/tagol-data/weather/
chgrp -R xiaoju  /home/disk1/tagol-data/weather/

22.啟動langley

nohup /data/xiaoju/langley/srv/bin/langley_srv 9001 /data1 &

23.取文字第及列資料

cat test|awk '{print $2}'
awk '{print $1}' dw_pass_tagol_a_20150708.csv > tagol.csv