在部署单节点Hadoop集群时,执行sbin/start-dfs.sh出现以下错误:
$ sbin/start-dfs.sh
Starting namenodes on [localhost]
pdsh@frin: localhost: rcmd: socket: Permission denied
Starting datanodes
pdsh@frin: localhost: rcmd: socket: Permission denied
Starting secondary namenodes [frin]
pdsh@frin: frin: rcmd: socket: Permission denied
首先,检查pdsh的Rcmd type配置:
$ pdsh -q -w localhost
-- DSH-specific options --
Separate stderr/stdout Yes
Path prepended to cmd none
Appended to cmd none
Command: none
Full program pathname /usr/bin/pdsh
Remote program path /usr/bin/pdsh
-- Generic options --
Local username zhangjc
Local uid 1000
Remote username zhangjc
Rcmd type rsh
one ^C will kill pdsh No
Connect timeout (secs) 10
Command timeout (secs) 0
Fanout 32
Display hostname labels Yes
Debugging No
-- Target nodes --
localhost
从配置项中可以看到Rcmd type为rsh,应该配置为ssh。两种解决方式:
一、在 .bashrc 中添加环境变量:
export PDSH_RCMD_TYPE=ssh
重新加载 .bashrc后问题解决:
$ source ~/.bashrc
二、配置文件方式:
在/etc/pdsh/下创建rcmd_default文件,输入内容:ssh。