- 浏览: 135410 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
h416373073:
正遇到了此问题不知如何解决, 多谢分享
solr + Tomcat安装 -
jack_boy:
blackproof 写道原来也用过es,超费内存,不如sol ...
ElasticSearch中文分词ik安装 -
blackproof:
原来也用过es,超费内存,不如solar好用
ElasticSearch中文分词ik安装
Java以为的语言访问Hbase都是通过thrift进行访问的,因此需要在Hbase上开启thrift服务
如果用
启动服务,默认用的是thrift2,在用happybase的时候会出现版本不兼容的问题,因此用thrift来启动
happybase使用很简单,与hbase shell 用法类似
主要的用法都很简单,在其官方网站happybase上都有。
这里主要记录一个错误。
源代码:
改为:
g = table.scan(filter="SingleColumnValueFilter('f', 'id', =, 'substring:852223')", limit=10)
程序正确运行,输出结果
参考:
http://hbase.apache.org/book/thrift.html#example-filter-strings
https://github.com/wbolster/happybase/blob/master/tests/test_api.py
如果用
hbase-deamon.sh start
启动服务,默认用的是thrift2,在用happybase的时候会出现版本不兼容的问题,因此用thrift来启动
hbase thrift -p 9090 start
happybase使用很简单,与hbase shell 用法类似
主要的用法都很简单,在其官方网站happybase上都有。
这里主要记录一个错误。
File "test.py", line 21, in <module> for k, d in g: File "/home/jack_boy/product/lib/python2.6/site-packages/happybase/table.py", line 374, in scan self.name, scan, {}) File "/home/jack_boy/product/lib/python2.6/site-packages/happybase/hbase/Hbase.py", line 1919, in scannerOpenWithScan return self.recv_scannerOpenWithScan() File "/home/jack_boy/product/lib/python2.6/site-packages/happybase/hbase/Hbase.py", line 1937, in recv_scannerOpenWithScan raise x thrift.Thrift.TApplicationException: Internal error processing scannerOpenWithScan
源代码:
import happybase import sys #reload(sys) #sys.setdefaultencoding('utf-8') connection = happybase.Connection('192.168.1.110') #connection.open() #print connection.tables() table = connection.table('testTable') g = table.scan(filter="SingleColumnValueFilter('f', 'id', =, '852223')", limit=10) for k, d in g: print k, d
改为:
g = table.scan(filter="SingleColumnValueFilter('f', 'id', =, 'substring:852223')", limit=10)
程序正确运行,输出结果
引用
The general syntax of a comparator is: ComparatorType:ComparatorValue
The ComparatorType for the various comparators is as follows:
BinaryComparator - binary
BinaryPrefixComparator - binaryprefix
RegexStringComparator - regexstring
SubStringComparator - substring
The ComparatorValue can be any value.
Example 12.3. Example 1
>, 'binary:abc' will match everything that is lexicographically greater than "abc"
Example 12.4. Example 2
=, 'binaryprefix:abc' will match everything whose first 3 characters are lexicographically equal to "abc"
Example 12.5. Example 3
!=, 'regexstring:ab*yz' will match everything that doesn't begin with "ab" and ends with "yz"
Example 12.6. Example 4
=, 'substring:abc123' will match everything that begins with the substring "abc123"
The ComparatorType for the various comparators is as follows:
BinaryComparator - binary
BinaryPrefixComparator - binaryprefix
RegexStringComparator - regexstring
SubStringComparator - substring
The ComparatorValue can be any value.
Example 12.3. Example 1
>, 'binary:abc' will match everything that is lexicographically greater than "abc"
Example 12.4. Example 2
=, 'binaryprefix:abc' will match everything whose first 3 characters are lexicographically equal to "abc"
Example 12.5. Example 3
!=, 'regexstring:ab*yz' will match everything that doesn't begin with "ab" and ends with "yz"
Example 12.6. Example 4
=, 'substring:abc123' will match everything that begins with the substring "abc123"
参考:
http://hbase.apache.org/book/thrift.html#example-filter-strings
https://github.com/wbolster/happybase/blob/master/tests/test_api.py
发表评论
-
fedora live use
2015-11-29 09:42 473vesamenu.c32:not a COM32R image ... -
远程拷贝文件
2015-05-08 09:57 394把机器上指定后缀名的代码,一股脑拷贝的别的机器上,lbin是主 ... -
Hive去重复数据
2015-03-23 15:33 7645Hive数据去重 insert overwrite table ... -
Mongodb C++ driver中的逻辑操作“或”
2015-01-28 15:17 2734Mongodb中的查询操作比 ... -
python中的生成器
2015-01-11 10:47 1104Python中的生成器 1. 什 ... -
ElasticSearch中文分词ik安装
2015-01-02 22:59 20112http://www.elasticsearch.org/ov ... -
ssh 无密码登陆
2014-12-26 14:03 660用$ssh-keygen -t rsa生成密钥与公钥 将.ss ... -
vim 非贪婪匹配
2014-11-13 15:14 2848vim的模式匹配使用正则表达式 .*是贪婪匹配,会匹配最多的字 ... -
[转]vim-airline in xshell or putty or MobaXterm
2014-11-11 13:36 6344windows下使用Xshell,putty或者是MobaXt ... -
跟踪同一个系统中不同进程的系统调用
2014-09-24 14:16 1198跟踪同一个系统中不同进程的系统调用 在编写多线程的程序时,偶 ... -
easy_install 报错
2013-11-26 10:32 1015easy_install -U distribute 后执行 ... -
python中的@
2013-11-15 11:31 0python中的@符号 在python中有一个@符号,起到装 ... -
LVS+keepalived配置备忘
2013-07-18 14:47 2788LVS + keepalived实现负载均衡的文档很多,这里不 ... -
Structs in ruby
2012-12-11 14:33 1142Ruby中的Struct是一个特殊的类,只(仅仅只)用来存取数 ... -
ruby mix-in
2012-12-10 16:49 1715Ruby mix-in Ruby 是一门面向对象的语言,所有一 ... -
gnome-shell安装
2012-09-04 12:54 13941. 安装gnome3 tweak tool工具,用于gnom ... -
源码编译安装mysql
2012-08-30 14:52 1372由于开发环境中的mysql有别的用处,为了不影响开发换进需要源 ... -
Linux网络参数优化
2012-08-21 18:47 2050net.ipv4.tcp_tw_reuse = 1 表示开启重 ... -
typedef定字符串数组类型
2012-07-24 14:06 1044typedef char char_array[1024]; ... -
tmux使用(程序员适用)
2012-07-12 16:53 32514tmux基本使用 tmux是一个优秀的终端复用软件,即 ...
相关推荐
博客配套文件,详细演示了python通过happybase查询hbase的代码使用。
Hbase.py 和 ttypes.py 用来替换原有的 hbase包里的文件,解决 from hbase import Hbase 报错问题。
java api 访问hbase demo(Maven) 详情请看:http://blog.csdn.net/wild46cat/article/details/53288537
hbase所需的jar包,HBase是建立在Hadoop文件系统之上的分布式面向列的数据库。它是一个横向扩展的开源项目。它提供对数据的随机实时读/写访问,并作为Hadoop文件系统的一部分。
java访问Hbase数据库实用小例子,增删改查创建表,教你轻松解决hbase
本文档详细说明了Linux和windows系统下配置thrift环境和hbaseC++客户端的使用。
博客配套文件,详细演示了go通过thrift1和thrift2接口访问hbase的方法,并给出了批量访问的简单封装接口。
C# 使用Microsoft.HBase.Client类库以Rest方式访问HBase数据库。实现了基本的增、删、改、查操作。方便新手入门学习。同时提供了Microsoft.HBase.Client源码。这源码是微软提供的,微软已经拥抱开源。
python通过thrift访问hbase.docx
spark本地模式访问hbase表进行map reduce操作
Java Hbase jar api hbase-0.20.6.jar hadoop-core-0.20.1.jar commons-logging-1.1.1.jar zookeeper-3.3.0.jar log4j-1.2.91.jar
这是hadoop项目中,使用Hbase进行明细查询所需要的jar包
java 利用 sping-data-hadoop HbaseTemplate 操作hbase find get execute 等方法 可以直接运行
通过thrift2方式调用hbase的c++代码,包含Makefile、DemoClient.cpp以及gen-cpp编译好的。直接make生成DemoClient程序,执行./DemoClient master(域名) 9090(默认端口号)
■使用本地java客户端,或者通过提供了rest、avro和thrift应用编程接口的网关服务器来访问hbase ■了解hbase架构的细节,包括存储格式、预写日志、后台进程等等 ■在hbase中集成用于海量并行数据处理任务的...
搭建pinpoint需要的hbase初始化脚本hbase-create.hbase
HBase(hbase-2.4.9-bin.tar.gz)是一个分布式的、面向列的开源数据库,该技术来源于 Fay Chang 所撰写的Google论文“Bigtable:一个结构化数据的分布式存储系统”。就像Bigtable利用了Google文件系统(File System...
1. HBase有哪些基本的特征? 1 HBase特征: 1 2. HBase相对于关系数据库能解决的问题是什么? 2 HBase与关系数据的区别? 2 HBase与RDBMS的区别? 2 3. HBase的数据模式是怎么样的?即有哪些元素?如何存储?等 3 1...
使用本地java客户端,或者通过提供了rest、avro和thrift应用编程接口的网关服务器来访问hbase;了解hbase架构的细节,包括存储格式、预写日志、后台进程等;在hbase中集成mapreduce框架;了解如何调节集群、设计模式...