熟悉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文件 ...
随机推荐
- git 命令笔记
切换 git 远程仓库HEAD分支 $ git remote set-head origin some_branch
- js获取当前时间并实时刷新
效果如图: 代码如下: <html> <head> <title>js获取当前时间并实时刷新</title> <script> //页面加载 ...
- github配置ssh密钥的方法
配置用户名和邮箱 初次安装git需要配置用户名和邮箱,否则git会提示:please tell me who you are. 你需要运行命令来配置你的用户名和邮箱: $ git config --g ...
- Docker 学习5 Docker容器网络
一.内核网络名称空间 1.可通过ip netns进行操作 [root@localhost /]# ip netns help Usage: ip netns list ip netns add NAM ...
- 使用pl/sql developer登陆不了oracle
1,Oracle ORA12514 监听程序当前无法识别连接描述符中请求的服务 这里最主要的原因在于:(参考:https://www.cnblogs.com/shangshan/p/6359880.h ...
- Sublime2 Package Control不可用修复
因为教程里用的是sublime2 所以就跟着用了,也没换3,但是最近安装Nodejs做配置时,发现插件安装器不能用了,已点安装就弹窗报错: there are no packages availabl ...
- redux+saga+reducer
saga.js这个文件里面的函数实际没有在其他jsx中引用吧?这个文件的作用就是把异步数据拿到,放进reducer,如果jsx想取,需要结合connect来取数据.
- 使用ACR122U NFC读卡器对M1卡进行读写操作(可以读写中文)
因为项目需要,第一次接触到了ACR122U NFC读卡器(非接触式)和M1卡,首先介绍一下想要读写应该知道的基本知识. 我就根据我的理解先叙述一下: ACR122U 是一款连机非接触式智能卡读写器,可 ...
- hdu1814 Peaceful Commission
hdu1814 Peaceful Commission 题意:2-sat裸题,打印字典序最小的 我写了三个 染色做法,正解 scc做法,不管字典序 scc做法,错误的字典序贪心 #include &l ...
- java 虚拟机学习--未完
1.学习了解GC垃圾回收 参考:https://www.ibm.com/developerworks/cn/java/l-JavaMemoryLeak2/ 2.类加载机制 http://blog.cs ...