当前位置: 首页 > 工具软件 > things.sh > 使用案例 >

【Bug记录】hadoop启动失败:hadoop-config.sh: Syntax error: word unexpected (expecting ")")

长孙嘉
2023-12-01

Bug背景

未修改任何配置的情况下,重启hadoop

biglucky@localhost>sh start-all.sh 
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
start-all.sh: 112: /opt/hadoop-2.7.1/sbin/../libexec/hadoop-config.sh: Syntax error: word unexpected (expecting ")")

提示了“Syntax error: word unexpected (expecting “)”)”这样的异常,而这段期间我没有修改过任何配置。于是各种找资料使用
sudo sh start-all.sh
等这样的命令也会出错。

解决方式

1.bash执行

bash start-all.sh 

2. 直接运行

>start-all.sh

结果

后来发现,直接运行start-all.sh 脚本不会出错:


biglucky@localhost>start-all.sh 
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hadoop-2.7.1/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/kael/CDH/hbase/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Starting namenodes on [ubuntu]
ubuntu: starting namenode, logging to /opt/hadoop-2.7.1/logs/hadoop-kael-namenode-ubuntu.out
ubuntu: SLF4J: Class path contains multiple SLF4J bindings.

总结

1. bash 和 sh 不同:一般的,sh是bash的“子集” (不是子集的部分,具体区别见下的“Things sh has that bash does not”)

(1)sh一般设置成bash的软链接;

在一般的linux操作系统之中,使用sh等于打开了bash的posix的标准模式 ,等于执行

bash --posix

(2)sh与bash的区别相当于 bash的posix标准模式与bash的区别,其中就有let截取字符串等。

“sh”并不是一个程序,而是一种标准(POSIX),这种标准,在一定程度上保证了脚本的跨系统性(跨UNIX系统)

 类似资料: