标签:blog value href nes write sbin 假设 技术 linu
一、Running in the host
1. pull centos
$docker pull centos:7
假设得到的容器ID为:8164e2537625
$docker run -it -v /docker:/root/store1 centos:7 /bin/bash
二、Container Running
1. install tools
[root@8164e2537625 /]yum install -y wget vim openssh-server openssh-clients net-tools
2. install jdk
1) down
download to tmp folder:
[root@8164e2537625 tmp]wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz
unzip:
[root@8164e2537625 tmp]mkdir /usr/java [root@8164e2537625 tmp]tar zxvf jdk-8u171-linux-x64.tar.gz -C /usr/java
2) setup
[root@8164e2537625 tmp]echo ‘export JAVA_HOME=/usr/java/jdk1.8.0_171‘ >> /etc/bashrc [root@8164e2537625 tmp]echo ‘export CLASSPATH=$JAVA_HOME/lib/:.‘ >> /etc/bashrc [root@8164e2537625 tmp]echo ‘export PATH=$PATH:$JAVA_HOME/bin‘ >> /etc/bashrc [root@8164e2537625 tmp]source /etc/bashrc
3) test
[root@8164e2537625 tmp]java -version
3. install hadoop
1) down
http://hadoop.apache.org/releases.html
Select a mirrors download:
[root@8164e2537625 tmp]wget http://mirrors.hust.edu.cn/apache/hadoop/common/hadoop-2.8.4/hadoop-2.8.4.tar.gz
unzip:
[root@8164e2537625 tmp]mkdir /usr/local/hadoop [root@8164e2537625 tmp]tar zxvf hadoop-2.8.4.tar.gz -C /usr/local/hadoop/
2) setup
[root@8164e2537625 tmp]echo ‘export HADOOP_HOME=/usr/local/hadoop/hadoop-2.8.4‘ >> /etc/bashrc [root@8164e2537625 tmp]echo ‘export HADOOP_CONFIG_HOME=$HADOOP_HOME/etc/hadoop‘ >> /etc/bashrc [root@8164e2537625 tmp]echo ‘export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin‘ >> /etc/bashrc [root@8164e2537625 tmp]source /etc/bashrc
3) config hadoop
[root@8164e2537625 tmp]cd $HADOOP_CONFIG_HOME
(1) core-site.xml
<configuration> <property> <name>hadoop.tmp.dir</name> <value>/usr/local/hadoop/hadoop-2.8.4/tmp</value> <description>A base for other temporary dirctories.</description> </property> <property> <name>fs.default.name</name> <value>hdfs://master:9000</value> <final>true</final> <description>The name of the default file system. A URI whose scheme and authority determine the FileSystem implemntation. The uri‘s scheme determines the config property (fs.SCHEME.impl) naming the FileSystem implemnetation class. The uri‘s authority is used to determine the host, port, etc. for a filesystem. </description> </property> </configuration>
(2) hdfs-site.xml
<configuration> <property> <name>dfs.replication</name> <value>2</value> <final>true</final> <description>Default block replication. The actual number of replications can be specified when the file is created. The default is used if replication is not specified in create time. </description> </property> <property> <name>dfs.namenode.name.dir</name> <value>/usr/local/hadoop/hadoop-2.8.4/namenode</value> <final>true</final> </property> <property> <name>dfs.datenode.data.dir</name> <value>/usr/local/hadoop/hadoop-2.8.4/datanode</value> <final>true</final> </property> </configuration>
(3) mapred-site.xml
copy template:
[root@8164e2537625 hadoop]cp mapred-site.xml.template mapred-site.xml
write it:
<configuration>
<property>
<name>maperd.job.tracker</name>
<value>master:9001</value>
<description>The host and port that the MapReduce job tracker runs at.
IF "local", then jobs are run in-process as a single map and reduce task</description>
</property>
</configuration>
Reference:
1. 《Downloading Java JDK on Linux via wget is shown license page instead》
2. 《vmware虚拟机redhat7.2下docker容器安装hadoop - v2.7.2》
3. 《基于 Docker 安装 Hadoop 2.9.0 - 陈刚》
标签:blog value href nes write sbin 假设 技术 linu
原文地址:https://www.cnblogs.com/xiaobin-hlj80/p/9276279.html