Hadoop in Docker: Difference between revisions

From JoBaPedia
Jump to navigation Jump to search
Line 116: Line 116:


  docker run --name bigtop-prep -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -ti opensuse/leap:42.3 /bin/bash
  docker run --name bigtop-prep -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -ti opensuse/leap:42.3 /bin/bash
  zypper in wget tar vim
  zypper in tar curl unzip rpm-build
  cd /usr/local
  cd /usr/local
  wget https://download.java.net/java/GA/jdk15.0.1/51f4f36ad4ef43e39d0dfdbaf6549e32/9/GPL/openjdk-15.0.1_linux-x64_bin.tar.gz
  curl https://download.java.net/java/GA/jdk15.0.1/51f4f36ad4ef43e39d0dfdbaf6549e32/9/GPL/openjdk-15.0.1_linux-x64_bin.tar.gz -o openjdk-15.0.1_linux-x64_bin.tar.gz
  tar xf openjdk-15.0.1_linux-x64_bin.tar.gz
  tar xf openjdk-15.0.1_linux-x64_bin.tar.gz
  echo 'export JAVA_HOME=/usr/local/jdk-15.0.1' >>/etc/profile.local
  echo 'export JAVA_HOME=/usr/local/jdk-15.0.1' >>/etc/profile.local
  echo 'export PATH=$JAVA_HOME/bin:$PATH'  >>/etc/profile.local
  echo 'export PATH=$JAVA_HOME/bin:$PATH'  >>/etc/profile.local

Revision as of 09:57, 30 October 2020

Hadoop in Docker

Protocol for Installation on OpenSuse 15.1

Docker Intro

First create btrfs fs on /var/lib/docker to get decent snapshot support, then

sudo zypper install docker python3-docker-compose
sudo usermod -G docker -a $USER
sudo systemctl enable docker
sudo systemctl start docker
sudo systemctl status docker

You need to relogin or do ssh localhost to activate the group change. Then you can start shell in an opensuse image

docker run --name bigtop -it --entrypoint /bin/bash opensuse/leap:42.3

If you exit and want to restart this container restart and attach

docker container restart bigtop
docker attach bigtop

If you want to start another shell in the running container

docker container exec -it bigtop /bin/bash

If you dont know the name of the container, use this to list them all

docker ps -a

If you want to add a volume to your existing container, that is not as easy as I thought

docker commit bigtop bigtop-image
docker run --name bigtop2 -v /mountpoint -ti --entrypoint /bin/bash bigtop-image

Once you know all is ok, you can replace the old container

docker rm bigtop
docker rename bigtop2 bigtop

Now you have a docker container where you can start bigtop setup in and know how to reconfigure it if something is misssing

Bigtop

Bigtop from Repo

Add repository to opensuse 42.3 (suggest to do that in docker image created above)

zypper ar https://artfiles.org/apache.org/bigtop/bigtop-1.4.0/repos/opensuse42.3/bigtop.repo
zypper in bigtop-utils bigtop-jsvc bigtop-tomcat bigtop-groovy

Configure tomcat users

cp -av  /usr/lib/bigtop-tomcat/conf.template /usr/lib/bigtop-tomcat/conf
vi /usr/lib/bigtop-tomcat/conf/tomcat-users.xml

I added this just before the final "</tomcat-users>" line. No idea if this is really ok or necessary

 <role rolename="tomcat"/>
 <role rolename="manager"/>
 <role rolename="manager-gui"/>
 <user username="tomcat" password="my-PW" roles="tomcat,manager,manager-gui"/>
 <user username="joachim" password="my-PW" roles="tomcat,manager,manager-gui"/>
 <user username="julian" password="his-PW" roles="tomcat,manager,manager-gui"/>

Open port 8080 (and maybe 8009 and 8005?) for the container and start /usr/lib/bigtop-tomcat/bin/catalina.sh run

docker run --name bigtop-catalina -p 8080:8080 -p 8005:8005 -p8009:8009 -ti --entrypoint /bin/bash bigtop-image /usr/lib/bigtop-tomcat/bin/catalina.sh run

Check if tomcat is running fine by deploying a "hello world" war

zypper install wget
cd /usr/lib/bigtop-tomcat
mkdir -p webapps
cd webapps
wget https://tomcat.apache.org/tomcat-8.0-doc/appdev/sample/sample.war

Tomcat should find the war file, expand and deploy it automatically. Find it at http://localhost:8080/sample

Groovy that comes with bigtop uses utility "which" and needs a JDK. Install them, but since java-1_8_0-openjdk-1.8.0 building fails with java exception, trying with Oracles GPL java:

cd /usr/local
wget https://download.java.net/java/GA/jdk15.0.1/51f4f36ad4ef43e39d0dfdbaf6549e32/9/GPL/openjdk-15.0.1_linux-x64_bin.tar.gz
tar xf openjdk-15.0.1_linux-x64_bin.tar.gz

edit /home/bigtop/.profile: add these two lines

export JAVA_HOME=/usr/local/jdk-15.0.1
export PATH=$JAVA_HOME/bin:$PATH
zypper install which
/usr/lib/bigtop-groovy/bin/groovy -version

Bigtop 1.4.0 from Tar

Enable docker to run from within containers (bind mount socket and command). Check if docker group has same id on host and container. Change /etc/group in container if needed and restart

docker run --name bigtop-catalina -p 8080:8080 -p 8005:8005 -p8009:8009 -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -ti --entrypoint /bin/bash bigtop-catalina-image /usr/lib/bigtop-tomcat/bin/catalina.sh run

zypper in tar curl unzip rpm-build
sed -i 's/en_US.UTF-8//' /etc/sysconfig/language
mkuser -m -G docker bigtop
su - bigtop
wget https://apache.lauf-forum.at/bigtop/bigtop-1.4.0/bigtop-1.4.0-project.tar.gz
tar xzvf bigtop-1.4.0-project.tar.gz
cd bigtop-1.4.0

Now you can call ./gradlew with options as described in BIGTOP Quickstart Guide. E.g.:

./gradlew hadoop-pkg-ind -POS=opensuse-42.3

Bigtop 1.4.0 2nd Try

docker run --name bigtop-prep -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -ti opensuse/leap:42.3 /bin/bash
zypper in tar curl unzip rpm-build
cd /usr/local
curl https://download.java.net/java/GA/jdk15.0.1/51f4f36ad4ef43e39d0dfdbaf6549e32/9/GPL/openjdk-15.0.1_linux-x64_bin.tar.gz -o openjdk-15.0.1_linux-x64_bin.tar.gz
tar xf openjdk-15.0.1_linux-x64_bin.tar.gz
echo 'export JAVA_HOME=/usr/local/jdk-15.0.1' >>/etc/profile.local
echo 'export PATH=$JAVA_HOME/bin:$PATH'  >>/etc/profile.local