hive-site.xml 文件中添加配置
hive.metastore.schema.verification false hive.metastore.event.db.notification.api.auth false hive.metastore.warehouse.dir /user/hive/warehouse hive.metastore.uris thrift://192.168.1.35:9083 hive.server2.thrift.bind.host 192.168.1.35 hive.server2.thrift.port 10000 hive.server2.active.passive.ha.enable true
JDBC 方式访问 Hive时,必须开启hive的元数据存储;
启动 metastore
bin/hive --service metastore
2)启动 hiveserver2
bin/hive --service hiveserver2
启动 beeline 客户端(需要多等待一会)
bin/beeline -u jdbc:hive2://192.168.1.35:10000 -n atguigu
异常处理; zwl is not allowed to impersonate zwl
Caused by: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: root is not allowed to impersonate root
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:651) ~[hive-exec-3.1.2.jar:3.1.2]
at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:586) ~[hive-exec-3.1.2.jar:3.1.2]
at org.apache.hive.service.cli.session.HiveSessionImpl.open(HiveSessionImpl.java:179) ~[hive-service-3.1.2.jar:3.1.2]
修改hadoop的core-site.xml配置文件
表示可通过超级代理“xxx”操作hadoop的用户、用户组和主机
hadoop.proxyuser.root.groups
*
hadoop.proxyuser.root.hosts
*
hadoop.proxyuser.zwl.groups
*
hadoop.proxyuser.zwl.hosts
*
在conf/hive-site.xml中加入以下配置:
默认情况下HiveServer2 执行查询时使用的用户是提交查询的用户.但是如果将这个选项设置为false,查询将会使用运行hiveserver2的用户。
hive.server2.enable.doAs false



