Hive提供了三種用戶端提供者:
1)Hive CLI(Hive Command Line,Hive命令列),用戶端可以直接在命令列模式下進行操作。
2)hwi(Hive Web Interface,Hive Web介面),Hive提供了更直觀的Web介面
3)hiveserver,Hive提供了Thrift服務,Thrift用戶端目前支援C++/Java/PHP/Python/Ruby。
下面我們來分別嘗試下這三種介面訪問方式:
一、Hive CLI
直接鍵入hive命令即可進入CLI模式:
[cloud@cloud01 lib]$ hiveHive history file=/tmp/cloud/hive_job_log_cloud_201110311056_1009535967.txthive> show tables;OKtesthivedrivertableTime taken:3.038 secondshive>select*from testhivedrivertable;OKTime taken:0.905 secondshive> quit;[cloud@cloud01 lib]$
更多的命令選項,參見官方wiki,Hive Cli
二、Hive hwi
Hive hwi提供了一個更直觀的web介面,使用起來更方便。
1)啟動hive hwi
[cloud@cloud01 ~]$ hive --service hwi11/10/3110:14:11 INFO hwi.HWIServer: HWI is starting up11/10/3110:14:11 INFO mortbay.log:Logging to org.slf4j.impl.Log4jLoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog11/10/3110:14:11 INFO mortbay.log: jetty-6.1.1411/10/3110:14:11 INFO mortbay.log:Extract jar:file:/data/cloud/hive-0.7.1/lib/hive-hwi-0.7.1.war!/ to /tmp/Jetty_0_0_0_0_9999_hive.hwi.0.7.1.war__hwi__.hf8ccz/webapp11/10/3110:14:12 INFO mortbay.log:StartedSocketConnector@0.0.0.0:9999
2)通過hwi方式訪問Hive
我的Hive部署在10.46.169.101機器上,hive預設hwi連接埠為9999。我們在瀏覽器中鍵入http://10.46.169.101:9999/hwi/ 就可以訪問了。