创建文件:hadoop fs -mkdir a.txt
1. 大数据关键技术 a) 大数据采集技术(系统日志采集发,ETL采集法,其他数据采集法) b) 大数据存储技术 c) 大数据处理、统计与分析技术 d) 大数据挖掘及可视技术 2. 大数据对思维方式的影响 a) 全样而非抽样 b) 效率而非精确 c) 相关而非因果 3. Hadoop的运行模式 a) 本地独立模式 b) 伪分布式模式 c) 分布式模式 4. Hadoop的启动和关闭 a) Start-dfs.sh、start-yarn.sh b) Stop-dfs.sh、stop-yarn.sh 5. HDFS数据组织机制:多副本存放策略 a) 如果是在集群内的客户机发起的写操作请求,第一个副本 放在客户机所在的数据节点上。如果发出请求的客户机不在集群的范围内,则从集群内选取一个磁盘不太满、cpu负载不太重的数据接节点放在第一个副本 b) 另一个副本放置在不同(远程)机架中的节点上 c) 最后一个副本放在与第二个副本同一远程机架中的不同节点上 6. HDFS操作: a) Hadoop fs –touchz xxx.txt ; -tail –n5 xxx.txt ;-find –iname “*.txt” –print ; -put a.txt / ; b) –copyFormLocal a.txt / ;-get /a.txt ~/a.txt ; -coptToLocal /a.txt ~/a.txt; c) –mvFromLocal a.txt / ; -mvToLocal /a.txt ~/a.txt 会从本地删除 d) FileSystem dfs=FileSystem.get(uri,conf); FileSystem local=FileSystem.get(uri); e) FSDataInputStream in=dfs.open(path);FSDataOutputStream out=local.create(path); 7. MapReduce操作: a) Map端的Shuffle:执行map任务,写入缓冲区,溢写操作,文件归并 b) Reduce端的Shuffle:复制数据,归并数据 8. Hbase shell操作: a) Hbase shell 进入到交互命令状态 b) Create_namespace ‘ns1’ c) 创建表:Create ‘ns1:t1’ d) 创建列族:create ‘表名’,‘列族名1’,{NAME=>’列族名2’,VERSION=>3} e) 展示表:list ‘ns1:*’ f) 显示表结构:Describe ‘表名’ g) 插入数据:put ‘表名’,‘行键’,‘列族1’,‘值1’,列族2,值二 h) 获取数据:get ‘表名’,‘行键’ i) 扫描表:scan ‘student’ j) 删除表:disable ‘t1’;drop ‘t1’ k) 删除一个数据所有版本数据:delete ‘student’,‘15001’,‘sage’ l) 删除指定行的数据:deleteall ‘studnet’,‘15001’,‘sname’ m) 增加列:alter ‘studnet’,’列名’ n) 删除列:alter ‘student’,‘delete’=>’列名’ o) 修改列族的版本数:alter ‘student’,{NAME=>’列名’,versions=>‘6’} p) 判断表是否存在:Exists 表名 9. Hive操作: a) select count(*),avg(age) from student; b) select department, count(*) from student where sex=‘男’group by department; c) select sno, count(*), avg(source) from sc group by sno; d) select sno, count(*), avg(source) from sc group by sno having count(*)>3; e) select student. sno, student. sname , SC. cno, course. cname, SC. source from student, SC, course where student. sno=sc.sno and SC. cno=course. cno; f) select sno from SC group by sno having min(source)>85; g) select a.sno,b.sno from (select sno from sc where cno=‘1‘ ) a left join (select sno from sc where cno=‘2‘) b on a. sno=b.sno where b.sno is null; h) select sc. sno,sc.cno,sc.source from sc left join (select cno, avg(source) avg from sc group by cno) b on sc.cno=b. cno where sc. source>b. avg; i) select student.* from student left join (select distinct sno from sc) b on student . sno=b.sno where b.sno is not nu11; j) select student . sno, student. sname, sC. cno, sC. source from student left join SC on student. sno=sC. sno; k) select a.cno, max(a.avg) from (select cno, avg(source) avg from sc group by cno) a; l) select a.sno from (select sno,cno from sc where sno!=15001) a left join (select cno from sc where sno=15001) b on a.cno=b.cno where b.cno is not null;
原文:https://www.cnblogs.com/zzhAylm/p/14920286.html