熟悉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文件 ...
随机推荐
- httpclient的封装完整版
applicationContext-httpclient.xml <?xml version="1.0" encoding="UTF-8"?> & ...
- 小秘书智能app登录
项目流程 项目图解 登录逻辑 建立项目 前端: 后端: Flask 数据库: Mongo 分工: 我负责的:
- js拼音排序
js拼音排序 var arr =['a','c','b','b']; arr.sort( function compareFunction(p1, p2) { return p1.localeComp ...
- GitHub项目功能理解
目录 github账号看板使用方式 code issues Pull Requests Projects Insights Settings date: 2019-4-26 author:yangxi ...
- Java实现一个简单的循环队列
在某些时候,我们不能被要求像数组一样可以使用索引随机访问,而是需要被限制顺序处理业务,今天介绍一种先进先出(FIFO)的线性数据结构:队列, 当然,还有后进先出(LIFO)的处理方式,即为栈(后续有时 ...
- 解决Windows服务无法访问网络映射盘的问题
下载工具psexec 下载地址:https://docs.microsoft.com/zh-cn/sysinternals/downloads/psexec 百度地址:https://pan.baid ...
- js属性对象的propertyIsEnumerable方法
定义 每个对象都有一个propertyIsEnumerable()方法.此方法返回一个布尔值,表明指定的属性是否是可枚举. This method can determine whether the ...
- vmware安装VMTools , VirtualBox "安装增强功能"
https://www.vmware.com/support/ws45/doc/new_guest_tools_ws.html 直接参考官方文档,中文没找到啥有用的资料 https://www.cnb ...
- 【转发】如何使用NPM?CNPM又是什么?
转发:https://www.jianshu.com/p/f581cf9360a2 背景介绍 什么是npm? npm(node package manager)是nodejs的包管理器,用于node插 ...
- 2019-3-22c# TextBox只允许输入数字,禁用右键粘贴,允许Ctrl+v粘贴数字
TextBox 禁止复制粘贴 ShortcutsEnabled =false TextBox只允许输入数字,最大长度为10 //TextBox.ShortcutsEnabled为false 禁止右键和 ...