sudo docker network create --driver=bridge hadoop
cd DS-M4-Cluster_Hadoop
sudo ./start-container.sh
output:
start hadoop-master container...
start hadoop-slave1 container...
start hadoop-slave2 container...
root@hadoop-master:~#
- Iniciar con 2 esclavos y un maestro
- Entraremos al contenedor master
./start-hadoop.sh
wget https://raw.githubusercontent.com/uracilo/testdata/master/odisea.txt
mkdir input
tar -czvf input/odisea.tar.gz odisea.txt
-c: Generar archivo -z: Comprimir con gzip. -v: Progreso del proceso. -f: Especificar nombre del archivo.
ls -flarts input
hdfs dfs -mkdir -p test
hdfs dfs -put input
hdfs dfs –ls input
hdfs dfs -cat input/odisea.tar.gz | zcat | tail -n 20
hdfs dfs –rm –f /user/rawdata/example/odisea.tar.gz
hadoop jar $HADOOP_HOME/share/hadoop/mapreduce/sources/hadoop-mapreduce-examples-2.7.2-sources.jar org.apache.hadoop.examples.WordCount input output
hdfs dfs -cat output/part-r-00000
Inspirado en https://github.com/kiwenlau/hadoop-cluster-docker