hdfs
ref
配置文件
1 <?xml version="1.0" encoding="UTF-8"?> 2 <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> 3 16 17 18 19 <configuration> 20 21 <property> 22 <name>dfs.nameservicesname> 23 <value>myclustervalue> 24 property> 25 26 27 <property> 28 <name>dfs.ha.namenodes.myclustername> 29 <value>nn1,nn2value> 30 property> 31 32 33 <property> 34 <name>dfs.namenode.rpc-address.mycluster.nn1name> 35 <value>hadoop1:9000value> 36 property> 37 38 <property> 39 <name>dfs.namenode.http-address.mycluster.nn1name> 40 <value>hadoop1:50070value> 41 property> 42 43 44 <property> 45 <name>dfs.namenode.rpc-address.mycluster.nn2name> 46 <value>hadoop2:9000value> 47 property> 48 49 <property> 50 <name>dfs.namenode.http-address.mycluster.nn2name> 51 <value>hadoop2:50070value> 52 property> 53 54 55 <property> 56 <name>dfs.namenode.shared.edits.dirname> 57 <value>qjournal://hadoop1:8485;hadoop2:8485;hadoop3:8485/myclustervalue> 58 property> 59 60 61 <property> 62 <name>dfs.journalnode.edits.dirname> 63 <value>/data/journaldatavalue> 64 property> 65 66 67 <property> 68 <name>dfs.ha.automatic-failover.enabledname> 69 <value>truevalue> 70 property> 71 72 73 <property> 74 <name>dfs.client.failover.proxy.provider.myclustername> 75 <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvidervalue> 76 property> 77 78 79 80 <property> 81 <name>dfs.ha.fencing.methodsname> 82 <value> 83 sshfence 84 shell(/myclustern/true) 85 value> 86 property> 87 88 89 <property> 90 <name>dfs.ha.fencing.ssh.private-key-filesname> 91 <value>/home/hadoop/.ssh/id_rsavalue> 92 property> 93 94 95 <property> 96 <name>dfs.ha.fencing.ssh.connect-timeoutname> 97 <value>30000value> 98 property> 99 100 101 102 configuration>
core-site.xml
1 <?xml version="1.0" encoding="UTF-8"?> 2 <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> 3 16 17 18 19 <configuration> 20 <property> 21 <name>fs.defaultFSname> 22 <value>hdfs://myclustervalue> 23 <final>truefinal> 24 property> 25 26 <property> 27 <name>hadoop.tmp.dirname> 28 <value>/data/hadoop/tmpvalue> 29 property> 30 31 32 33 <property> 34 <name>ha.zookeeper.quorumname> 35 <value>hadoop1:2181,hadoop2:2181,hadoop3:2181value> 36 property> 37 38 39 configuration>
1,start all zk
2,start journalnode on each vm
hadoop start journalnode
3, hadoop format
hdfs namenode -format
4, copy all hadoop tmp/dir to slaves
scp -r tmp/ yun@mini02:/app/hadoop
5, format ZK
hdfs zkfc -formatZK
6, start-dfs.sh