Support Questions

Find answers, ask questions, and share your expertise

Hive beeline -e in shell script

avatar
Rising Star

Hi,

Our cluster is secured using Kerberos. Now I need to run hive queries in a shell script which would be scheduled to run periodically.

In my shell script, I was thinking to use the below commands in sequence

>beeline -u"jdbc:hive2://$hive_server2:10000/$hive_db;principal=$user_principal"

>beeline -e"SHOW DATABASES"

But then I realised that once I run the beeline -u command, it would take me to the beeline shell instead of being in the bash shell. So wondering how to get this sorted out. I need to use beeline -e command, but need to connect to the cluster first using kerberos principal. Any ideas whats the best way to handle this?

FYI, we are not using Oozie, but shell script with crontab scheduling.

Thanks

10 REPLIES 10

avatar
New Contributor

Hi bigdatasuperno,

 

I need a beeline shell script which should connect hive url and print the no. of tables in the db and print the record count of each table in the output file.

 

Your help will greatly appreciated.  I belongs to different technology. 

 

 

Regards,

Vin