尝试运行一个简单的shell脚本,该脚本由我常规执行以设置Hadoop环境的一组命令组成。首先,我在手动执行这些命令之前通过' ssh localhost '进行连接,我想自动执行此过程,我正在执行以下操作,导致下面列出的错误。请注意我可以从命令提示符手动执行这些命令。请帮帮我。
我做了什么
$sudo chmod 777 hadoop-startup-script.sh
$ssh localhost
$./hadoop-startup-script.sh
这会导致以下错误
(~($))sh hadoop-startup-script.sh
hadoop-startup-script.sh: 2: cd: can't cd to /home/hadoop/hadoop-0.20.204.0
hadoop-startup-script.sh: 3: hadoop-startup.sh: bin/hadoop: not found
hadoop-startup-script.sh: 4: hadoop-startup.sh: bin/start-all.sh: not found
hadoop-startup-script.sh: 5: hadoop-startup.sh: bin/hadoop: not found
hadoop-startup-script.sh: 6: hadoop-startup.sh: bin/hadoop: not found
hadoop-startup-script.sh: 7: hadoop-startup.sh: bin/hadoop: not found
hadoop-startup-script.sh: 8: hadoop-startup.sh: bin/hadoop: not found
hadoop-startup-script.sh: 9: hadoop-startup.sh: bin/hadoop: not found
hadoop-startup-script.sh: 10: hadoop-startup.sh: bin/hadoop: not found
hadoop-startup-script.sh
的内容#! /bin/bash
cd ~/hadoop-0.20.204.0
bin/hadoop namenode -format
bin/start-all.sh
bin/hadoop fs -mkdir input
bin/hadoop fs -mkdir input/oreilly
bin/hadoop fs -put /home/hadoop/Dropbox/hadoop/hadoop-inputs/oreilly-programmingPig/*.* /user/hadoop/input/oreilly/
bin/hadoop fs -put /home/hadoop/Dropbox/hadoop/hadoop-inputs/oreilly-programmingPig/NYSE_dividends /user/hadoop/input/oreilly/
bin/hadoop fs -put /home/hadoop/Dropbox/hadoop/hadoop-inputs/oreilly-programmingPig/baseball /user/hadoop/input/oreilly/
bin/hadoop fs -put /home/hadoop/Dropbox/hadoop/hadoop-inputs/oreilly-programmingPig/NYSE_daily /user/hadoop/input/oreilly/
答案 0 :(得分:2)
错误告诉您位置~/hadoop-0.20.204.0
,bin/hadoop
和bin/start-all.sh
不存在。
您的意思是~/bin
,/bin
还是~/hadoop-0.20.204.0/bin
?如果您的意思是~/hadoop-0.20.204.0/bin
,那么第一个失败的cd
会解释以下错误。仔细检查文件夹的名称和权限。