熟悉HBase基本操作
1.
ssh localhost
start-dfs.sh
start-hbase.sh
hbase shell
create 'Student', 'S_No', 'S_Name', 'S_Sex', 'S_Age' put 'Student', '', 'S_No', ''
put 'Student', '', 'S_Name', 'Zhangsan'
put 'Student', '', 'S_Sex', 'male'
put 'Student', '', 'S_Age', '' put 'Student', '', 'S_No', ''
put 'Student', '', 'S_Name', 'Marry'
put 'Student', '', 'S_Sex', 'female'
put 'Student', '', 'S_Age', '' put 'Student', '', 'S_No', ''
put 'Student', '', 'S_Name', 'Lisi'
put 'Student', '', 'S_Sex', 'male'
put 'Student', '', 'S_Age', ''
2.
list
scan 'Student'
alter 'Student', NAME=>'S_Course'
put 'Student', '', 'S_Course:math', ''
alter 'Student', {NAME=>'S_Course', METHOD=>'delete'}
count 'Student'
truncate 'Student'
3.
hdfs dfs -rm input/*.txt
hdfs dfs -put ~/lyric.txt input/
4.
import sys for line in sys.stdin:
line = line.strip()
words = line.split()
for word in words:
print('%s\t%s' % (word, 1))
5.
from operator import itemgetter
import sys current_word = None
current_count = 0
word = None for line in sys.stdin:
line = line.strip()
word, count = line.split('\t', 1)
try:
count = int(count)
except ValueError:
continue if current_word == word:
current_count += count
else:
if current_word:
print '%s\t%s' % (current_word, current_count)
current_count = count
current_word = word if current_word == word:
print '%s\t%s' % (current_word, current_count)
6.
export HADOOP_HOME=/usr/local/hadoop
export STREAM=$HADOOP_HOME/share/hadoop/tools/lib/hadoop-streaming-*.jar
7.
hadoop jar $STREAM \
-D stream.non.zero.exit.is.failure=false \
-file /home/hadoop/mapper.py \
-mapper 'python /home/hadoop/mapper.py' \
-file /home/hadoop/reducer.py \
-reducer 'python /home/hadoop/reducer.py' \
-input /user/hadoop/input/*.txt \
-output /user/hadoop/wcoutput
熟悉HBase基本操作的更多相关文章
- hbase基本操作
public class Demo { private Configuration conf; private Connection conn; @Before public void prepare ...
- Hbase记录-HBase基本操作(二)
HBase Exists 可以使用exists命令验证表的存在.下面的示例演示了如何使用这个命令. hbase(main):024:0> exists 'emp' Table emp doe ...
- Hbase记录-HBase基本操作(一)
HBase创建表 可以使用命令创建一个表,在这里必须指定表名和列族名.在HBase shell中创建表的语法如下所示. create ‘<table name>’,’<column ...
- HBase 基本操作
如何添加列族 很简单,跟rdbms一样 直接用alter,但是alter之前必须先disable这个表 ---->disable 'test' ...
- hadoop之hbase基本操作
hbase shell 进入hbase命令行 list 显示HBASE表 status 系统上运行的服务器的细节和系统的状态 version 返回HBase系统使用的版本 table_help 引导如 ...
- HBase基本操作-Java实现
创建Table public static void createTable(String tableName){ try { HBaseAdmin hbaseAdmin = new HBaseAdm ...
- Hbase设计实战
Hbase设计实战 本文通过一个游戏公司客户实际案例的讲解,分析了 Hbase 表设计及开发在实际案例中的运用,对比了不同的 Hbase 设计考量对客户端访问模式及检索性能的差异.读者通过案例中 Hb ...
- HBase笔记--编程实战
HBase总结:http://blog.csdn.net/lifuxiangcaohui/article/details/39997205 (very good) Spark使用Java读取hbas ...
- HBase零基础高阶应用实战(CDH5、二级索引、实践、DBA)
HBase是一个分布式的.面向列的开源数据库,该技术来源于 Fay Chang 所撰写的Google论文“Bigtable:一个结构化数据的分布式存储系统”.就像Bigtable利用了Google文件 ...
随机推荐
- .NET Core----七牛云图片上传
在引用官方的qiniu.core的nuget是总是发生错误,错误如下,所以就在网上找到了一种解决方案,并稍微改进了一番, 以下是引用图: 方法一: 第一步:引用nuge 第二步:新建项目新建控制器视图 ...
- python正则表达式--findall、finditer方法
findall方法 相比其他方法,findall方法有些特殊.它的作用是查找字符串中所有能匹配的字符串,并以结果存于列表中,然后返回该列表 注意: match 和 search 是匹配一次 finda ...
- Codeforces 558E A Simple Task (计数排序&&线段树优化)
题目链接:http://codeforces.com/contest/558/problem/E E. A Simple Task time limit per test5 seconds memor ...
- Bootstrap-datepicker3官方文档中文翻译---Event/事件(原文链接 http://bootstrap-datepicker.readthedocs.io/en/latest/index.html)
Events/事件 DatePicker在某些情况下触发一些事件.所有事件都拥有 传递给任何事件处理程序的 事件对象的 附加数据.(译者注:这里英语拗口,汉语也拗口,我用空格给大家断断句) ...
- centos防火墙控制与转发端口
一.使用防火墙 systemctl控制防火墙 systemctl status/start/stop/restart firewalld 如开启防火墙: $ systemctl start firew ...
- Zabbix (三)
一.zabbix支持的主要监控方式: zabbix主要Agent,Trapper,SNMP,JMX,IPMI这几种监控方式,本文章主要通过监控理论和实际操作测试等方式来简单介绍这几种方式的监控原理和优 ...
- CentOS 7 配置静态IP后不生效 & Job for network.service failed
参考:http://tieba.baidu.com/p/3233996339#57290767555l 在CentOS中配置静态IP后不生效. 解决办法:将/etc/sysconfig/network ...
- DAY1 VS2017&CUDA10.01环境搭建
Visual Studio工程配置情况: VC++目录配置: C:\ProgramData\NVIDIA Corporation\CUDA Samples\v10.\common\lib\x64 C: ...
- idea 版本控制 忽略要提交的文件
- (八)shell工具-重点
8.1 cut cut的工作就是“剪”,具体的说就是在文件中负责剪切数据用的.cut 命令从文件的每一行剪切字节.字符和字段并将这些字节.字符和字段输出. 1.基本用法 cut [选项参数] fil ...