我是靠谱客的博主 害怕云朵,这篇文章主要介绍HBase表描述,现在分享给大家,希望可以做个参考。

1、通过hbase shell命令操作:
describe ‘tablename’
显示emp表的描述,输入命令:describe ‘emp’,结果如下:
这里写图片描述
2、使用thrift API接口显示表的信息,代码如下:

    # 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表描述内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(87)

评论列表共有 0 条评论

立即
投稿
返回
顶部