1、通过hbase shell命令操作:
describe ‘tablename’
显示emp表的描述,输入命令:describe ‘emp’,结果如下:
2、使用thrift API接口显示表的信息,代码如下:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# coding=utf-8
from thrift.transport.TSocket import TSocket
from thrift.transport.TTransport import TBufferedTransport
from thrift.protocol import TBinaryProtocol
from hbase import Hbase
# 主机地址及端口号,端口号默认为9090
host = 'localhost'
port = 9090
# 初始化链接
transport = TBufferedTransport(TSocket(host, port))
transport.open()
protocol = TBinaryProtocol.TBinaryProtocol(transport)
client = Hbase.Client(protocol)
# 显示表列组的描述
print client.getColumnDescriptors('empbypy')
transport.close()
运行结果如下:
最后
以上就是害怕云朵最近收集整理的关于HBase表描述的全部内容,更多相关HBase表描述内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复