Support Questions

Find answers, ask questions, and share your expertise

Need suggestion for shell script for sqoop

avatar
Explorer

I am new to hortonworks . I have created a shell script with the Sqoop import command . I want to execute the .sh script to run the sqoop import command .


I have tried the following :

1. I have uploaded the .sh script in a folder /home/scripts/sqoop_test.sh

2. The permission : -rwxr-xr-x 1 root root 215 Jun 25 18:44 sqoop_test.sh

3. Then I tried to run the file : ./sqoop_test.sh

4. I am getting the error : Permission denied: user=root, access=WRITE, inode="/user":hdfs:hdfs:drwxr-xr-x


My query is :

1. Do I need to upload the .sh script in a folder within HDFS

2. How do I setup the permission for the script so that it runs successfully

3. How to execute .sh file from within hdfs so that I do not get the permission denied error


Thanks



1 ACCEPTED SOLUTION

avatar
Master Guru

@Rupak Dum

1. Do I need to upload the .sh script in a folder within HDFS

No need to upload .sh script to HDFS/

If you upload script to HDFS then follow this link to execute shell script from HDFS.

2. How do I setup the permission for the script so that it runs successfully

You are running sqoop import as root user for this case you need to change the permissions in HDFS for /user directory.

Refer to this and this link for similar kind of thread.

3. How to execute .sh file from within hdfs so that I do not get the permission denied error

change the permissions of /user hdfs directory to 700 (or) 777, then you won't get any permission issues.


View solution in original post

2 REPLIES 2

avatar
Master Guru

@Rupak Dum

1. Do I need to upload the .sh script in a folder within HDFS

No need to upload .sh script to HDFS/

If you upload script to HDFS then follow this link to execute shell script from HDFS.

2. How do I setup the permission for the script so that it runs successfully

You are running sqoop import as root user for this case you need to change the permissions in HDFS for /user directory.

Refer to this and this link for similar kind of thread.

3. How to execute .sh file from within hdfs so that I do not get the permission denied error

change the permissions of /user hdfs directory to 700 (or) 777, then you won't get any permission issues.


avatar
Explorer

@Shu

Thanks for your suggestion . I have changed the permission of the HDFS /user and the permission issue is gone and my sqoop command is running.