IP | 主机名 | 用户名 | 密码 |
192.168.1.151 | hadoop-master-001 | hadoop | |
192.168.1.152 | hadoop-slave-001 | hadoop | |
192.168.1.153 | hadoop-slave-002 | hadoop |
cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
vim /etc/rc.local 加入如下代码: if test -f /sys/kernel/mm/transparent_hugepage/enabled; then echo never > /sys/kernel/mm/transparent_hugepage/enabled fi if test -f /sys/kernel/mm/transparent_hugepage/defrag; then echo never > /sys/kernel/mm/transparent_hugepage/defrag fi
cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
export PATH=$PATH:/usr/local/hadoop/bin:/usr/local/hadoop/sbin
配置之前,需要在001本地文件系统创建以下文件夹:
/home/hadoop/name
/home/hadoop/data
/home/hadoop/temp
这里要涉及到的配置文件有7个:
~/hadoop-2.7.2/etc/hadoop/hadoop-env.sh
~/hadoop-2.7.2/etc/hadoop/yarn-env.sh
~/hadoop-2.7.2/etc/hadoop/slaves
~/hadoop-2.7.2/etc/hadoop/core-site.xml
~/hadoop-2.7.2/etc/hadoop/hdfs-site.xml
~/hadoop-2.7.2/etc/hadoop/mapred-site.xml
~/hadoop-2.7.2/etc/hadoop/yarn-site.xml
修改配置(如何系统已经设置了JAVA_HOME,也要配置env.sh)
在192.168.1.151 服务器上进入 /home/hdfs/hadoop-2.7.2/etc/hadoop
配置文件1:hadoop-env.sh
修改JAVA_HOME值(export JAVA_HOME=/usr/java/default)
配置文件2:yarn-env.sh
修改JAVA_HOME值(export JAVA_HOME=/usr/java/default)
配置文件3:slaves (这个文件里面保存所有slave节点)
写入以下内容:
hadoop-slave-001 hadoop-slave-002
配置文件4:core-site.xml
<configuration> <property> <name>fs.defaultFS</name> <value>hdfs://hadoop-master-001:9000</value> </property> <property> <name>hadoop.tmp.dir</name> <value>file:/home/hadoop/temp</value> <description>Abase for other temporary directories.</description> </property> </configuration>
配置文件5:hdfs-site.xml
<configuration> <property> <name>dfs.namenode.secondary.http-address</name> <value>hadoop-master-001:9001</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>file:/home/hadoop/name</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>file:/home/hadoop/data</value> </property> <property> <name>dfs.replication</name> <value>3</value> </property> <property> <name>dfs.webhdfs.enabled</name> <value>true</value> </property> </configuration>
配置文件6:mapred-site.xml
<configuration> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> <property> <name>mapreduce.jobhistory.address</name> <value>hadoop_master_001:10020</value> </property> <property> <name>mapreduce.jobhistory.webapp.address</name> <value>hadoop_master_001:19888</value> </property> </configuration>
配置文件7:yarn-site.xml
<configuration> <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>hadoop_master_001:8032</value> </property> <property> <name>yarn.resourcemanager.scheduler.address</name> <value>hadoop_master_001:8030</value> </property> <property> <name>yarn.resourcemanager.resource-tracker.address</name> <value>hadoop_master_001:8031</value> </property> <property> <name>yarn.resourcemanager.admin.address</name> <value>hadoop_master_001:8033</value> </property> <property> <name>yarn.resourcemanager.webapp.address</name> <value>hadoop_master_001:8088</value> </property> </configuration>
001上面运行的进程有:NameNode SecondaryNameNode
002和003上面运行的进程有:DataNode
启动yarn: ./sbin/start-yarn.sh
YARN 是从 MapReduce 中分离出来的,负责资源管理与任务调度。YARN 运行于 MapReduce 之上,提供了高可用性、高扩展性
001上面运行的进程有:NameNode SecondaryNameNode ResourceManager
002和003上面运行的进程有:DataNode NodeManager
启动完成后,可以通过命令 jps
来判断是否成功启动,若成功启动则会列出如下进程: “NameNode”、”DataNode” 和 “SecondaryNameNode”
主机名 | IP地址 |
hadoop-ambari | 192.168.1.150 |
yum update
cd /etc/yum.repos.d/
wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.2.0.0/ambari.repo
<!-- hadoop的配置 --> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-mapreduce-client-core</artifactId> <scope>provided</scope> <version>2.7.2</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-mapreduce-client-common</artifactId> <scope>provided</scope> <version>2.7.2</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> <scope>provided</scope> <version>2.7.2</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-yarn-common</artifactId> <scope>provided</scope> <version>2.7.2</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-annotations</artifactId> <scope>provided</scope> <version>2.7.2</version> </dependency> <!-- 配置结束 -->
<configuration> <property> <name>fs.defaultFS</name> <value>hdfs://hadoop-master-001:9000</value> </property> <property> <name>io.file.buffer.size</name> <value>131072</value> </property> <property> <name>hadoop.tmp.dir</name> <value>file:/home/hadoop/temp</value> <description>Abase for other temporary directories.</description> </property> <property> <name>hadoop.proxyuser.hduser.hosts</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.hduser.groups</name> <value>*</value> </property> </configuration>
<configuration> <property> <name>dfs.datanode.data.dir</name> <value>file:/home/hadoop/data</value> </property> <property> <name>dfs.replication</name> <value>3</value> </property> </configuration>
<configuration> <property> <name>mapred.job.tracker</name> <value>hdfs://hadoop-master-001:9001</value> </property> </configuration>