HBase编程 API入门系列之delete.deleteColumn和delete.deleteColumns区别(客户端而言)(4)
心得,写在前面的话,也许,中间会要多次执行,连接超时,多试试就好了。
delete.deleteColumn和delete.deleteColumns区别是:
deleteColumn是删除某一个列簇里的最新时间戳版本。
delete.deleteColumns是删除某个列簇里的所有时间戳版本。

hbase(main):020:0> desc 'test_table'
Table test_table is ENABLED
test_table
COLUMN FAMILIES DESCRIPTION
{NAME => 'f', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS
=> 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}
1 row(s) in 0.2190 seconds
hbase(main):021:0> scan 'test_table'
ROW COLUMN+CELL
row_01 column=f:col, timestamp=1478102698687, value=maizi
row_01 column=f:name, timestamp=1478104345828, value=Andy
row_02 column=f:name, timestamp=1478104477628, value=Andy2
row_03 column=f:name, timestamp=1478104823358, value=Andy3
3 row(s) in 0.2270 seconds
hbase(main):022:0> scan 'test_table'
ROW COLUMN+CELL
row_01 column=f:col, timestamp=1478102698687, value=maizi
row_01 column=f:name, timestamp=1478104345828, value=Andy
row_02 column=f:name, timestamp=1478104477628, value=Andy2
row_03 column=f:name, timestamp=1478104823358, value=Andy3
3 row(s) in 0.1480 seconds
hbase(main):023:0> scan 'test_table',{VERSIONS=>3}
ROW COLUMN+CELL
row_01 column=f:col, timestamp=1478102698687, value=maizi
row_01 column=f:name, timestamp=1478104345828, value=Andy
row_02 column=f:name, timestamp=1478104477628, value=Andy2
row_03 column=f:name, timestamp=1478104823358, value=Andy3
3 row(s) in 0.1670 seconds
hbase(main):024:0>

package zhouls.bigdata.HbaseProject.Test1; import javax.xml.transform.Result; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes; public class HBaseTest {
public static void main(String[] args) throws Exception {
HTable table = new HTable(getConfig(),TableName.valueOf("test_table"));//表名是test_table
Put put = new Put(Bytes.toBytes("row_04"));//行键是row_04
put.add(Bytes.toBytes("f"),Bytes.toBytes("name"),Bytes.toBytes("Andy0"));//列簇是f,列修饰符是name,值是Andy0
// put.add(Bytes.toBytes("f2"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f2,列修饰符是name,值是Andy3
table.put(put);
table.close(); // Get get = new Get(Bytes.toBytes("row_04"));
// get.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("age"));如现在这样,不指定,默认把所有的全拿出来
// org.apache.hadoop.hbase.client.Result rest = table.get(get);
// System.out.println(rest.toString());
// table.close(); // Delete delete = new Delete(Bytes.toBytes("row_2"));
// delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("email"));
// delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("name"));
// table.delete(delete);
// table.close(); // Delete delete = new Delete(Bytes.toBytes("row_03"));
// delete.deleteColumn(Bytes.toBytes("f"), Bytes.toBytes("name"));
// delete.deleteColumns(Bytes.toBytes("f"), Bytes.toBytes("name"));
// table.delete(delete);
// table.close();
} public static Configuration getConfig(){
Configuration configuration = new Configuration();
// conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase");
configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181");
return configuration;
}
}

hbase(main):038:0> scan 'test_table'
ROW COLUMN+CELL
row_01 column=f:col, timestamp=1478102698687, value=maizi
row_01 column=f:name, timestamp=1478104345828, value=Andy
row_02 column=f:name, timestamp=1478104477628, value=Andy2
row_03 column=f:name, timestamp=1478123664884, value=Andy3
3 row(s) in 0.1910 seconds
hbase(main):039:0> scan 'test_table'
ROW COLUMN+CELL
row_01 column=f:col, timestamp=1478102698687, value=maizi
row_01 column=f:name, timestamp=1478104345828, value=Andy
row_02 column=f:name, timestamp=1478104477628, value=Andy2
row_03 column=f:name, timestamp=1478123664884, value=Andy3
row_04 column=f:name, timestamp=1478123917775, value=Andy0
4 row(s) in 0.1310 seconds
delete.deleteColumn和delete.deleteColumns区别是:
deleteColumn是删除某一个列簇里的最新时间戳版本。
delete.deleteColumns是删除某个列簇里的所有时间戳版本。

package zhouls.bigdata.HbaseProject.Test1; import javax.xml.transform.Result; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes; public class HBaseTest {
public static void main(String[] args) throws Exception {
HTable table = new HTable(getConfig(),TableName.valueOf("test_table"));//表名是test_table
Put put = new Put(Bytes.toBytes("row_04"));//行键是row_04
put.add(Bytes.toBytes("f"),Bytes.toBytes("name"),Bytes.toBytes("Andy1"));//列簇是f,列修饰符是name,值是Andy0
// put.add(Bytes.toBytes("f2"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f2,列修饰符是name,值是Andy3
table.put(put);
table.close(); // Get get = new Get(Bytes.toBytes("row_04"));
// get.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("age"));如现在这样,不指定,默认把所有的全拿出来
// org.apache.hadoop.hbase.client.Result rest = table.get(get);
// System.out.println(rest.toString());
// table.close(); // Delete delete = new Delete(Bytes.toBytes("row_2"));
// delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("email"));
// delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("name"));
// table.delete(delete);
// table.close(); // Delete delete = new Delete(Bytes.toBytes("row_03"));
// delete.deleteColumn(Bytes.toBytes("f"), Bytes.toBytes("name"));
// delete.deleteColumns(Bytes.toBytes("f"), Bytes.toBytes("name"));
// table.delete(delete);
// table.close();
} public static Configuration getConfig(){
Configuration configuration = new Configuration();
// conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase");
configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181");
return configuration;
}
}








