Created 07-05-2018 09:15 AM
When try to open hive through beeline it connects properly to beeline-hiveserver2, but if I use any query on that then it does not give response. for ex. if I hit query show databases then give just empty list (no database is shown). Ideally it should show the list of databases present on that cluster.
Created 07-05-2018 09:19 AM
Do you have Ranger policies defined for Hive? If yes, check if the login user has use/select on the databases.
Also, you could check the 'show databases' from Hive Cli as it by-passes the Ranger.
Created 07-05-2018 09:30 AM
@Sindhu Yes I have a ranger policy for hive and login user has all permissions on all databases. And I have also checked on hive cli show databases its working it gives us all databases.
Created 07-05-2018 09:33 AM
Can you share the screenshot of the Ranger policy and also, error snippet from Hiveserver2 log?
Created on 07-05-2018 09:44 AM - edited 08-18-2019 02:22 AM
I don't know how to check hiveserver2 logs.
Created 07-05-2018 09:54 AM
This might be a lame question. Are you sure that you are connecting to the right HiveServer ?
Can you please copy the url from hive configs and try connecting to it
Go to Ambari -> Hive -> Summary -> HiveServer2 JDBC URL (Copy this url) and try to connect to it and see if this works.
.
-Aditya
Created 07-05-2018 10:16 AM
@ Aditya Sirna
Yes I am sure that I am connecting to the right hiveserver. Still there is same issue.
Created on 07-05-2018 10:28 AM - edited 08-18-2019 02:22 AM
I checked internally and below policy works:
beeline> !connect jdbc:hive2://:2181,:2181,:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2 Connecting to jdbc:hive2://:2181,:2181,:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2 Enter username for jdbc:hive2://:2181,:2181,:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2: hive Enter password for jdbc:hive2://:2181,:2181,:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2: **** Connected to: Apache Hive (version 1.2.1000.2.6.5.0-292) Driver: Hive JDBC (version 1.2.1000.2.6.5.0-292) 0: jdbc:hive2://xxx:> show databases; +----------------+--+ | database_name| +---------------+--+ | default| | testdb | +----------------+--+2 rows selected (0.362 seconds)
Created 07-06-2018 06:54 AM
Were you able to verify with the permissions?
Created 07-06-2018 07:17 PM
Is your cluster kerberized. If so, are you using the relevant kerberos ticket for the user, please confirm
Created 07-09-2018 09:28 AM
@ssanthosh No the cluster is not kerberized. Is it necessary that cluster should be kerberized?
Created 07-09-2018 06:46 PM
@Anjali Shevadkar It is not mandatory, but the recommended config is to use Ranger in a secure cluster
Created 07-09-2018 09:33 AM
I am using 2 clusters cluster1 and cluster2. I have all the process on both. on cluster1 its working fine. But on second cluster there is issue. On second cluster Ranger and hive version is same as on cluster1 only the difference is cluster version is different.
Created 07-10-2018 05:05 PM
@Anjali Shevadkar If you do the same thing using hive cli instead beeline, can you see the databases? Can other people see something?
In my case I am used to use the connection as below:
beeline -u "jdbc:hive2://zookeeperfqdn1:2181,zookeeperfqdn2:2181,zookeeperfqdn3:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2"
Try use ZK FQDN instead hiveserver2 fqdn.
Created 07-11-2018 06:21 AM
@Eric Leme If I use Hive cli then I can see all Dbs. But Ranger doesn't support or doesn't work with Hive CLI. Ranger policies only work with Beeline. Is there is any requirement of Ranger that ranger should need a particular HDP version?
Created 07-11-2018 12:13 PM
@Anjali Shevadkar you are right, that's why I asked you to check hive cli, so, seems to be some configuration in your ranger. Did you try to connect using ZK hosts on your connection string?
I suggest you check this following document, check the permissions on HDFS. Let me know if this works for you.
Make sure the user that you configure as the same as the unix user (or ldap, whatever). Try to configure another user to test.
https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.6.5/bk_security/content/configure_ranger_authen...
Another important thing, check the permissions on your HDFS, because when you are using ranger you need to change the owner/group and permissions
https://br.hortonworks.com/blog/best-practices-in-hdfs-authorization-with-apache-ranger/