阿里云ECS安装hadoop伪分布式安装(阿里云centos7)
2018-02-04 本文已影响186人
广西年轻人
软件环境:
linux:阿里云centos7
hadoop:2.7.4
jdk:1.8
阿里云ECS配置hadoop的问题:
配置时使用内网ip,访问时使用公网ip。
1.下载,解压
wget http://mirror.bit.edu.cn/apache/hadoop/common/hadoop-2.7.4/hadoop-2.7.4.tar.gz
tar -zxvf hadoop-2.7.4.tar.gz
捕获.PNG
2.配置hadoop(伪分布式)
修改hadoop-env.sh
##修改jdk路径
export JAVA_HOME=/opt/jdk/jdk1.8.0_151
修改core-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<!-- Put site-specific property overrides in this file. -->
<configuration>
<!-- 配置hdfs的namenode的地址,阿里云填写内网地址-->
<property>
<name>fs.defaultFS</name>
<value>hdfs://172.18.243.39:9000</value>
</property>
<!-- 配置Hadoop运行时产生数据的存储目录,注意:不是临时数据 -->
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/software/tempdir_hadoop</value>
</property>
<property>
<description>
The user name to filter as, on static web filters
while rendering content. An example use is the HDFS
web UI (user to be used for browsing files).
</description>
<name>hadoop.http.staticuser.user</name>
<value>root</value>
</property>
</configuration>
修改hdfs-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<!-- Put site-specific property overrides in this file. -->
<configuration>
<!-- 指定HDFS存储数据的副本数据量-->
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
</configuration>
修改yarn-site.xml
<?xml version="1.0"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<configuration>
<!-- Site specific YARN configuration properties -->
<property>
<!-- 指定YARN的resourcemanager的地址(伪分布式时就是主机名,aliyun填写内网IP) -->
<name>yarn.resourcemanager.hostname</name>
<value>172.18.243.39</value>
</property>
<!-- MapReduce执行shuffle时获取数据的方式 -->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<!-- -->
<property>
<name>yarn.nodemanager.resource.memory-mb</name>
<value>3072</value>
</property>
<!-- -->
<property>
<name>yarn.nodemanager.resource.cpu-vcores</name>
<value>1</value>
</property>
<!-- -->
<property>
<name>yarn.scheduler.maximum-allocation-mb</name>
<value>3072</value>
</property>
<!-- -->
</configuration>
修改mapred-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<!-- Put site-specific property overrides in this file. -->
<configuration>
<!-- 指定MapReduce编程模型运行在YARN上-->
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
3.创建目录并,格式化hdfs
mkdir -p /usr/local/software/tempdir_hadoop
#也可以配置到path中,就不用每次都要cd到这来了
cd /opt/hadoop/hadoop-2.7.4/bin
hadoop namenode -format
4.启动hadoop
cd /opt/hadoop/hadoop-2.7.4/sbin
#start-all.sh=start-dfs.sh+start-yarn.sh
start-all.sh
5.使用jps命令查看进程是否存在
捕获.PNG6.web界面查看
ip:50070 查看hdfs管理界面
ip:8088 查看yarn管理界面
捕获.PNG