1、将hadoop解压
su hadoop cd ~ tar -zxvf /home/neohope/Desktop/hadoop-2.7.1.tar.gz
2、修改/home/hadoop/hadoop-2.7.1/etc/hadoop/路径下配置
2.1、core-site.xml
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!-- Put site-specific property overrides in this file. --> <configuration> <property> <name>fs.defaultFS</name> <value>hdfs://hadoop-master:9000</value> </property> <property> <name>fs.default.name</name> <value>hdfs://hadoop-master:9000</value> </property> <property> <name>hadoop.tmp.dir</name> <value>file:/home/hadoop/hadoop-2.7.1/tmp</value> </property> <property> <name>io.file.buffer.size</name> <value>131702</value> </property> </configuration>
2.2、hdfs-site.xml
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!-- Put site-specific property overrides in this file. --> <configuration> <property> <name>dfs.namenode.name.dir</name> <value>file:/home/hadoop/hadoop-2.7.1/hdfs/name</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>file:/home/hadoop/hadoop-2.7.1/hdfs/data</value> </property> <property> <name>dfs.replication</name> <value>3</value> </property> <property> <name>dfs.namenode.secondary.http-address</name> <value>hadoop-master:9001</value> </property> <property> <name>dfs.webhdfs.enabled</name> <value>true</value> </property> </configuration>
2.3、mapred-site.xml
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!-- Put site-specific property overrides in this file. --> <configuration> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> <property> <name>mapreduce.jobhistory.address</name> <value>hadoop-master:10020</value> </property> <property> <name>mapreduce.jobhistory.webapp.address</name> <value>hadoop-master:19888</value> </property> <property> <name>mapreduce.map.memory.mb</name> <value>2048</value> </property> <property> <name>mapreduce.reduce.memory.mb</name> <value>2048</value> </property> </configuration>
2.4、yarn-site.xml
<?xml version="1.0"?> <!-- Site specific YARN configuration properties --> <configuration> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.nodemanager.auxservices.mapreduce.shuffle.class</name> <value>org.apache.hadoop.mapred.ShuffleHandler</value> </property> <property> <name>yarn.resourcemanager.address</name> <value>hadoop-master:8032</value> </property> <property> <name>yarn.resourcemanager.scheduler.address</name> <value>hadoop-master:8030</value> </property> <property> <name>yarn.resourcemanager.resource-ticker.address</name> <value>hadoop-master:8031</value> </property> <property> <name>yarn.resourcemanager.admin.address</name> <value>hadoop-master:8033</value> </property> <property> <name>yarn.resourcemanager.webapp.address</name> <value>hadoop-master:8088</value> </property> <property> <name>yarn.resourcemanager.resource.memory-mb</name> <value>2048</value> </property> <property> <name>yarn.nodemanager.resource.memory-mb</name> <value>2048</value> </property> </configuration>
2.5、slaves
#localhost hadoop-slave01 hadoop-slave02
3、修改/home/hadoop/hadoop-2.7.1/etc/hadoop/路径下JAVA路径
3.1、hadoop-env.sh
# The java implementation to use. #export JAVA_HOME=${JAVA_HOME} export JAVA_HOME=/usr/java/jdk1.7.0_79
3.2、yarn-env.sh
# some Java parameters # export JAVA_HOME=/home/y/libexec/jdk1.6.0/ if [ "$JAVA_HOME" != "" ]; then #echo "run java in $JAVA_HOME" #JAVA_HOME=$JAVA_HOME JAVA_HOME=/usr/java/jdk1.7.0_79 fi
4、分发hadoop文件夹到各slave
scp -r /home/hadoop/hadoop-2.7.1 hadoop@hadoop-slave01:~/ scp -r /home/hadoop/hadoop-2.7.1 hadoop@hadoop-slave02:~/
5、初始化主服务器
cd ~/hadoop-2.7.1 bin/hdfs namenode -format
6、启动hadoop
cd ~/hadoop-2.7.1 sbin/start-dfs.sh sbin/start-yarn.sh
7、查看hadoop进程信息
/usr/java/jdk1.7.0_79/bin/jps
8、查看cluster信息
http://10.10.10.3:8088
9、查看hdfs文件系统信息
http://10.10.10.3:50070
10、Hadoop常用端口如下
端口 | 作用 |
9000 | fs.defaultFS |
9001 | dfs.namenode.rpc-address口 |
50070 | dfs.namenode.http-address |
50470 | dfs.namenode.https-address |
50100 | dfs.namenode.backup.address |
50105 | dfs.namenode.backup.http-address |
50090 | dfs.namenode.secondary.http-address |
50091 | dfs.namenode.secondary.https-address |
50020 | dfs.datanode.ipc.address |
50075 | dfs.datanode.http.address |
50475 | dfs.datanode.https.address |
50010 | dfs.datanode.address |
8480 | dfs.journalnode.rpc-address |
8481 | dfs.journalnode.https-address |
8032 | yarn.resourcemanager.address |
8088 | yarn.resourcemanager.webapp.address |
8090 | yarn.resourcemanager.webapp.https.address |
8030 | yarn.resourcemanager.scheduler.address |
8031 | yarn.resourcemanager.resource-tracker.address |
8033 | yarn.resourcemanager.admin.address |
8042 | yarn.nodemanager.webapp.address |
8040 | yarn.nodemanager.localizer.address |
8188 | yarn.timeline-service.webapp.address |
10020 | mapreduce.jobhistory.address |
19888 | mapreduce.jobhistory.webapp.address |
2888 | ZooKeeper,Leader用来监听Follower的连接 |
3888 | ZooKeeper,用于Leader选举 |
2181 | ZooKeeper,用来监听客户端的连接 |
60010 | hbase.master.info.port |
60000 | hbase.master.port |
60030 | hbase.regionserver.info.port |
60020 | hbase.regionserver.port |
8080 | hbase.rest.port |
10000 | hive.server2.thrift.port |
9083 | hive.metastore.uris |