delete.deleteColumn和delete.deleteColumns区别是:
deleteColumn是删除某一个列簇里的最新时间戳版本。
delete.deleteColumns是删除某个列簇里的所有时间戳版本。



HBase编程 API入门系列之delete.deleteColumn和delete.deleteColumns区别(客户端而言)(4)的更多相关文章
- HBase编程 API入门系列之delete(客户端而言)(3)
心得,写在前面的话,也许,中间会要多次执行,连接超时,多试试就好了. 前面的基础,如下 HBase编程 API入门系列之put(客户端而言)(1) HBase编程 API入门系列之get(客户端而言) ...
- HBase编程 API入门系列之create(管理端而言)(8)
大家,若是看过我前期的这篇博客的话,则 HBase编程 API入门系列之put(客户端而言)(1) 就知道,在这篇博文里,我是在HBase Shell里创建HBase表的. 这里,我带领大家,学习更高 ...
- HBase编程 API入门系列之HTable pool(6)
HTable是一个比较重的对此,比如加载配置文件,连接ZK,查询meta表等等,高并发的时候影响系统的性能,因此引入了“池”的概念. 引入“HBase里的连接池”的目的是: 为了更高的,提高程序的并发 ...
- HBase编程 API入门系列之get(客户端而言)(2)
心得,写在前面的话,也许,中间会要多次执行,连接超时,多试试就好了. 前面是基础,如下 HBase编程 API入门系列之put(客户端而言)(1) package zhouls.bigdata.Hba ...
- HBase编程 API入门系列之delete(管理端而言)(9)
大家,若是看过我前期的这篇博客的话,则 HBase编程 API入门之delete(客户端而言) 就知道,在这篇博文里,我是在客户端里删除HBase表的. 这里,我带领大家,学习更高级的,因为,在开发中 ...
- HBase编程 API入门系列之modify(管理端而言)(10)
这里,我带领大家,学习更高级的,因为,在开发中,尽量不能去服务器上修改表. 所以,在管理端来修改HBase表.采用线程池的方式(也是生产开发里首推的) package zhouls.bigdata.H ...
- HBase编程 API入门系列之scan(客户端而言)(5)
心得,写在前面的话,也许,中间会要多次执行,连接超时,多试试就好了. package zhouls.bigdata.HbaseProject.Test1; import javax.xml.trans ...
- HBase编程 API入门系列之工具Bytes类(7)
这是从程度开发层面来说,为了方便和提高开发人员. 这个工具Bytes类,有很多很多方法,帮助我们HBase编程开发人员,提高开发. 这里,我只赘述,很常用的! package zhouls.bigda ...
- HBase编程 API入门系列之put(客户端而言)(1)
心得,写在前面的话,也许,中间会要多次执行,连接超时,多试试就好了. [hadoop@HadoopSlave1 conf]$ cat regionservers HadoopMasterHadoopS ...
随机推荐
- Centos6.6 编译安装nginx
一.基本环境 nginx 1.9版以后增加了一些新的特性,支持tcp负载均衡,不过这次还是用1.8.0,这里面有个memcached的代理模块,有时间再测试下 1.centos6.6 2.nginx1 ...
- pyqt5 做的小程序,可以用来UI做个小demo
#!/usr/bin/python3# -*- coding: utf-8 -*- """ZetCode PyQt5 tutorial This program crea ...
- Django的Error汇总
title: Django学习笔记 catalog: true subtitle: 11. Django_Error汇总 date: 2018-12-14 10:17:28 --- Django的Er ...
- PAT_A1138#Postorder Traversal
Source: PAT A1138 Postorder Traversal (25 分) Description: Suppose that all the keys in a binary tree ...
- marquee图片无缝拼接滚动
marquee图片无缝滚动 先了解一下对象的几个的属性: innerHTML: 设置或获取位于对象起始和结束标签内的 HTML scrollHeight: 获取对象的滚动高度. scrollL ...
- 63.es中的type数据类型
主要知识点 理解es中的type数据类型 一.type的理解 type是一个index中用来区分类似的数据的,但是可能有不同的fields,而且有不同的属性来控制索引建立.分词器.field的 ...
- 1.VMware虚拟机的安装
1.找到安装软件 2.使用如下操作安装 3.选择接受协议 4.修改安装目录 5.如果上一步有修改,此步骤不用改路径 7.安装后创建桌面快捷方式 8.安装成功可以看到桌面上有快捷方式图标 安装结束 声明 ...
- 【ABCD组】Scrum meeting 4
前言 第4次会议在6月16日由组长在教9 405召开. 主要对下一步的工作进行说明安排,时长90min. 主要内容 分配下阶段任务,争取在这阶段完成软件的设计阶段 任务分配 姓名 当前阶段任务 贡献时 ...
- Python列表的复制
1.直接按名字赋值: my_habit = ['game', 'running'] friend_habit = my_habit my_habit.append('swimming') friend ...
- SBC37x交叉编译平台QT+OPENCV【1】
在win7下安装Vbox虚拟机,然后安装Ubuntu10.04版本.上一篇说了根据厂商提供的编译器进行安装. 接下来要说的的环境准备.因为在Linux下对u盘的识别以及目录的共享,还有代码的编译传送运 ...