代码之家  ›  专栏  ›  技术社区  ›  Cutis

happybase connection.tables()返回TTransportException。python中的END_OF_FILE

  •  0
  • Cutis  · 技术社区  · 1 年前

    我试图使用hapybase用python将数据保存在hbase中。即使与thrift2的连接看起来正常,我在尝试获取hbase表列表时也会遇到此错误。

    …引发TTransportException(类型=TTransportException.END_OF_FILE, thrifty2.transport.base。TTransportException: TTransportException(类型=4,消息='Socket读取0字节')

    这是我的代码:

    ...
    conn = happybase.Connection(host="127.0.0.1", port=9090)
    conn.open()
    table = conn.table(topic_name)
    
    rows = table.scan()
    
    if not rows:
        try:
            conn.create_table(topic_name, {'cf': {}})
            print("Table created!")
        except:
            print("Maybe table already exists but just empty!")
    else:
        print(row for row in rows)
    
    tables = conn.tables()
    print(tables)
    ...
    

    这是输出。

    enter image description here

    enter image description here

    enter image description here

    奇怪的是,我对“.create_table()”或“.table())”happybase函数没有错误,只对获取表列表有错误:“.tables()”。当然,在hbase命令行中,没有显示表,因此没有创建表。

    我做错了什么?

    0 回复  |  直到 1 年前