Browse Source

Upload files to 'namenode'

master
DrakopoulosAj 5 years ago
parent
commit
5854a5964b
  1. 16
      namenode/Dockerfile
  2. 22
      namenode/run.sh

16
namenode/Dockerfile

@ -0,0 +1,16 @@
FROM bde2020/hadoop-base:2.0.0-hadoop3.2.1-java8
MAINTAINER Ivan Ermilov <ivan.s.ermilov@gmail.com>
HEALTHCHECK CMD curl -f http://localhost:9870/ || exit 1
ENV HDFS_CONF_dfs_namenode_name_dir=file:///hadoop/dfs/name
RUN mkdir -p /hadoop/dfs/name
VOLUME /hadoop/dfs/name
ADD run.sh /run.sh
RUN chmod a+x /run.sh
EXPOSE 9870
CMD ["/run.sh"]

22
namenode/run.sh

@ -0,0 +1,22 @@
#!/bin/bash
namedir=`echo $HDFS_CONF_dfs_namenode_name_dir | perl -pe 's#file://##'`
if [ ! -d $namedir ]; then
echo "Namenode name directory not found: $namedir"
exit 2
fi
if [ -z "$CLUSTER_NAME" ]; then
echo "Cluster name not specified"
exit 2
fi
echo "remove lost+found from $namedir"
rm -r $namedir/lost+found
if [ "`ls -A $namedir`" == "" ]; then
echo "Formatting namenode name directory: $namedir"
$HADOOP_HOME/bin/hdfs --config $HADOOP_CONF_DIR namenode -format $CLUSTER_NAME
fi
$HADOOP_HOME/bin/hdfs --config $HADOOP_CONF_DIR namenode
Loading…
Cancel
Save