Install Hortonworks Hadoop with Ambari on Docker


name@host:/#docker run --name=data1 --hostname=data1 -it ubuntu /bin/bash

name@host:/#docker run --name=data2 --hostname=data2 -it ubuntu /bin/bash

name@host:/#docker run --name=name --hostname=name --link data1:data1 --link data2:data2 -it ubuntu /bin/bash

name@host:/#docker run --name=ambari --hostname=ambari --link data1:data1 --link data2:data2 --link name:name -it ubuntu /bin/bash

name@host:/#sudo bash -c "curl https://raw.githubusercontent.com/jpetazzo/pipework/master/pipework > /usr/local/bin/pipework"

name@host:/#sudo chmod u+x /usr/local/bin/pipework

name@host:/#sudo apt-get install iproute2

name@host:/#sudo /usr/local/bin/pipework br1 data1 192.168.0.50/24

name@host:/#sudo /usr/local/bin/pipework br1 data2 192.168.0.51/24

name@host:/#sudo /usr/local/bin/pipework br1 name 192.168.0.53/24

name@host:/#sudo /usr/local/bin/pipework br1 ambari 192.168.0.54/24

root@data1:~#passwd
Enter new UNIX password:root

root@data1:~#apt-get install ssh

root@data1:~#sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config

root@data1:~#/etc/init.d/ssh start
root@data1:~#ssh-keygen
root@data1:~#apt-get update

root@data2:~#passwd
Enter new UNIX password:root

root@data2:~#apt-get install ssh

root@data2:~#sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config

root@data2:~#/etc/init.d/ssh start
root@data2:~#ssh-keygen
root@data1:~#apt-get update

root@name:~#passwd
Enter new UNIX password:root

root@name:~#apt-get install ssh

root@name:~#sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config

root@name:~#/etc/init.d/ssh start
root@name:~#ssh-keygen

root@ambari:~#passwd
Enter new UNIX password:root

root@ambari:~#apt-get install ssh

root@ambari:~#sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config

root@ambari:~#/etc/init.d/ssh start
root@ambari:~#ssh-keygen

root@name:~# scp /root/.ssh/id_rsa.pub root@data1:/tmp
root@name:~# scp /root/.ssh/id_rsa.pub root@data2:/tmp

root@data1:~#cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys
root@data1:~#chmod 700 ~/.ssh
root@data1:~#chmod 600 ~/.ssh/authorized_keys

root@data2:~#cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys
root@data2:~#chmod 700 ~/.ssh
root@data2:~#chmod 600 ~/.ssh/authorized_keys

root@ambari:~# scp /root/.ssh/id_rsa.pub root@name:/tmp
root@ambari:~# scp /root/.ssh/id_rsa.pub root@data1:/tmp/ambari_id_rsa.pub
root@ambari:~# scp /root/.ssh/id_rsa.pub root@data2:/tmp/ambari_id_rsa.pub

root@data1:~#cat /tmp/ambari_id_rsa.pub >> ~/.ssh/authorized_keys
root@data1:~#/etc/init.d/ssh restart
root@data2:~#cat /tmp/ambari_id_rsa.pub >> ~/.ssh/authorized_keys
root@data2:~#/etc/init.d/ssh restart

root@name:~#cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys
root@name:~#/etc/init.d/ssh restart
root@name:~#chmod 700 ~/.ssh
root@name:~#chmod 600 ~/.ssh/authorized_keys

root@ambari:/#apt-get update
root@ambari:/#apt-get install postgresql postgresql-contrib
root@ambari:/#/etc/init.d/postgresql start

root@data1:/#wget -nv http://public-repo-1.hortonworks.com/ambari/ubuntu14/2.x/updates/2.1.2/ambari.list -O /etc/apt/sources.list.d/ambari.list

root@data1:/#apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD

root@data1:/#apt-get update

root@data2:/#wget -nv http://public-repo-1.hortonworks.com/ambari/ubuntu14/2.x/updates/2.1.2/ambari.list -O /etc/apt/sources.list.d/ambari.list

root@data2:/#apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD

root@data2:/#apt-get update

root@name:/#wget -nv http://public-repo-1.hortonworks.com/ambari/ubuntu14/2.x/updates/2.1.2/ambari.list -O /etc/apt/sources.list.d/ambari.list

root@name:/#apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD

root@name:/#apt-get update

root@ambari:/#wget -nv http://public-repo-1.hortonworks.com/ambari/ubuntu14/2.x/updates/2.1.2/ambari.list -O /etc/apt/sources.list.d/ambari.list

root@ambari:/#apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD

root@ambari:/#apt-get update

root@ambari:/#apt-get install ambari-server
root@ambari:/#apt-get install ambari-agent

root@ambari:/#ambari-server setup
// select default answer for all questions during setup

root@ambari:/#ambari-server start

name@host:/#docker inspect -f '{{ .NetworkSettings.IPAddress }}' ambari

172.17.0.17

// open in browser http://172.17.0.17:8080 and login with admin/admin as username/password
// click on Launch Install Wizard button
// enter mycluster as cluster name then click next
// select HDP 2.3 then click next
// in target hosts enter
// name
// data1
// data2
// and

root@ambari:/# cat ~/.ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAk...47QxOaBp4tIy+9Ezg==
-----END RSA PRIVATE KEY-----

// copy the private key to ssh private key text box
// then click register and Confirm button
// you should see every host is registered successfully , click next button
// in page Choose Services click next button
// in page Assign Masters, select HDFS , YARN + MapReduce2, ZooKeeper,Ambari Metrics , then click next button
// in page Assign Slaves and Clients, select name as name node and data1 as Sname(secondary name node)
// in Assign Slaves and Clients and Customize Services pages, click next button, and after Review page, click Deploy button