在Hadoop中,可以通过配置SSH密钥来实现用户的验证登录。以下是配置步骤:
ssh-keygen -t rsa
按照提示操作,生成的密钥对会存储在用户的家目录下的.ssh
文件夹中,分别为id_rsa
和id_rsa.pub
。
authorized_keys
文件中:将公钥id_rsa.pub
的内容追加到Hadoop集群节点的authorized_keys
文件中。cat id_rsa.pub >> ~/.ssh/authorized_keys
ssh
命令测试是否能够通过密钥验证登录到Hadoop集群节点。ssh user@hadoop-node
在core-site.xml
中添加:
<property>
<name>hadoop.security.authentication</name>
<value>publickey</value>
</property>
在hdfs-site.xml
中添加:
<property>
<name>dfs.block.access.token.enable</name>
<value>true</value>
</property>
sbin/stop-all.sh
sbin/start-all.sh
现在,您可以使用SSH密钥验证登录到Hadoop集群节点了。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: hadoop如何查看目录大小