java<\/a>_home \u542f\u52a8\u7684\u65f6\u5019\u4f1a\u5931\u8d25\u3002<\/span><\/strong><\/p>\n<\/span>CENTOS \u914d\u7f6eJDK\u6559\u7a0b\uff1ahttp:\/\/blog.csdn.net\/a295277302\/article\/details\/70245779<\/span><\/strong><\/p>\n<\/span><\/strong><\/span><\/p>\n\u5185\u5bb9\u4e3a\uff1a<\/span><\/strong><\/span><\/p>\n<configuration>
\n <property>
\n <name>dfs.nameservices<\/name>
\n <value>htf<\/value>
\n <\/property>
\n <property>
\n <name>dfs.ha.namenodes.htf<\/name>
\n <value>nn1,nn2<\/value>
\n <\/property>
\n <property>
\n <name>dfs.namenode.rpc-address.htf.nn1<\/name>
\n <value>192.168.6.128:8020<\/value>
\n <\/property>
\n <property>
\n <name>dfs.namenode.rpc-address.htf.nn2<\/name>
\n <value>192.168.6.129:8020<\/value>
\n <\/property>
\n <property>
\n <name>dfs.namenode.http-address.htf.nn1<\/name>
\n <value>192.168.6.128:50070<\/value>
\n <\/property>
\n <property>
\n <name>dfs.namenode.http-address.htf.nn2<\/name>
\n <value>192.168.6.129:50070<\/value>
\n <\/property>
\n <property>
\n <name>dfs.namenode.shared.edits.dir<\/name>
\n <value>qjournal:\/\/192.168.6.129:8485;192.168.6.130:8485;192.168.6.132:8485\/htf<\/value>
\n <\/property>
\n <property>
\n <name>dfs.client.failover.proxy.provider.htf<\/name>
\n <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider<\/value>
\n <\/property>
\n <property>
\n <name>dfs.ha.fencing.methods<\/name>
\n <value>sshfence<\/value>
\n <\/property>
\n <property>
\n <name>dfs.ha.fencing.ssh.private-key-files<\/name>
\n <value>\/root\/.ssh\/id_dsa<\/value>
\n <\/property>
\n <property>
\n <name>dfs.journalnode.edits.dir<\/name>
\n <value>\/opt\/jn\/data<\/value>
\n <\/property>
\n <property>
\n <name>dfs.ha.automatic-failover.enabled<\/name>
\n <value>true<\/value>
\n <\/property>
\n<\/configuration><\/span><\/strong><\/span><\/span><\/p>\n
<\/span><\/strong><\/p>\n\u4fee\u6539 vim core-site.xml<\/span><\/strong><\/p>\n<\/span>\u5185\u5bb9\u4e3a\uff1a<\/span><\/strong><\/p>\n<configuration>
\n <property>
\n <name>fs.defaultFS<\/name>
\n <value>hdfs:\/\/htf<\/value>
\n <\/property>
\n <property>
\n <name>ha.zookeeper.quorum<\/name>
\n <value>192.168.6.128:2181,192.168.6.129:2181,192.168.6.130:2181<\/value>
\n <\/property>
\n <property>
\n <name>hadoop.tmp.dir<\/name>
\n <value>\/opt\/hadoop2<\/value>
\n <\/property>
\n<\/configuration><\/span><\/strong><\/span><\/p>\n
<\/span><\/strong><\/span><\/p>\n\u4fee\u6539slaves\u6587\u4ef6<\/span><\/strong><\/span><\/p>\nvim slaves<\/span><\/strong><\/span><\/span><\/p>\n<\/span>192.168.6.129
<\/span>192.168.6.130
<\/span>192.168.6.132
<\/span><\/strong><\/p>\n<\/span><\/strong><\/span><\/p>\n
<\/span><\/strong><\/span><\/p>\n<\/span>\u914d\u7f6e<\/span>\u5b8c\u8fd9\u4e9b\u4e4b\u540e \u683c\u5f0f\u5316namenode -format<\/span><\/span><\/span><\/p>\n<\/span>\u8fdb\u5165cd \/home\/hadoop-2.5\/bin<\/span><\/strong><\/span><\/p>\n<\/span>.\/hdfs namenode\n -format<\/span><\/span><\/strong><\/span><\/p>\n<\/span>\u4e4b\u540e\u5728\u914d\u7f6e\u7684\u6570\u636e\u6587\u4ef6\u5939\u4e0b\u80fd\u770b\u5230\u683c\u5f0f\u5316\u7684\u6570\u636e\u6587\u4ef6<\/span><\/strong><\/span><\/span><\/p>\n\/opt\/hadoop2\/dfs\/name\/current<\/span><\/strong><\/span><\/span><\/span><\/p>\n<\/span><\/strong><\/span><\/span><\/p>\n
<\/span><\/strong><\/span><\/span><\/p>\n<\/span>\u5148<\/span>\u5c06\u4e00\u79cd\u914d\u7f6e\u7684\u914d\u7f6e\u6587\u4ef6\u53d1\u9001\u5230\u5176\u4ed6\u670d\u52a1\u5668\u4e2d\u3002<\/span><\/span><\/span><\/p>\n<\/span>scp -r \/home\/hadoop-2.5\/etc\/hadoop\/* 192.168.6.129:\/home\/hadoop-2.5\/etc\/hadoop<\/span><\/strong><\/span><\/p>\n<\/span>\u5176\u4ed6\u670d\u52a1\u5668\u4e5f\u8981\u590d\u5236\u8fc7\u53bb\uff0c\u6b64\u5904\u4e0d\u4e00\u4e00\u6982\u8ff0<\/span><\/strong><\/span><\/p>\n<\/span><\/span><\/strong><\/span><\/p>\n<\/span>\u4e4b\u540e<\/span>\u8981\u5728\u53e6\u5916\u4e00\u4e2anamenode\u4e2d\u683c\u5f0f\u5316 namenode,\u5373\u751f\u6210\/opt\/hadoop2\/dfs\/name\/current<\/span><\/span><\/span><\/span><\/span><\/p>\n<\/span>\u4e0b\u7684\u6570\u636e\u6587\u4ef6<\/span><\/strong><\/span><\/p>\n<\/span>\u5b98\u7f51\u8bf4\u660e\uff1a<\/span><\/strong><\/span><\/p>\n- If you have already formatted the NameNode, or are converting a non-HA-enabled cluster to be HA-enabled, you should now copy over the contents of your NameNode metadata directories to the\n other, unformatted NameNode by running the command \"hdfs namenode -bootstrapStandby<\/em>\" on the unformatted NameNode. Running this command will also ensure that the JournalNodes (as configured bydfs.namenode.shared.edits.dir) contain sufficient edits\n transactions to be able to start both NameNodes.<\/span><\/strong><\/li><\/ul>
<\/strong><\/span><\/span><\/div>\n<\/span>\u4e4b\u540e\u5728129\u670d\u52a1\u5668\u4e2d\u8fd0\u884c<\/span><\/strong><\/div>\n<\/span>cd \/home\/hadoop-2.5\/bin<\/span><\/strong><\/div>\n<\/span>.\/hdfs namenode -bootstrapStandby<\/span><\/span><\/strong><\/div>\n<\/strong><\/span><\/span><\/span><\/div>\n<\/span>\u4e5f\u4f1a\u5728\/opt\/hadoop2\/dfs\/name\/current<\/span>\u4e0b\u751f\u6210\u6570\u636e\u6587\u4ef6<\/span><\/strong><\/div>\n
<\/span><\/strong><\/div>\n<\/span>\u5728128\u670d\u52a1\u5668\u4e0a\u683c\u5f0f\u5316 zkfc<\/span><\/strong><\/div>\n<\/span>cd \/home\/hadoop-2.5\/bin<\/span>
<\/span><\/span>\n\t<\/span> .\/hdfs zkfc -formatZK<\/span><\/strong><\/pre>\n<\/div>\n<\/span><\/span><\/strong><\/div>\n