CDH Namenode自动切换(active-standby)
1. 先切换到hdfs 用户,做免密码登录
ssh -keygen -t rsa
touch /var/lib/hadoop-hdfs/.ssh/authorized_keys
chmod 755 /var/lib/hadoop-hdfs/.ssh/authorized_keys
把两台hdfs 用户的id_rsa.pub 分别写入对方的authorized_keys文件中
2. 在两台机器上创建 /home/hdfs/.ssh
把两台机器hdfs 用户的 id_rsa 都拷到各自的 /home/hdfs/.ssh
chown hdfs:hdfs -R /home/hdfs/
3. 在hdfs-site.xml 配置
<property>
<name>dfs.ha.fencing.ssh.private-key-files</name>
<value>/home/hdfs/.ssh/id_rsa_1,/home/hdfs/.ssh/id_rsa_2</value>
</property>
【推荐】2025 HarmonyOS 鸿蒙创新赛正式启动,百万大奖等你挑战
【推荐】博客园的心动:当一群程序员决定开源共建一个真诚相亲平台
【推荐】开源 Linux 服务器运维管理面板 1Panel V2 版本正式发布
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步