码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS下 安装配置hadoop环境--单实例版

时间:2019-04-01 18:51:26      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:dfs   .so   连接   form   resource   tracker   rac   red   .sh   

CentOS下
1、安装linux
2、安装jdk
[root@Cent0S1 ~]# javac //显示信息
[root@Cent0S1 ~]# rpm -qa |grep jdk //查看是否有安装包
[root@Cent0S1 ~]# which java //查看Java命令位置
/usr/bin/java
[root@Cent0S1 ~]# javac -version //查看Java版本
javac 1.8.0_191
[root@Cent0S1 ~]# ls -l /usr/bin/java //查看软连接
lrwxrwxrwx. 1 root root 22 12月 27 15:09 /usr/bin/java -> /etc/alternatives/java
[root@Cent0S1 ~]# 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
[root@Cent0S1 ~]# 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环境变量
[root@Cent0S1 ~]# 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

[root@Cent0S1 ~]# source /etc/profile //环境生效
[root@Cent0S1 桌面]# mv hadoop-2.7.6 /opt
4、增加hadoop环境变量
[root@Cent0S1 hadoop]# pwd
/opt/hadoop-2.7.6/etc/hadoop
[root@Cent0S1 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/
[root@Cent0S1 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>
[root@Cent0S1 hadoop]#vim hdfs-site.xml
<property>
<name>dfs.name.dir</name>
<value>/hadoop/name</value> #配置home路径
</property>
[root@Cent0S1 hadoop]# vim mapred-site.xml.template
<property>
<name>mapred.job.tracker</name>
<value>Cent0S1:9000</value>
</property>
[root@Cent0S1 ~]# 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
[root@Cent0S1 bin]# hadoop namenode -format
[root@Cent0S1 sbin]# ./start-all.sh //开启hadoop
[root@Cent0S1 sbin]# jps //检查hadoop运行是否正常
22945 NameNode
23089 DataNode
23845 Jps
23430 ResourceManager
23722 NodeManager
23278 SecondaryNameNodeCentOS下
1、安装linux
2、安装jdk
[root@Cent0S1 ~]# javac //显示信息
[root@Cent0S1 ~]# rpm -qa |grep jdk //查看是否有安装包
[root@Cent0S1 ~]# which java //查看Java命令位置
/usr/bin/java
[root@Cent0S1 ~]# javac -version //查看Java版本
javac 1.8.0_191
[root@Cent0S1 ~]# ls -l /usr/bin/java //查看软连接
lrwxrwxrwx. 1 root root 22 12月 27 15:09 /usr/bin/java -> /etc/alternatives/java
[root@Cent0S1 ~]# 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
[root@Cent0S1 ~]# 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环境变量
[root@Cent0S1 ~]# 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

[root@Cent0S1 ~]# source /etc/profile //环境生效
[root@Cent0S1 桌面]# mv hadoop-2.7.6 /opt
4、增加hadoop环境变量
[root@Cent0S1 hadoop]# pwd
/opt/hadoop-2.7.6/etc/hadoop
[root@Cent0S1 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/
[root@Cent0S1 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>
[root@Cent0S1 hadoop]#vim hdfs-site.xml
<property>
<name>dfs.name.dir</name>
<value>/hadoop/name</value> #配置home路径
</property>
[root@Cent0S1 hadoop]# vim mapred-site.xml.template
<property>
<name>mapred.job.tracker</name>
<value>Cent0S1:9000</value>
</property>
[root@Cent0S1 ~]# 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
[root@Cent0S1 bin]# hadoop namenode -format
[root@Cent0S1 sbin]# ./start-all.sh //开启hadoop
[root@Cent0S1 sbin]# jps //检查hadoop运行是否正常
22945 NameNode
23089 DataNode
23845 Jps
23430 ResourceManager
23722 NodeManager
23278 SecondaryNameNode

CentOS下 安装配置hadoop环境--单实例版

标签:dfs   .so   连接   form   resource   tracker   rac   red   .sh   

原文地址:https://blog.51cto.com/14074978/2372592

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!