Skip to main content
jayes
Silver ⭐️⭐️⭐️
December 19, 2023
Question

Beeline command failing with error 4

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

cloude
Gold ⭐️
Gold ⭐️
December 21, 2023

@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.

Translate
jayes
jayesAuthor
Silver ⭐️⭐️⭐️
December 22, 2023

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 ?

Translate
smruti
Gold ⭐️⭐️⭐️
Gold ⭐️⭐️⭐️
December 21, 2023

@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.

Translate
jayes
jayesAuthor
Silver ⭐️⭐️⭐️
December 22, 2023

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. 

Translate
smruti
Gold ⭐️⭐️⭐️
Gold ⭐️⭐️⭐️
December 22, 2023

@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
Translate