CentOS7.5配置伪分布式环境
原创
©著作权归作者所有:来自51CTO博客作者WHYBIGDATA的原创作品,请联系作者获取转载授权,否则将追究法律责任
CentOS7.5配置伪分布式环境
1.提前安装JDK和Hadoop并配置好环境变量
vim /etc/profile.d/my_env.sh
# JDK_HOME
export JAVA_HOME=/opt/module/jdk1.8.0_212
export CLASSPATH=$:CLASSPATH:$JAVA_HOME/lib/
export PATH=$PATH:$JAVA_HOME/bin
#HADOOP_HOME
export HADOOP_HOME=/opt/module/hadoop-3.1.3
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
2.修改配置文件
core-site.xml
<configuration>
<!-- 指定NameNode的地址 -->
<property>
<name>fs.defaultFS</name>
<value>hdfs://hadoop112:9820</value>
</property>
<!-- 指定hadoop数据的存储目录 -->
<property>
<name>hadoop.tmp.dir</name>
<value>/opt/module/hadoop-3.1.3/data</value>
</property>
</configuration>
hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<!-- nn web端访问地址-->
<property>
<name>dfs.namenode.http-address</name>
<value>hadoop112:9870</value>
</property>
<!-- 2nn web端访问地址-->
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>hadoop112:9868</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>/opt/module/hadoop-3.1.3/data/dfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/opt/module/hadoop-3.1.3/data/dfs/data</value>
</property>
</configuration>
yarn-site.xml(也可以不用改)
<configuration>
<!-- Site specific YARN configuration properties -->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>
3.格式化NameNode
如果格式化成功,会看到 has been successfully formatted
和 Exiting with status 0
的提示信息。
4.启动Hadoop
5.Web端查看HDFS信息
结束!