天天看点

大数据测试环境常用操作语句

1.Hdfs相关:

hdfs dfs -put 文件名 hdfs路径

举例:hdfs dfs -put application.conf /opt/data/dspAnalysis/

hdfs dfs -mkdir +hdfs路径

举例:hdfs dfs -mkdir /opt/data/dspAnalysis

Hdfs dfs -rm 文件名 hdfs dfs -rm -r 文件夹名 删除文件/文件夹

举例:Hdfs dfs -rm /opt/data/dspAnalysis/application.conf

Hdfs dfs -rm -r /opt/data/dspAnalysis

因有部分任务需要_SUCCESS,下游程序才会继续跑

Hadoop fs -touchz

/opt/hive/warehouse/dw_stg.db/log_tbl_103/log_time=201907290/_SUCCESS

2.Oozie常用命令

杀死任务

oozie job -oozie http://...:11000/oozie/ -kill workflow任务号

重启任务

oozie job -oozie http://...:11000/oozie/ -rerun coordinator任务号 -action 子任务编号

启动任务

oozie job -oozie http://...:11000/oozie/ -config job.properties -run

解除任务suspend状态

oozie job -oozie http://...:11000/oozie -resume 0010582-181010155131196-oozie-hado-W -action 77

3.Hivesql常用语句

插数语句

有一个分区:insert into table 表名 partition(dt=20200315) values(‘’,’’,’’,’’),(‘’,’’,’’,’’),(‘’,’’,’’,’’);

有多个分区:insert into table 表名 partition(dt=20200315,type=’’) values(‘’,’’,’’,’’),(‘’,’’,’’,’’),(‘’,’’,’’,’’);

查询语句(因为hive每次查询不过滤分区会全表scan,所以需要带分区做查询,节约查询效率)

Select 字段 from 表名 where dt=’’/logtime=’’;

更改分区:

ALTER TABLE dw_mdl.m_gwim_follows_info PARTITION dt=20190623 RENAME TO PARTITION dt=20190721;

删除分区:

alter table dw_stg.card_auto_use_status drop partition(dt=20190910);

修复分区

msck repair table dw_stg.card_auto_use_status;

4.Docker常用命令

新的logstash启动命令:

docker run -itd -p 9613:9600 -v /opt/docker/gwim_hyq_like/conf.d:/etc/logstash/conf.d -v /etc/hosts:/etc/hosts --restart=always --name=gwim_hyq_like 44a63fae1877

查日志命令:

Docker logs -f gwim_hyq_like

停止的容器启动命令

Docker start gwim_hyq_like

重启命令:

Docker restart gwim_hyq_like

停止命令:

Docker stop gwim_hyq_like

查看目前在跑的进程:

Docker ps

查看目前所有的进程(包含已休眠的任务)

Docker ps -a

5.kafka常用命令

kafka消费数据:

./kafka-console-consumer.sh --bootstrap-server kafka服务器名:端口号 --topic bd_ht_open --from-beginning

kafka造数据:

./kafka-console-producer.sh --broker-list kafka服务器名:端口号 --topic

继续阅读