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基本操作的更多相关文章

  1. hbase基本操作

    public class Demo { private Configuration conf; private Connection conn; @Before public void prepare ...

  2. Hbase记录-HBase基本操作(二)

    HBase Exists   可以使用exists命令验证表的存在.下面的示例演示了如何使用这个命令. hbase(main):024:0> exists 'emp' Table emp doe ...

  3. Hbase记录-HBase基本操作(一)

    HBase创建表 可以使用命令创建一个表,在这里必须指定表名和列族名.在HBase shell中创建表的语法如下所示. create ‘<table name>’,’<column ...

  4. HBase 基本操作

    如何添加列族 很简单,跟rdbms一样 直接用alter,但是alter之前必须先disable这个表 ---->disable 'test'                          ...

  5. hadoop之hbase基本操作

    hbase shell 进入hbase命令行 list 显示HBASE表 status 系统上运行的服务器的细节和系统的状态 version 返回HBase系统使用的版本 table_help 引导如 ...

  6. HBase基本操作-Java实现

    创建Table public static void createTable(String tableName){ try { HBaseAdmin hbaseAdmin = new HBaseAdm ...

  7. Hbase设计实战

    Hbase设计实战 本文通过一个游戏公司客户实际案例的讲解,分析了 Hbase 表设计及开发在实际案例中的运用,对比了不同的 Hbase 设计考量对客户端访问模式及检索性能的差异.读者通过案例中 Hb ...

  8. HBase笔记--编程实战

    HBase总结:http://blog.csdn.net/lifuxiangcaohui/article/details/39997205  (very good) Spark使用Java读取hbas ...

  9. HBase零基础高阶应用实战(CDH5、二级索引、实践、DBA)

    HBase是一个分布式的.面向列的开源数据库,该技术来源于 Fay Chang 所撰写的Google论文“Bigtable:一个结构化数据的分布式存储系统”.就像Bigtable利用了Google文件 ...

随机推荐

  1. css奇技淫巧-色彩渐变与动态渐变

    来源 css渐变 CSS 中设置的渐变是 gradient 数据类型,它是一种特别的image数据类型.使用background-image设置,可叠加设置多个: CSS3 定义了两种类型的渐变(gr ...

  2. CSS --记录

    CSS3与文字渐变光影流动动画效果实现 by zhangxinxu from http://www.zhangxinxu.com 本文地址:http://www.zhangxinxu.com/word ...

  3. shell 运算符章节笔记

    // 运算符 算数运算符 关系运算符 布尔运算符 字符串运算符 文件运算符 1.算数运算符 + - * / % = == != echo `expr 1 + 1`; echo `expr 1 - 2` ...

  4. iOS开发之常用路径及文件操作方法

    一.常用的路径方法 1.获取AppName.app 目录路径: NSString *path = [[NSBundle mainBundle] bundlePath]; 2.获取Documents目录 ...

  5. window10 蓝牙只能发不能收文件解决办法

    打开“通过蓝牙发送和接收文件”,在“接收文件”界面中无法接收蓝牙发送的文件 解决办法: 1. win+R后,输入msconfig,回车 2. 点击服务,勾选隐藏Microsoft服务,点击全部禁用 3 ...

  6. HihoCoder - 1038 01背包 动态规划

    #1038 : 01背包 时间限制:20000ms 单点时限:1000ms 内存限制:256MB 描述 且说上一周的故事里,小Hi和小Ho费劲心思终于拿到了茫茫多的奖券!而现在,终于到了小Ho领取奖励 ...

  7. ubuntu18.04使用SPFlashTool提示缺少libpng12.so.0

    Ubuntu libpng12无法安装解决 Ubuntu 14以上就已经不再支持libpng12,然而有些软件又依赖于libpng12(如我要使用的Cisco Packet Tracer).我们可以采 ...

  8. .net基础学java系列(二)IDE

    上一篇文章.net基础学java系列(一)视野 废话: "视野"这篇文章,管理员说它比较空洞!也许初学者看不懂表格中的大部分内容!多年的neter估计也有很多不知道的! 有.net ...

  9. (转载)C# 枚举 FlagsAttribute用法

    这是读过几篇文章后发现整理的最完整的一篇文章 转载地址:枚举特性FlagsAttribute的用法 先看官方的解释:指示可以将枚举作为位域(即一组标志)处理. 看起来并不好理解,到底什么是作为位域处理 ...

  10. 为什么Kafka速度那么快

    Kafka的消息是保存或缓存在磁盘上的,一般认为在磁盘上读写数据是会降低性能的,因为寻址会比较消耗时间,但是实际上,Kafka的特性之一就是高吞吐率. 即使是普通的服务器,Kafka也可以轻松支持每秒 ...