Skip to main content

Posts

Showing posts from January, 2022

Use Encrypted Password in Linux / Unix Shell Script

  Easiest available way is using Openssl Encrypt  Say your actual password is "Password12345". You can encrypt using below command - echo "Password12345" | openssl enc -aes-256-cbc -md sha512 -a -pbkdf2 -iter 100000  -salt -pass pass:Secret@1234# > secret.txt Resultant output in " secret.txt" U2FsdGVkX1/2NoQ6i1uZKK4yk+5gm5cA13EJ2TiPbcw= Save this in a file and use it with your applications. Decrypt  Then you can read file with encrypted password, decrypt it using below command and pass it to henceforth operations/ commands. cat "secret.txt" | openssl enc -aes-256-cbc -md sha512 -a -d -pbkdf2 -iter 100000 -salt -pass pass:Secret@123# Resultant output  Password12345

Spark Performance Tunning Example 1

  We had a Spark Job which was taking over 3 hours to complete.  First, We found the stage which was taking time. Refer details as below - This is simply reading file and mapping data to final save location. So, there are not much joins or calculations involved. Second, We saw event time line, if there is any delay due to serialization/ shuffling/ scheduling. But, there was nothing. Third, we saw total executors and tasks processed by them. There are 5 executors each taking over 3 hours and each executing approximately 500 tasks. Which means that a task is taking almost 2.8 -3 minutes Fourth, to confirm there is no data skew, we sorted the tasks to see maximum duration and maximum input a task processed, and maximum shuffle. And, we found nothing. So conclusively, we could say that there is no problem with Job. Why Job is slow, is because it has less number of executors or eventually less vcores for task processing. Thus, we bumped up Number of Executors from 5 to 30. And, each executo

Hadoop Distcp Error Duplicate files in input path

  One may face following error while copying data from one cluster to other, using Distcp  Command: hadoop distcp -i {src} {tgt} Error: org.apache.hadoop.toolsCopyListing$DulicateFileException: File would cause duplicates. Ideally there can't be same file names. So, what might be happening in your case is you trying to copy partitioned table from one cluster to other. And, 2 different named partitions have same file name. Your solution is to correct Source path  {src}  in your command, such that you provide path uptil partitioned sub directory, not the file. For ex - Refer below : /a/partcol=1/file1.txt /a/partcol=2/file1.txt If you use  {src}  as  "/a/*/*"  then you will get the error  "File would cause duplicates." But, if you use  {src}  as  "/a"  then you will not get error in copying.

Hive SQL( using TEZ as execution engine) not giving result on empty partition

  Hive SQL( using TEZ as execution engine) not giving incorrect, or not expected results on empty partitions. We got this issue on Hive version: 3.1.0.3.1.5.0-152 ( HDP Version 3.1.5.0-152) To replicate the issue -  --Create external Table 1) Create external table test_tbl ( name string) partitioned by ( company string, processdate string) stored as orc location '/my/some/random/location';  -- Add partion 2) Alter table test_tbl add partition ( company='aquaifer', processdate='20220101');   -- Execute following SQL's which returns no records. 3) select max( company ) , processdate  from test_tbl  group by processdate  ; 4) select max(processdate ) from test_tbl  ;   Same SQL (#3 & #4 above) , when execute with SPARK, returns  '0' count and  '20220101' respectively.  So as a solution, we started using "spark-sql" instead of "hive/ beeline" We didn't find a solution with hive for above inconsistency, and following bu