Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Incremental record count after Kerberos Authentication implementation and Ranger Installation

avatar
Contributor

Hi.....

 

We are using following commands to get the updated records count in our table after Kerberos Authentication implementation and Ranger Installation.

 

We get count1 variable before update the table

count1=$(beeline -u "jdbc:hive2://dev-lisa.realm.com:10000/default;principal=hive/[email protected];ssl=true;sslTrustStore=/var/lib/cloudera-scm-agent/agent-cert/cm-auto-global_truststore.jks" -n hadoopuser02 -e 'SELECT count(*) from table_name; ')

 

We get count2 variable after update the table

count2=$(beeline -u "jdbc:hive2://dev-lisa.realm.com:10000/default;principal=hive/[email protected];ssl=true;sslTrustStore=/var/lib/cloudera-scm-agent/agent-cert/cm-auto-global_truststore.jks" -n hadoopuser02 -e 'SELECT count(*) from table_name; ')

 

entries=$(echo "$count2-$count1")

we unable to get the "entries" value into variable. please support to fix this.

1 ACCEPTED SOLUTION

avatar
Master Collaborator

@Choolake Try this:

count1=$(beeline -u "jdbc:hive2://dev-lisa.realm.com:10000/default;principal=hive/[email protected];ssl=true;sslTrustStore=/var/lib/cloudera-scm-agent/agent-cert/cm-auto-global_truststore.jks" --showHeader=false --silent=true --outputformat=tsv2 -e 'SELECT count(*) from table_name;')
 

 These beeline flags will remove all the unnecessary texts from the stdout. Compute count2 the same way.

View solution in original post

4 REPLIES 4

avatar
Master Collaborator

@Choolake Try :

entries=$((count2-count1))

This should work provided we have valid values on both variables.

avatar
Contributor

Thank you for the support comment. still issue not fixed. i think there is an issue in count1 and count2 getting commands. Please support?

avatar
Master Collaborator

@Choolake Try this:

count1=$(beeline -u "jdbc:hive2://dev-lisa.realm.com:10000/default;principal=hive/[email protected];ssl=true;sslTrustStore=/var/lib/cloudera-scm-agent/agent-cert/cm-auto-global_truststore.jks" --showHeader=false --silent=true --outputformat=tsv2 -e 'SELECT count(*) from table_name;')
 

 These beeline flags will remove all the unnecessary texts from the stdout. Compute count2 the same way.

avatar
Contributor

Great... Thank you very much!

it's working....