2014-04-20 3 views
3

AWS EMR을 설정했습니다. 나는 마스터 노드에 SSH. hdfs 시스템에 파일을 복사하고 싶었습니다. 내 프로그램에서이 작은 코드 행은 다음과 같습니다.hadoop을 사용하기 위해 ec2 사용자 추가

os.system('/home/hadoop/bin/hdfs dfs -put %s PATH_to_HADOOP' % tmp_output) 

내 hdfs 파일 시스템 경로를 입력하고 싶습니다.

http://cloudcelebrity.wordpress.com/2013/06/05/handling-permission-denied-error-on-hdfs/

하지만 작성 후 :

나는 나는 그래서,이 지침을 따라 하둡을 사용하는 EC2 사용자 추가

[[email protected] input]$ /home/hadoop/bin/hdfs dfs -mkdir /tmp/stockmarkets 
mkdir: Permission denied: user=ec2-user, access=EXECUTE, inode="/tmp":hadoop:supergroup:drwxrwx--- 

[[email protected] input]$ /home/hadoop/bin/hdfs dfs -ls/
Found 2 items 
drwxr-xr-x - hadoop supergroup   0 2014-04-14 22:21 /hbase 
drwxrwx--- - hadoop supergroup   0 2014-04-14 22:19 /tmp 

을 시도 할 (우분투를 ec2 사용자로 대체)

sudo adduser ec2-user hadoop 

대신 추가 메시지를 받고, 나는 얻을 :

Usage: useradd [options] LOGIN 
Options: 
    -b, --base-dir BASE_DIR  base directory for the home directory of the 
           new account 
    -c, --comment COMMENT   GECOS field of the new account 
    -d, --home-dir HOME_DIR  home directory of the new account 
    -D, --defaults    print or change default useradd configuration 
    -e, --expiredate EXPIRE_DATE expiration date of the new account 
    -f, --inactive INACTIVE  password inactivity period of the new account 
    -g, --gid GROUP    name or ID of the primary group of the new 
           account 
    -G, --groups GROUPS   list of supplementary groups of the new 
           account 
    -h, --help     display this help message and exit 
    -k, --skel SKEL_DIR   use this alternative skeleton directory 
    -K, --key KEY=VALUE   override /etc/login.defs defaults 
    -l, --no-log-init    do not add the user to the lastlog and 
           faillog databases 
    -m, --create-home    create the user's home directory 
    -M, --no-create-home   do not create the user's home directory 
    -N, --no-user-group   do not create a group with the same name as 
           the user 
    -o, --non-unique    allow to create users with duplicate 
           (non-unique) UID 
    -p, --password PASSWORD  encrypted password of the new account 
    -r, --system     create a system account 
    -s, --shell SHELL    login shell of the new account 
    -u, --uid UID     user ID of the new account 
    -U, --user-group    create a group with the same name as the user 
    -Z, --selinux-user SEUSER  use a specific SEUSER for the SELinux user mapping 

그래서> 도와주세요 ... 모든 혼란과 나사입니다 ....

답변

5

SSH를/내부 디렉토리를 생성 tmp를 HDFS 위치보십시오.

거기에서 "su"하지 않고도 HDFS로 원하는 모든 것을 할 수 있습니다. 방금 mkdir을하고 distcp와 스트리밍 작업을했습니다. EMR 지침에 따라 모든 것을 할 수 있습니다.

+0

이 간단한 해결책은 나를 일하게 만들었습니다. ec2 사용자로 처리하는 방법을 찾는 것이 좋을지라도. 그래서 며칠 동안 용출을 기다리고 대답을 받아 들일 것입니다 .. 그래도 고맙습니다. –

+1

아마존의 문서에서 아마존은 다음과 같이 말할 것입니다 : 로그인 이름을 사용해야합니다. hadoop Amazon EMR 클러스터 노드에 연결하면 서버와 비슷한 오류가 발생하여 키 오류가 발생할 수 있습니다. http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/emr-connect-master-node-ssh.html –

0

당신이에 대한 권한을 보면 HDFS 디렉토리/tmp에서/tmp는 사용자 hadoop이 소유하고 있으며, ec2-user은/tmp 안에 파일/디렉토리를 만들 권한이 없음을 볼 수 있습니다.

/tmp 디렉토리에 대한 적절한 권한을 지정하려면 다음 명령을 사용하십시오

[[email protected] input]$ sudo -su hadoop /home/hadoop/bin/hdfs dfs -chmod 777 /tmp 

이제 하둡 @ 아마존 EMR에 대한 (publicIP)로

[[email protected] input]$ /home/hadoop/bin/hdfs dfs -mkdir /tmp/stockmarkets 
+0

안녕하세요,이 메시지가 나왔습니다. '죄송합니다. ec2 사용자가/bin/bash-c/home/hadoop/bin/hdfs dfs -chmod 777/tmp'를 ip- 172-31-0-185.us-west-2.compute.internal' –

+0

명령을 실행하여 "cat/etc/passwd | grep hadoop"출력을 게시 할 수 있습니까 – sachin

+0

여기에'hadoop : x : 220 : 501 ::/home/hadoop :/bin/bash' –