說明: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')