hadoop 3.3.1

This commit is contained in:
yangyu 2021-08-19 13:46:32 +08:00
parent 1346fe12f2
commit a1afd6983f
8 changed files with 190 additions and 0 deletions

61
hadoop/3.3.1/Dockerfile Normal file
View File

@ -0,0 +1,61 @@
FROM ccr.ccs.tencentyun.com/yy-dk/centos-sshd:7.0
MAINTAINER Yang <yangyufans@qq.com>
ENV HADOOP_VERSION hadoop-3.3.1
RUN yum install -y wget which
RUN cd / && wget http://yy-bak.oss-cn-qingdao.aliyuncs.com/jdk/jdk-8u172-linux-x64.tar.gz \
&& tar -zvxf jdk-8u172-linux-x64.tar.gz -C /usr/local \
&& rm -rf jdk-8u172-linux-x64.tar.gz
ENV JDK_VERSION "jdk1.8.0_172"
ENV JAVA_HOME "/usr/local/$JDK_VERSION"
RUN cd / && wget https://downloads.apache.org/hadoop/common/$HADOOP_VERSION/$HADOOP_VERSION.tar.gz \
&& tar -zxvf $HADOOP_VERSION.tar.gz -C /usr/local \
&& rm -rf $HADOOP_VERSION.tar.gz
ENV HADOOP_HOME "/usr/local/$HADOOP_VERSION"
ENV PATH "$PATH:$JAVA_HOME/bin"
ENV PATH "$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin"
RUN echo "export JAVA_HOME=/usr/local/$JDK_VERSION" >> /etc/profile && \
echo "export HADOOP_HOME=$HADOOP_HOME" >> /etc/profile && \
echo 'export PATH=$PATH:$JAVA_HOME/bin' >> /etc/profile && \
echo 'export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin' >> /etc/profile && \
source /etc/profile
RUN mkdir /conf /logs /data
RUN echo "ZONE=Asia/Shanghai" > /etc/sysconfig/clock && \
rm -rf /etc/localtime && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa && \
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
ENV YARN_LOG_DIR "/logs"
RUN sed -i 's/# export JAVA_HOME=/export JAVA_HOME=\/usr\/local\/jdk1.8.0_172/g' $HADOOP_HOME/etc/hadoop/hadoop-env.sh && \
echo "export HADOOP_LOG_DIR=/logs" >> $HADOOP_HOME/etc/hadoop/hadoop-env.sh && \
echo "export HADOOP_PREFIX=$HADOOP_HOME" >> $HADOOP_HOME/etc/hadoop/hadoop-env.sh && \
echo "export HDFS_NAMENODE_USER=root" >> $HADOOP_HOME/etc/hadoop/hadoop-env.sh && \
echo "export HDFS_DATANODE_USER=root" >> $HADOOP_HOME/etc/hadoop/hadoop-env.sh && \
echo "export HDFS_SECONDARYNAMENODE_USER=root" >> $HADOOP_HOME/etc/hadoop/hadoop-env.sh && \
echo "export YARN_RESOURCEMANAGER_USER=root" >> $HADOOP_HOME/etc/hadoop/hadoop-env.sh && \
echo "export YARN_NODEMANAGER_USER=root" >> $HADOOP_HOME/etc/hadoop/hadoop-env.sh && \
sed -e "1 i\export YARN_LOG_DIR=\/logs" $HADOOP_HOME/etc/hadoop/yarn-env.sh > $HADOOP_HOME/etc/hadoop/yarn-env.sh.bak && \
\mv $HADOOP_HOME/etc/hadoop/yarn-env.sh.bak $HADOOP_HOME/etc/hadoop/yarn-env.sh
COPY conf/* $HADOOP_HOME/etc/hadoop/
COPY start.sh /
RUN chmod 777 /start.sh
EXPOSE 22 8020 8088 8042 9870
CMD ["/start.sh"]

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:8020</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/data</value>
</property>
</configuration>

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>localhost:50090</value>
</property>
<property>
<name>dfs.namenode.secondary.https-address</name>
<value>localhost:50091</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>

View File

@ -0,0 +1,36 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>yarn.app.mapreduce.am.env</name>
<value>HADOOP_MAPRED_HOME=${HADOOP_COMMON_HOME}</value>
</property>
<property>
<name>mapreduce.map.env</name>
<value>HADOOP_MAPRED_HOME=${HADOOP_COMMON_HOME}</value>
</property>
<property>
<name>mapreduce.reduce.env</name>
<value>HADOOP_MAPRED_HOME=${HADOOP_COMMON_HOME}</value>
</property>
</configuration>

View File

@ -0,0 +1 @@
localhost

1
hadoop/3.3.1/conf/slaves Normal file
View File

@ -0,0 +1 @@
localhost

View File

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>

8
hadoop/3.3.1/start.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/bash
\cp /conf/hadoop/* $HADOOP_HOME/etc/hadoop
echo "127.0.0.1 localhost" > /etc/hosts
/usr/sbin/sshd -D