HadoopHadoop系

Dcoker安装Hadoop2.7.7

2019-08-10  本文已影响0人  Yinawake

安装JDK:

  1. 下载 jdk-8u221-linux-x64.tar.gz
  2. 解压 tar -xzvf jdk-8u221-linux-x64.tar.gz
  3. 配置环境变量 vim .bashrc
export JAVA_HOME=/opt/jdk1.8
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib

安装Hadoop

  1. 下载 hadoop-2.7.7.tar.gz
  2. 解压 tar -xzvf hadoop-2.7.7.tar.gz

注:
遇到解压后问价夹的用户和组都是不当前用户,所以涉及修改文件夹所在组,用户。如下:

chown -R root /hadoop
chgrp -R root /hadoop
  1. 修改hadoop/etc/hadoop/下:
<configuration>
  <property>
    <name>mapreduce.framework.name</name>
    <value>yarn</value>
  </property>
</configuration>
<configuration>
  <property>
    <name>fs.default.name</name>
    <value>hdfs://YARN001:8020</value>
  </property>
</configuration>
<configuration>
  <property>
    <name>yarn.nodemanager.aux-services</name>
    <value>mapreduce-shuffle</value>
  </property>
</configuration>
<configuration>
  <property>
    <name>dfs.replication</name>
    <value>1</value>
  </property>
</configuration>

因为docker中修改hosts不生效,所以需要每次启动时增加hostname
docker run --add-host YARN001:127.0.0.1 -it ubuntu:java

报错

hdfs//YARN001:8020 has no authority

安装ssh

apt-get install ssh
sudo apt-get install pdsh

$ ssh-keygen -t rsa
$ cd .ssh/
$ cat id_rsa.pub >> authorized_keys
root@df087d56cf7c:/opt/hadoop2.7.7# jps
1461 NodeManager
1493 Jps
1034 DataNode
1213 ResourceManager
941 NameNode

访问:
http://192.168.99.100:8088/cluster

image.png

http://192.168.99.100:50070/dfshealth.html#tab-overview

image.png

问题

0.0.0.0: ssh: connect to host 0.0.0.0 port 22: Connection refused

安装ssh
apt-get install openssh-server

docker中安装sshd后不会默认启动,所以需要在.bashrc中配置service ssh start


命令启动:

docker run --add-host YARN001:127.0.0.1  -it  -p8088:8088 -p 50070:50070 ubuntu:hadoop

sbin/hadoop-deamon.sh start namenode
sbin/hadoop-deamon.sh start datanode
sbin/yarn-deamon.sh start resourcemanager
sbin/yarn-deamon.sh start nodemanager
上一篇下一篇

猜你喜欢

热点阅读