1. 程式人生 > >Hadoop集群搭建筆記

Hadoop集群搭建筆記

reduce ati prompt ucc xshell 格式化 load obj apache

1、安裝虛擬機

VMware workstation

CentOS 鏡像

安裝Linux虛擬機:(在Win7上)

1)安裝VMwareWorkstations(可修改配置)

2)添加CentOS鏡像(啟動安裝 ->配置網絡)

網絡配置:NAT模式

網絡重啟:service network restart

關閉系統:shutdown -h now

2、遠程連接

Xshell5

Xftp5

3、在Linux上搭建Hadoop集群

下載軟件

1. Jdk:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

2. Hadoop包:http://apache.fayea.com/hadoop/common/hadoop-2.7.2/

步驟:

1、修改/etc/hosts

CentOS修改主機名(hostname) 需要修改兩處:一處是/etc/sysconfig/network,另一處是/etc/hosts

2、配置JDK

安裝:rpm -ivh jdk-8u101-linux-x64.rpm

vi /etc/profile
JAVA_HOME
source /etc/profile
java -version

3、配置SSH(免密碼登錄)

ssh-keygen -t rsa
cat xxx.pub >> authorized_keys
chmod 644 authorized_keys
ssh IP/HOSTNAME

4、安裝及配置Hadoop

tar zxf hadoop-2.7.2.tar.gz
cd /opt/hadoop-2.7.2/etc/hadoop/

core-site.xml

<property>
<name>fs.default.name</name>
<value>hdfs://bigdata:9000</value>
</property>

<property>
<name>hadoop.tmp.dir</name>
<value>/opt/hadoop-2.7.2/current/tmp</value>
</property>
<property>
<name>fs.trash.interval</name>
<value>4320</value>
</property>

hdfs-site.xml

<property>
<name>dfs.namenode.name.dir</name>
<value>/opt/hadoop-2.7.2/current/dfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/opt/hadoop-2.7.2/current/data</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
<property>
<name>dfs.permissions.superusergroup</name>
<value>staff</value>
</property>
<property>
<name>dfs.permissions.enabled</name>
<value>false</value>
</property>

yarn-site.xml

<property>
<name>yarn.resourcemanager.hostname</name>
<value>bigdata</value>
</property>
<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>bigdata:18040</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>bigdata:18030</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>bigdata:18025</value>
</property> <property>
<name>yarn.resourcemanager.admin.address</name>
<value>bigdata:18141</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address</name>
<value>bigdata:18088</value>
</property>
<property>
<name>yarn.log-aggregation-enable</name>
<value>true</value>
</property>
<property>
<name>yarn.log-aggregation.retain-seconds</name>
<value>86400</value>
</property>
<property>
<name>yarn.log-aggregation.retain-check-interval-seconds</name>
<value>86400</value>
</property>
<property>
<name>yarn.nodemanager.remote-app-log-dir</name>
<value>/tmp/logs</value>
</property>
<property>
<name>yarn.nodemanager.remote-app-log-dir-suffix</name>
<value>logs</value>
</property>

mapred-site.xml

<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>mapreduce.jobtracker.http.address</name>
<value>bigdata:50030</value>
</property>
<property>
<name>mapreduce.jobhisotry.address</name>
<value>bigdata:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>bigdata:19888</value>
</property>
<property>
<name>mapreduce.jobhistory.done-dir</name>
<value>/jobhistory/done</value>
</property>
<property>
<name>mapreduce.intermediate-done-dir</name>
<value>/jobhisotry/done_intermediate</value>
</property>
<property>
<name>mapreduce.job.ubertask.enable</name>
<value>true</value>
</property>

slaves

bigdata

hadoop-env.sh

JAVA_HOME

5、格式化HDFS

hdfs namenode -format

‘16/09/0403:07:30 INFO common.Storage: Storage directory /opt/hadoop-2.7.2/current/dfs/namehas been successfully formatted.

6、啟動Hadoop集群

/opt/hadoop-2.7.2/sbin/start-all.sh

7、驗證Hadoop集群

1)jps

2)

關閉防火墻 或者 在防火墻的規則中開放這些端口

hdfs http://bigdata:50070

yarn http://bigdata:18088

Hadoop集群搭建筆記