1. install hive
2. start hiveserver2
查看hiverserver2 是否正常运行: ps -ef | grep hive
2. start beeline
3. 链接hive
!connect jdbc:hive2://localhost:10000 hadoop hadoop org.apache.hive.jdbc.HiveDriver
这个步骤容易发生错误
Error: Failed to open new session: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: root is not allowed to impersonate anonymous (state=,code=0)
Beeline version 2.1.0 by Apache Hive原因是因为hadoop 1.0 以后引入安全机制。下面董西城老师的博客详细讲解。
http://dongxicheng.org/mapreduce-nextgen/hadoop-secure-impersonation/