说明:hbase的thriftserver默认已经编译好,可以使用,不需要跟hadoop thrift一样配置。
启动thrift server
要使用Hbase的thrift接口,必须将它的服务启动,命令行为:
hbase-daemon.sh start thrift
thrift默认的监听端口是9090,可以用netstat -nl | grep 9090看看该端口是否有服务。
针对性配置文件
vi hbase-site.xml
<property>
<name>hbase.regionserver.thrift.framed</name>
<value>true</value>
</property>
<property>
<name>
hbase.regionserver.thrift.compact</name>
<value>true</value>
</property>
实现连接
HBASE的python接口之参数指定
conn = happybase.Connection(host="10.255.111.92",port=9090,protocol='compact',transport='framed')