0

I am writing an automation batch script that will check beeline status in a scheduled interval of time.
I have written the code below to do this, but the problem is that, it seems the edge nodes of my cluster requires password to run the beeline command.
Code:

for node in `cat /root/myscripts/edgeNodes.txt`
do
ssh ${node} "beeline -u  jdbc:hive2://${node}:10000/default -n $usrnm -p $pwd -e 'select  col1 , col2 from my_tab limit 3;'" >> /root/report/beeline_report.txt
done

The -n $ntid -p $pwd is where the roadblock is. Right now I'm passing the username and password as my parameters, but while deploying it I can't hardcode my password in this script as the script is automated and doesn't require human inputs (I will have to remove the -n $ntid -p $pwd part. Also the passwords keep changing every month).
Is there a way to change the Beeline configurations to remove the authentication requirement? If yes, then how should I proceed, which files do I make changes to ?
Please help,
Regards.

aiman
  • 1,049
  • 19
  • 57

1 Answers1

1

I run command from shell script file using:

beeline -u "jdbc:hive2://" -e "your query" > output.txt

OR

ssh ${node} "beeline -u "jdbc:hive2://" -e 'query;'"

I hope this helps.

Kenzzz
  • 85
  • 1
  • 7
  • if i don't pass the -n and -p parameters, it doesn't authenticate me at those nodes and throws error of Authentication Failure. Any idea how to remove the authentication configuration from beeline so that it doesn't require any username and password to run queries ? – aiman May 17 '16 at 11:19
  • 1
    I found this post http://stackoverflow.com/questions/29113323/connecting-to-hive-using-beeline. This might be helpful for you. – Kenzzz May 17 '16 at 18:57