# 创建表 , c1版本为4, 元数据mykey=myvaluehbase(main):009:0> create 't1', {NAME => 'c1', VERSIONS => 4}, METADATA => { 'mykey' => 'myvalue' }0 row(s) in 2.2810 seconds=> Hbase::Table - t1# 添加列族c2, c3hbase(main):010:0> alter 't1', 'c2', 'c3'Updating all regions with the new schema...1/1 regions updated.Done.Updating all regions with the new schema...1/1 regions updated.Done.0 row(s) in 3.8320 seconds# 出入数据,c1 插入4个版本的值hbase(main):011:0> put 't1', 'r1', 'c1', 'v1'0 row(s) in 0.1000 secondshbase(main):012:0> put 't1', 'r1', 'c1', 'v11'0 row(s) in 0.0180 secondshbase(main):013:0> put 't1', 'r1', 'c1', 'v111'0 row(s) in 0.0140 secondshbase(main):014:0> put 't1', 'r1', 'c1', 'v1111'0 row(s) in 0.0140 seconds# 插入c2、c3的值hbase(main):015:0> put 't1', 'r1', 'c2', 'v2'0 row(s) in 0.0140 secondshbase(main):016:0> put 't1', 'r1', 'c3', 'v3'0 row(s) in 0.0210 seconds# 获取rowKey=r1的一行记录hbase(main):017:0> get 't1', 'r1'COLUMN CELL c1: timestamp=1552819382575, value=https://www.huyubaike.com/biancheng/v1111 c2: timestamp=1552819392398, value=v2 c3: timestamp=1552819398244, value=v33 row(s) in 0.0550 seconds# 获取rowKey=r1并且 1552819392398 <= 时间戳范围 < 1552819398244hbase(main):018:0> get 't1', 'r1', {TIMERANGE => [1552819392398, 1552819398244]}COLUMN CELL c2: timestamp=1552819392398, value=v21 row(s) in 0.0090 seconds# 获取指定列的值hbase(main):019:0> get 't1', 'r1', {COLUMN => 'c1'}COLUMN CELL c1: timestamp=1552819382575, value=v11111 row(s) in 0.0160 seconds# 获取指定列的值,多个值使用数组表示hbase(main):020:0> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']}COLUMN CELL c1: timestamp=1552819382575, value=v1111 c2: timestamp=1552819392398, value=v2 c3: timestamp=1552819398244, value=v33 row(s) in 0.0170 seconds# 获取c1的值,获取4个版本的值,默认是按照时间戳降续排序的hbase(main):021:0> get 't1', 'r1', {COLUMN => 'c1', VERSIONS => 4}COLUMN CELL c1: timestamp=1552819382575, value=v1111 c1: timestamp=1552819376343, value=v111 c1: timestamp=1552819368993, value=v11 c1: timestamp=1552819362975, value=v14 row(s) in 0.0180 seconds# 获取c1的3个版本值hbase(main):027:0* get 't1', 'r1', {COLUMN => 'c1', VERSIONS => 3}COLUMN CELL c1: timestamp=1552819382575, value=v1111 c1: timestamp=1552819376343, value=v111 c1: timestamp=1552819368993, value=v113 row(s) in 0.0090 seconds# 获取指定时间戳版本的列hbase(main):022:0> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => 1552819376343}COLUMN CELL c1: timestamp=1552819376343, value=v1111 row(s) in 0.0170 secondshbase(main):023:0> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => 1552819376343, VERSIONS => 4}COLUMN CELL c1: timestamp=1552819376343, value=v1111 row(s) in 0.0130 seconds# 获取rowKey=r1中的值等于v2的所有列hbase(main):024:0> get 't1', 'r1', {FILTER => "ValueFilter(=, 'binary:v2')"}COLUMN CELL c2: timestamp=1552819392398, value=v21 row(s) in 0.0510 secondshbase(main):025:0> get 't1', 'r1', {COLUMN => 'c1', ATTRIBUTES => {'mykey'=>'myvalue'}}COLUMN CELL c1: timestamp=1552819382575, value=v11111 row(s) in 0.0100 seconds
推荐阅读
- WinDbg Preview安装以及符号表配置
- Qt Designer、PyUIC、PyRcc PyCharm安装PyQt5及其工具详细教程
- CentOS 7 下安装 MySQL 8.x
- 18-基于CentOS7搭建RabbitMQ3.10.7集群镜像队列+HaProxy+Keepalived高可用架构
- win11安卓应用怎么安装_win11安卓应用安装方法
- 中国军棋怎么玩(中国军棋免费下载安装)
- 轻量级Web框架Flask——Web表单
- [CG从零开始] 3. 安装 pyassimp 库加载模型文件
- 企业运维 | MySQL关系型数据库在Docker与Kubernetes容器环境中快速搭建部署主从实践
- 【前端必会】使用indexedDB,降低环境搭建成本