如何配置hadoop使用非默认端口:“0.0.0.0:ssh:连接到主机0.0.0.0端口22:连接被拒绝”

ma8fv8wu  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(837)

当我运行start dfs时,出现以下错误,看起来我需要告诉hadoop使用不同的端口,因为这是我在ssh到localhost时所需要的。换言之,以下工作成功: ssh -p 2020 localhost. ```
[Wed Jan 06 16:57:34 root@~]# start-dfs.sh
16/01/06 16:57:53 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Starting namenodes on [localhost]
localhost: namenode running as process 85236. Stop it first.
localhost: datanode running as process 85397. Stop it first.
Starting secondary namenodes [0.0.0.0]
0.0.0.0: ssh: connect to host 0.0.0.0 port 22: Connection refused
16/01/06 16:57:56 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

core-site.xml:
<property>
    <name>dfs.namenode.name.dir</name>
    <value>file:///hadoop/hdfs/namenode</value>
</property>

<property>
    <name>dfs.datanode.data.dir</name>
    <value>file:///hadoop/hdfs/datanode</value>
</property>
sbtkgmzw

sbtkgmzw1#

如果hadoop集群节点在非标准端口上运行sshd侦听,那么可以告诉hadoop脚本启动到该端口的ssh连接。实际上,可以自定义传递给ssh命令的任何选项。
这由名为的环境变量控制 HADOOP_SSH_OPTS . 您可以编辑hadoop-env.sh文件并在那里定义它(默认情况下,未定义此环境变量。)
例如:

export HADOOP_SSH_OPTS="-p 2020"

相关问题