我是靠谱客的博主 害怕云朵,最近开发中收集的这篇文章主要介绍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表描述所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部