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>

posted on 2017-07-15 14:15  Gcam  阅读(1626)  评论(0编辑  收藏  举报

导航