配置文件
1.core配置:
[qujian@master hadoop]$ vim core-site.xml<property> <name>fs.defaultFS</name> <value>hdfs://mycluster</value></property><property> <name>io.file.buffer.size</name> <value>4096</value></property><property> <name>hadoop.tmp.dir</name> <value>file:/home/qujian/hadoop-2.7.2/tmp</value></property><property> <name>ha.zookeeper.quorum</name> <value>master.hadoop.cn:2181,second1.hadoop.cn:2181,second2.hadoop.cn:2181</value></property><property> <name>ha.zookeeper.session-timeout.ms</name> <value>1000</value></property>修改mapred-site.xml<property> <name>mapreduce.framework.name</name> <value>yarn</value></property>修改yarn-site.xml<property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value></property><property> <name>yarn.nodemanager.aux-services.mapreduce_shuffle.class</name> <value>org.apache.hadoop.mapred.ShuffleHandler</value></property><property> <name>yarn.resourcemanager.address</name> <value>master.hadoop.cn:8032</value></property><property> <name>yarn.resourcemanager.scheduler.address</name> <value>master.hadoop.cn:8030</value></property><property> <name>yarn.resourcemanager.resource-tracker.address</name> <value>master.hadoop.cn:8031</value></property><property> <name>yarn.resourcemanager.admin.address</name> <value>master.hadoop.cn:8033</value></property><property> <name>yarn.resourcemanager.webapp.address</name> <value>master.hadoop.cn:8088</value></property>修改hdfs-site.xml<property> <name>dfs.namenode.name.dir</name> <value>file:/home/qujian/hadoop-2.7.2/name</value></property><property> <name>dfs.datanode.data.dir</name> <value>file:/home/qujian/hadoop-2.7.2/data</value></property><property> <name>dfs.replication</name> <value>3</value></property><property> <name>dfs.webhdfs.enabled</name> <value>true</value></property><property> <name>dfs.permissions.enabled</name> <value>false</value></property><property> <name>dfs.nameservices</name> <value>mycluster</value></property><property> <name>dfs.ha.namenodes.mycluster</name> <value>nn1,nn2</value></property><property> <name>dfs.namenode.rpc-address.mycluster.nn1</name> <value>master.hadoop.cn:9000</value></property><property> <name>dfs.namenode.rpc-address.mycluster.nn2</name> <value>second1.hadoop.cn:9000</value></property><property> <name>dfs.namenode.servicerpc-address.mycluster.nn1</name> <value>master.hadoop.cn:53310</value></property><property> <name>dfs.namenode.servicerpc-address.mycluster.nn2</name> <value>second1.hadoop.cn:53310</value></property><property> <name>dfs.namenode.http-address.mycluster.nn1</name> <value>master.hadoop.cn:50070</value></property><property> <name>dfs.namenode.http-address.mycluster.nn2</name> <value>second1.hadoop.cn:50070</value></property><property> <name>dfs.namenode.shared.edits.dir</name> <value>qjournal://second2.hadoop.cn:8485;data1.hadoop.cn:8485;data2.hadoop.cn:8485/mycluster</value></property><property> <name>dfs.client.failover.proxy.provider.mycluster</name> <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value></property><property> <name>dfs.ha.fencing.methods</name> <value>sshfence</value></property><property> <name>dfs.ha.fencing.ssh.private-key-files</name> <value>/home/qujian/.ssh/id_rsa</value></property><property> <name>dfs.ha.fencing.ssh.connect-timeout</name> <value>30000</value></property><property> <name>dfs.journalnode.edits.dir</name> <value>/home/qujian/hadoop-2.7.2/journal</value></property><property> <name>dfs.ha.automatic-failover.enabled</name> <value>true</value></property><property> <name>ha.failover-controller.cli-check.rpc-timeout.ms</name> <value>60000</value></property><property> <name>ipc.client.connect-timeout</name> <value>60000</value></property><property> <name>dfs.p_w_picpath.transfer.bandwidthPerSec</name> <value>4194304</value></property>配置data服务器:[qujian@master hadoop]$ cat slaves second2.hadoop.cndata1.hadoop.cndata2.hadoop.cnfor n in second1.hadoop.cn second2.hadoop.cn data1.hadoop.cn data2.hadoop.cndoscp -rp /home/qujian/hadoop-2.7.2 $n:~/waitdone