使用“start-dfs.sh”权限启动 Hadoop 文件系统被拒绝

使用“start-dfs.sh”权限启动 Hadoop 文件系统被拒绝

我尝试在独立节点上安装 hbase,但是在启动 Hadoop 文件系统时遇到一些问题start-dfs.sh

mike@mike-thinks:/usr/local/hadoop/sbin$ ./start-dfs.sh 
Incorrect configuration: namenode address dfs.namenode.servicerpc-address or dfs.namenode.rpc-address is not configured.
Starting namenodes on []
./start-dfs.sh: line 61: /usr/local/hadoop/sbin/hadoop-daemons.sh: Permission denied
./start-dfs.sh: line 74: /usr/local/hadoop/sbin/hadoop-daemons.sh: Permission denied
Starting secondary namenodes [0.0.0.0]
./start-dfs.sh: line 87: /usr/local/hadoop/sbin/hadoop-daemons.sh: Permission denied

使用 sudo 的话:

mike@mike-thinks:/usr/local/hadoop/sbin$ sudo ./start-dfs.sh 
[sudo] password for mike: 
Incorrect configuration: namenode address dfs.namenode.servicerpc-address or dfs.namenode.rpc-address is not configured.
Starting namenodes on []
./start-dfs.sh: line 61: /usr/local/hadoop/sbin/hadoop-daemons.sh: Permission denied
./start-dfs.sh: line 74: /usr/local/hadoop/sbin/hadoop-daemons.sh: Permission denied
Starting secondary namenodes [0.0.0.0]
./start-dfs.sh: line 87: /usr/local/hadoop/sbin/hadoop-daemons.sh: Permission denied

所以我做了sudo chmod +x /usr/local/hadoop/sbin/

mike@mike-thinks:/usr/local/hadoop/sbin$ sudo chmod +x /usr/local/hadoop/sbin/
[sudo] password for mike: 
mike@mike-thinks:/usr/local/hadoop/sbin$ ./start-dfs.sh 
Incorrect configuration: namenode address dfs.namenode.servicerpc-address or dfs.namenode.rpc-address is not configured.
Starting namenodes on []
./start-dfs.sh: line 61: /usr/local/hadoop/sbin/hadoop-daemons.sh: Permission denied
./start-dfs.sh: line 74: /usr/local/hadoop/sbin/hadoop-daemons.sh: Permission denied
Starting secondary namenodes [0.0.0.0]
./start-dfs.sh: line 87: /usr/local/hadoop/sbin/hadoop-daemons.sh: Permission denied

我还没有尝试进入 sshd_config,将 PermitRootLogin without-password 更改为 PermitRootLogin yes,然后按照 gsamaras 的建议重启 ssh相关问题但这似乎不太可能联系起来。


我做了一个chmod +x *.sh并解决了这个问题。现在我有一个Incorrect configuration错误:

mike@mike-thinks:/usr/local/hadoop/sbin$ ./start-dfs.sh 
Incorrect configuration: namenode address dfs.namenode.servicerpc-address or dfs.namenode.rpc-address is not configured.
Starting namenodes on []
localhost: mkdir: cannot create directory ‘/usr/local/hadoop/logs’: Permission denied
localhost: chown: cannot access '/usr/local/hadoop/logs': No such file or directory
localhost: starting namenode, logging to /usr/local/hadoop/logs/hadoop-mike-namenode-mike-thinks.out
localhost: /usr/local/hadoop/sbin/hadoop-daemon.sh: line 159: /usr/local/hadoop/logs/hadoop-mike-namenode-mike-thinks.out: No such file or directory
localhost: head: cannot open '/usr/local/hadoop/logs/hadoop-mike-namenode-mike-thinks.out' for reading: No such file or directory
localhost: /usr/local/hadoop/sbin/hadoop-daemon.sh: line 177: /usr/local/hadoop/logs/hadoop-mike-namenode-mike-thinks.out: No such file or directory
localhost: /usr/local/hadoop/sbin/hadoop-daemon.sh: line 178: /usr/local/hadoop/logs/hadoop-mike-namenode-mike-thinks.out: No such file or directory
localhost: mkdir: cannot create directory ‘/usr/local/hadoop/logs’: Permission denied
localhost: chown: cannot access '/usr/local/hadoop/logs': No such file or directory
localhost: starting datanode, logging to /usr/local/hadoop/logs/hadoop-mike-datanode-mike-thinks.out
localhost: /usr/local/hadoop/sbin/hadoop-daemon.sh: line 159: /usr/local/hadoop/logs/hadoop-mike-datanode-mike-thinks.out: No such file or directory
localhost: head: cannot open '/usr/local/hadoop/logs/hadoop-mike-datanode-mike-thinks.out' for reading: No such file or directory
localhost: /usr/local/hadoop/sbin/hadoop-daemon.sh: line 177: /usr/local/hadoop/logs/hadoop-mike-datanode-mike-thinks.out: No such file or directory
localhost: /usr/local/hadoop/sbin/hadoop-daemon.sh: line 178: /usr/local/hadoop/logs/hadoop-mike-datanode-mike-thinks.out: No such file or directory
Starting secondary namenodes [0.0.0.0]
The authenticity of host '0.0.0.0 (0.0.0.0)' can't be established.
ECDSA key fingerprint is SHA256:/s7X8QMliB6FVx5bde5AaCycprQ/B+NtcTXrInrXxJM.
Are you sure you want to continue connecting (yes/no)? no
0.0.0.0: Host key verification failed.

答案1

# Create the .ssh directory:
$ mkdir ~/.ssh

# Set the right permissions:
$ chmod 700 ~/.ssh

# Create the authorized_keys file:
$ touch ~/.ssh/authorized_keys

# Set the right permissions:
$ chmod 600 ~/.ssh/authorized_keys

权限很重要!没有正确的权限就无法工作!

现在您可以将公钥添加到authorized_keys文件中:

$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

最后你可以执行:

$ ./start-dfs.sh

相关内容