Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Beeline command failing with error 4

avatar
Explorer

Hello Team,

I am running a process in which i am trying to run beeline command.
While running beeline command with sudo it is working but if i am trying to run beeline in a process which if forked from parent process with the hive user it is failing with error 4 

Can you please help me to debug what's going wrong or anything that i need to set.

If i do su hiveuser and run the same command t works but while running via process it is failing.

Command that i see while running via fork process :

bash /opt/cloudera/parcels/CDH-7.1.7-1.cdh7.1.7.p0.15945976/bin/../lib/hive/bin/beeline -u 'jdbc:hive2://machine1.domain.com:2181/default;password=***;principal=hive/_HOST@DOMAIN.COM;serviceDiscoveryMode=zooKeeper;ssl=true;sslTrustStore=/var/lib/cloudera-scm-agent/agent-cert/cm-auto-global_truststore.jks;trustStorePassword=*****;user=HiveUser;zooKeeperNamespace=hiveserver2' -n loki -n /tmp/cmdcvhive.4015998.140520474391872 --showHeader=false --outputformat=tsv2 -e 'use underscoretest; show tables;'

8 REPLIES 8

avatar
Contributor

@jayes Can you share the logs, its hard to say without looking at logs but just a hunch it can be because of Kerberos authentication.

avatar
Explorer

Hi @cloude ,

Which logs should i share cause the moment the beeline command is launched in another process it fails. so i dont have a way to check why is it failing. it just says process exited with error 4.

Can you please help here to know which logs file might have those error ?

avatar
Master Collaborator

@jayes The beeline command seems to be using both kerberos(principal) and username-password based authentication? What's the auth mechanism we are aiming for? Also, what's the error message? When you fork it from another process, which user the beeline command runs as? 

Within the JDBC connection string, we are trying to authenticate as "HiveUser" however we are also using -n switch and authenticating as loki user. It's confusing. We need not use "-n" in this case.

avatar
Explorer

Hi @smruti ,

The setup has kerberos authentication. 
There is no error message the moment the process is launched with loki user, the process exits with error 4.
Sorry but the HiveUser and loki user is same its just replacing the username went wrong.


The same command when i do su loki and then run the same command it works. or if the same command is ran using sudo it works. Issue is with launching it with other process. 

avatar
Master Collaborator

@jayes please share the exact error. What do you mean error code 4? Is it exit code? The error must be getting logged to stdout/stderr. If nothing is getting logged, in the JDBC connection string could you also add "--verbose=true" 

e.g.

bash /opt/cloudera/parcels/CDH-7.1.7-1.cdh7.1.7.p0.15945976/bin/../lib/hive/bin/beeline -u 'jdbc:hive2://machine1.domain.com:2181/default;password=***;principal=hive/_HOST@DOMAIN.COM;serviceDiscoveryMode=zooKeeper;ssl=true;sslTrustStore=/var/lib/cloudera-scm-agent/agent-cert/cm-auto-global_truststore.jks;trustStorePassword=*****;user=HiveUser;zooKeeperNamespace=hiveserver2' --showHeader=false --outputformat=tsv2 --verbose=true

avatar
Explorer

Hi @smruti ,

Yes the exit code is 4.

I tried to redirect the stdout and stderr to the file but there was no file created.

Following is output of ps -eaf : 

loki 3936766 3935975 0 02:06 ? 00:00:00 bash /opt/cloudera/parcels/CDH-7.1.7-1.cdh7.1.7.p0.15945976/bin/../lib/hive/bin/beeline -u 'jdbc:hive2://machine.domain.com:2181/default;password=**;principal=hive/_HOST@DEVEMC.COMMVAULT.COM;serviceDiscoveryMode=zooKeeper;ssl=true;sslTrustStore=/var/lib/cloudera-scm-agent/agent-cert/cm-auto-global_truststore.jks;trustStorePassword=***;user=loki;zooKeeperNamespace=hiveserver2' -n loki -n /tmp/cmdcvhive.3935975.140226804802880 --showHeader=false --outputformat=tsv2 --verbose=true -e 'use underscoretest; show tables;' >> /tmp/file 2>&1

loki 3936766 3935975 2 02:06 ? 00:00:00 bash /opt/cloudera/parcels/CDH-7.1.7-1.cdh7.1.7.p0.15945976/bin/../lib/hive/bin/beeline -u 'jdbc:hive2://machine.domain.com:2181/default;password=**;principal=hive/_HOST@DEVEMC.COMMVAULT.COM;serviceDiscoveryMode=zooKeeper;ssl=true;sslTrustStore=/var/lib/cloudera-scm-agent/agent-cert/cm-auto-global_truststore.jks;trustStorePassword=**;user=loki;zooKeeperNamespace=hiveserver2' -n loki -n /tmp/cmdcvhive.3935975.140226804802880 --showHeader=false --outputformat=tsv2 --verbose=true -e 'use underscoretest; show tables;' >> /tmp/file 2>&1


avatar
Master Collaborator

@jayes If we intend to use kerberos auth, we need to pass username in the connection string. Remove "user=loki" and also two usernames we passed using "-n".

-n loki -n /tmp/cmdcvhive.3935975.140226804802880

 In Beeline '-n' is used to pass the username for authentication purpose. If we are using kerberos, then we can avoid this completely.  Please review your script and fix it wherever this is coming from. Unless we review the complete script, it will be difficult to say what's causing this issue.

avatar
Explorer

Hello @smruti ,

Please let me know if any way where we can have call or meet to review the script ?

I will in mean time will try to remove the -n options and check if that works.