需求描述:
今天一个同事,问如何在phoenix中查询hbase中表的结构,在此记录下.
操作过程:
1.通过phoenix客户端连接到hbase数据库
[aiprd@host-10-191-5-227 bin]$ ./sqlline.py 10.191.5.225,10.191.5.226,10.191.5.227:2181 Setting property: [incremental, false] Setting property: [isolation, TRANSACTION_READ_COMMITTED] issuing: !connect jdbc:phoenix:10.191.5.225,10.191.5.226,10.191.5.227:2181 none none org.apache.phoenix.jdbc.PhoenixDriver Connecting to jdbc:phoenix:10.191.5.225,10.191.5.226,10.191.5.227:2181 18/04/11 15:43:26 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable Connected to: Phoenix (version 4.10) Driver: PhoenixEmbeddedDriver (version 4.10) Autocommit status: true Transaction isolation: TRANSACTION_READ_COMMITTED Building list of tables and columns for tab-completion (set fastconnect to true to skip)... 832/832 (100%) Done Done sqlline version 1.2.0 0: jdbc:phoenix:10.191.5.225,10.191.5.226,10.> #出现此提示符,表示已经成功连接到了hbase数据库
2.通过phoenix的!describe命令来查看表的结构
!describe SYNC_COMM_STOCK_BARCOD
执行结果:
备注:以上就是通过!describe显示出来的表结构
文档创建时间:2018年4月11日15:45:56