High-Availability
無法將 HDFS 從非 HA 轉換為 HA
介紹
**目標:**將 HDFS 從非 HA 轉換為 HA。
**方法:**根據本文件,應該可以通過實施以下配置將 HFDS 從非 HA 轉換為 HA:
/etc/hadoop/conf/hdfs-site.xml
<property> <name>dfs.ha.automatic-failover.enabled</name> <value>true</value> </property>
/etc/hadoop/conf/core-site.xml
<property> <name>ha.zookeeper.quorum</name> <value>localhost:2181</value> </property>
並執行以下命令:
sudo service hadoop-hdfs-journalnode start
sudo service hadoop-hdfs-zkfc start
hdfs namenode -initializeSharedEdits
sudo -u hdfs hdfs namenode -bootstrapStandby
sudo service hadoop-hdfs-namenode start
結果:
14/06/09 15:37:15 FATAL namenode.NameNode: Exception in namenode join java.io.IOException: org.apache.hadoop.HadoopIllegalArgumentException: HA is not enabled for this namenode. at org.apache.hadoop.hdfs.server.namenode.ha.BootstrapStandby.run(BootstrapStandby.java:310) at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1154) at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1241) Caused by: org.apache.hadoop.HadoopIllegalArgumentException: HA is not enabled for this namenode. at org.apache.hadoop.hdfs.server.namenode.ha.BootstrapStandby.parseConfAndFindOtherNN(BootstrapStandby.java:261) at org.apache.hadoop.hdfs.server.namenode.ha.BootstrapStandby.run(BootstrapStandby.java:92) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84) at org.apache.hadoop.hdfs.server.namenode.ha.BootstrapStandby.run(BootstrapStandby.java:305) ... 2 more 14/06/09 15:37:15 INFO util.ExitUtil: Exiting with status 1 14/06/09 15:37:15 INFO namenode.NameNode: SHUTDOWN_MSG: /************************************************************ SHUTDOWN_MSG: Shutting down NameNode at localhost/127.0.0.1 ************************************************************/
問題
如何將 HDFS 從非 HA 轉換為 HA?
應用本文件中定義的配置(請參閱配置詳細資訊段落)後,問題
HA is not enabled for this namenode
得到解決。<property> <name>dfs.namenode.rpc-address.mycluster.nn1</name> <value>machine1.example.com:8020</value> </property> <property> <name>dfs.namenode.rpc-address.mycluster.nn2</name> <value>machine2.example.com:8020</value> </property>
分別在 ActiveNN 和 StandyNN 上應用其他配置設置將 HDFS 從非 HA 轉換為 HA。