CentOS下 安装配置hadoop环境--单实例版
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS下 安装配置hadoop环境--单实例版相关的知识,希望对你有一定的参考价值。
CentOS下1、安装linux
2、安装jdk
[[email protected] ~]# javac //显示信息
[[email protected] ~]# rpm -qa |grep jdk //查看是否有安装包
[[email protected] ~]# which java //查看Java命令位置
/usr/bin/java
[[email protected] ~]# javac -version //查看Java版本
javac 1.8.0_191
[[email protected] ~]# ls -l /usr/bin/java //查看软连接
lrwxrwxrwx. 1 root root 22 12月 27 15:09 /usr/bin/java -> /etc/alternatives/java
[[email protected] ~]# ls -l /etc/alternatives/java //查看jdk目录
lrwxrwxrwx. 1 root root 73 12月 27 15:09 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre/bin/java
[[email protected] ~]# find -name libjvm.so 2>/dev/null //查看jdk目录方法2
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.171-2.6.13.2.el7.x86_64/jre/lib/amd64/server/libjvm.so
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre/lib/amd64/server/libjvm.so
3、增加java环境变量
[[email protected] ~]# vi /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/
export JRE_HOME=$JAVA_HOME/jre
export CLASSPARH=$JACA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
[[email protected] ~]# source /etc/profile //环境生效
[[email protected] 桌面]# mv hadoop-2.7.6 /opt
4、增加hadoop环境变量
[[email protected] hadoop]# pwd
/opt/hadoop-2.7.6/etc/hadoop
[[email protected] hadoop]vim hadoop-env.sh //修改JAVA_HOME
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/
[[email protected] hadoop]# vim core-site.xml
<property>
<name>hadoop.tmp.dir</name>
<value>/hadoop</value>
</property>
<property>
<name>dfs.name.dir</name>
<value>/hadoop/name</value> #配置home路径
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://Cent0S1:9000</value> #Cent0S1为主机名称
</property>
[[email protected] hadoop]#vim hdfs-site.xml
<property>
<name>dfs.name.dir</name>
<value>/hadoop/name</value> #配置home路径
</property>
[[email protected] hadoop]# vim mapred-site.xml.template
<property>
<name>mapred.job.tracker</name>
<value>Cent0S1:9000</value>
</property>
[[email protected] ~]# vi /etc/profile
export HADOOP_HOME=/opt/hadoop-2.7.6
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH:$HADOOP_HOME/bin
5、格式化hadoop namenode
[[email protected] bin]# hadoop namenode -format
[[email protected] sbin]# ./start-all.sh //开启hadoop
[[email protected] sbin]# jps //检查hadoop运行是否正常
22945 NameNode
23089 DataNode
23845 Jps
23430 ResourceManager
23722 NodeManager
23278 SecondaryNameNodeCentOS下
1、安装linux
2、安装jdk
[[email protected] ~]# javac //显示信息
[[email protected] ~]# rpm -qa |grep jdk //查看是否有安装包
[[email protected] ~]# which java //查看Java命令位置
/usr/bin/java
[[email protected] ~]# javac -version //查看Java版本
javac 1.8.0_191
[[email protected] ~]# ls -l /usr/bin/java //查看软连接
lrwxrwxrwx. 1 root root 22 12月 27 15:09 /usr/bin/java -> /etc/alternatives/java
[[email protected] ~]# ls -l /etc/alternatives/java //查看jdk目录
lrwxrwxrwx. 1 root root 73 12月 27 15:09 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre/bin/java
[[email protected] ~]# find -name libjvm.so 2>/dev/null //查看jdk目录方法2
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.171-2.6.13.2.el7.x86_64/jre/lib/amd64/server/libjvm.so
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre/lib/amd64/server/libjvm.so
3、增加java环境变量
[[email protected] ~]# vi /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/
export JRE_HOME=$JAVA_HOME/jre
export CLASSPARH=$JACA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
[[email protected] ~]# source /etc/profile //环境生效
[[email protected] 桌面]# mv hadoop-2.7.6 /opt
4、增加hadoop环境变量
[[email protected] hadoop]# pwd
/opt/hadoop-2.7.6/etc/hadoop
[[email protected] hadoop]vim hadoop-env.sh //修改JAVA_HOME
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/
[[email protected] hadoop]# vim core-site.xml
<property>
<name>hadoop.tmp.dir</name>
<value>/hadoop</value>
</property>
<property>
<name>dfs.name.dir</name>
<value>/hadoop/name</value> #配置home路径
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://Cent0S1:9000</value> #Cent0S1为主机名称
</property>
[[email protected] hadoop]#vim hdfs-site.xml
<property>
<name>dfs.name.dir</name>
<value>/hadoop/name</value> #配置home路径
</property>
[[email protected] hadoop]# vim mapred-site.xml.template
<property>
<name>mapred.job.tracker</name>
<value>Cent0S1:9000</value>
</property>
[[email protected] ~]# vi /etc/profile
export HADOOP_HOME=/opt/hadoop-2.7.6
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH:$HADOOP_HOME/bin
5、格式化hadoop namenode
[[email protected] bin]# hadoop namenode -format
[[email protected] sbin]# ./start-all.sh //开启hadoop
[[email protected] sbin]# jps //检查hadoop运行是否正常
22945 NameNode
23089 DataNode
23845 Jps
23430 ResourceManager
23722 NodeManager
23278 SecondaryNameNode
以上是关于CentOS下 安装配置hadoop环境--单实例版的主要内容,如果未能解决你的问题,请参考以下文章