CassandraSmith 2015-12-13
DockerandVirtualBox(1)SetupSharedDiskforVirtualBox
IhavealotofthingsonmyVirtualBox.ButIamthinktochangethewayIdeploy,IshouldusedockermorethatIthought.
Iplantosharethediskacrosssomevirtualmachinesanddeployonlydockerimages.
HereisalistofwhatIhaveonthesemachines.
ubuntu-master
1.Spark
cd/opt/spark
sbin/start-all.sh
visitthepage
http://ubuntu-master:8080/
2.opscenter
cd/opt/opscenter
bin/opscenter-f#startinthefrontground
bin/opscenter#startinthebackground
visitthepage
http://ubuntu-master:8888/opscenter/
3.tomcat
cd/opt/tomcat
bin/startup.sh
visitthepage
http://ubuntu-master:8081/bldinfo.txt
http://ubuntu-master:8081/LMMAdmin
4.kafkaMonitor
cd/opt/kafka-monitor
nohupbin/startup.sh&
visitthepage
http://ubuntu-master:8082/
5.memcachedMonitor
memcache-top--sleep3--instanceubuntu-dev1,ubuntu-dev2
6.SwitchJavaVersion
sudoupdate-alternatives--configjava
sudoupdate-alternatives--configjavac
7.Hadoophdfsandyarn
cd/opt/hadoop
sbin/start-dfs.sh
sbin/start-yarn.sh
visitthepage
http://ubuntu-master:50070/dfshealth.html#tab-overview
http://ubuntu-master:8088/cluster
8.Haproxy
cd/opt/haproxy
sudosbin/haproxy-fconf/haproxy.conf
Visitthepage
http://ubuntu-master/haproxy-status
9.Mysqlclusterdatabase
mysql-ucluster-pcluster
10.hbase
cd/opt/hbase
bin/start-hbase.sh
visitthepage
http://ubuntu-master:16030/master-status
11.solr
cd/opt/solr/example
java-jarstart.jar
VisitPage
http://ubuntu-master:8983/solr/#/jobs
ubuntu-dev1
1.cassandra
cd/opt/cassandra
nohupcassandra-fconf/cassandra.yaml&
2.zookeeper
cd/opt/zookeeper
zkServer.shstartzoo-dev1.cfg
3.kafka
cd/opt/kafka
nohupbin/kafka-server-start.shconfig/server-dev1.properties&
4.rabbitmq
cd/opt/rabbitmq
sudoRABBITMQ_NODE_PORT=5672RABBITMQ_SERVER_START_ARGS="-rabbitmq_managementlistener[{port,15672}]"RABBITMQ_NODENAME=rabbit1sbin/rabbitmq-server-detached
visitpage
http://ubuntu-dev1:15672sillycat/kaishi
5.memcached
cd/opt/memcached
memcached-d-m50-p11211-ucarl-l0.0.0.0
6.SwitchJavaVersion
sudoupdate-alternatives--configjava
sudoupdate-alternatives--configjavac
ubuntu-dev2
1.cassandra
cd/opt/cassandra
nohupcassandra-fconf/cassandra.yaml&
2.zookeeper
cd/opt/zookeeper
zkServer.shstartzoo-dev2.cfg
3.kafka
cd/opt/kafka
nohupbin/kafka-server-start.shconfig/server-dev2.properties&
4.rabbitmq
cd/opt/rabbitmq
sudoRABBITMQ_NODE_PORT=5672RABBITMQ_SERVER_START_ARGS="-rabbitmq_managementlistener[{port,15672}]"RABBITMQ_NODENAME=rabbit2sbin/rabbitmq-server-detached
enablecluster
sudosbin/rabbitmqctl-nrabbit2stop_app
sudosbin/rabbitmqctl-nrabbit2join_clusterrabbit1@ubuntu-dev1
sudosbin/rabbitmqctl-nrabbit2start_app
visitpage
http://ubuntu-dev2:15672sillycat/kaishi
5.memcached
cd/opt/memcached
memcached-d-m50-p11211-ucarl-l0.0.0.0
6.SwitchJavaVersion
sudoupdate-alternatives--configjava
sudoupdate-alternatives--configjavac
IwillexportallofthemandbackupthemintomyhomeNAS.IwilldeleteallofthemonmylocalandsetupfreshubuntuLTSforthat.
1SetupShareDriver
Icreatevirtualmachineubuntu-master,ubuntu-dev1,ubuntu-dev2andallofthemhavetheirowndriver,andashareddriverwithnameshared-nas.
>sudofdisk-l
Disk/dev/sda:85.9GB,85899345920bytes
255heads,63sectors/track,10443cylinders,total167772160sectors
Units=sectorsof1*512=512bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x000645fe
DeviceBootStartEndBlocksIdSystem
/dev/sda1*20481595822077979008083Linux
/dev/sda215958425416777011140929295Extended
/dev/sda5159584256167770111409292882Linuxswap/Solaris
Disk/dev/sdb:85.9GB,85899345920bytes
255heads,63sectors/track,10443cylinders,total167772160sectors
Units=sectorsof1*512=512bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x00000000
Disk/dev/sdbdoesn'tcontainavalidpartitiontable
Solution:
>sudomkfs-text3/dev/sdb
Itdoesnotwork.
Initiatethediskwithfollowing
>sudofdisk/dev/sdb
>m>n>p>1
defaultforotherinformation,then>w
Itworks.
>sudofdisk-l
Disk/dev/sda:85.9GB,85899345920bytes
255heads,63sectors/track,10443cylinders,total167772160sectors
Units=sectorsof1*512=512bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x000645fe
DeviceBootStartEndBlocksIdSystem
/dev/sda1*20481595822077979008083Linux
/dev/sda215958425416777011140929295Extended
/dev/sda5159584256167770111409292882Linuxswap/Solaris
Disk/dev/sdb:85.9GB,85899345920bytes
86heads,10sectors/track,195083cylinders,total167772160sectors
Units=sectorsof1*512=512bytes
Sectorsize(logical/physical):512bytes/512bytes
I/Osize(minimum/optimal):512bytes/512bytes
Diskidentifier:0x070ebcd0
DeviceBootStartEndBlocksIdSystem
/dev/sdb120481677721598388505683Linux
Formattoext3
>sudomkfs-text3/dev/sdb1
Itworks.ThenIwillconfigurethedockertousethissharedriver.
2AutoMounttheDrivertoSystem
Createthefolder
>sudomkdir/mnt/nas
ListtheUUIDofmydisk
>ls-l/dev/disk/by-uuid
total0
lrwxrwxrwx1rootroot10Dec1117:456624adb3-86bc-4801-8275-063cdfae706b->../../sda5
lrwxrwxrwx1rootroot9Dec1117:4575595e30-261b-4ee1-a855-4b4f5428d583->../../sdb
lrwxrwxrwx1rootroot10Dec1117:458e864fd6-914f-489f-abf7-85744496c664->../../sda1
lrwxrwxrwx1rootroot10Dec1117:45adcfd350-219a-414f-92a6-e175b334d970->../../sdb1
Copytheoneofsdb1,editthefilefstab
>sudovi/etc/fstab
UUID=adcfd350-219a-414f-92a6-e175b334d970/mnt/nasautodefaults00
Amountthedisk
>sudomount-a
Checktheamount
>df-hl/mnt/nas/
FilesystemSizeUsedAvailUse%Mountedon
/dev/sdb179G56M75G1%/mnt/nas
3InstallandSetupDocker
>sudomkdir/mnt/nas/docker
Installation
>sudocurl-sSLhttps://get.docker.com/|sh
>sudousermod-aGdockercarl
or
>sudogpasswd-acarldocker
Changetheconfiguration
>sudovi/etc/default/docker
DOCKER_OPTS="-g/mnt/nas/docker"
>dockerinfo
Containers:0
Images:0
ServerVersion:1.9.1
StorageDriver:aufs
RootDir:/mnt/nas/docker/aufs
Doneandtry
>dockerpullcentos:7
>df-hl
FilesystemSizeUsedAvailUse%Mountedon
/dev/sda175G1.3G70G2%/
none4.0K04.0K0%/sys/fs/cgroup
udev1.9G4.0K1.9G1%/dev
tmpfs386M484K386M1%/run
none5.0M05.0M0%/run/lock
none1.9G01.9G0%/run/shm
none100M0100M0%/run/user
/dev/sdb179G242M75G1%/mnt/nas
FilearestoredinthesharedNASdisk.
TheproblemisthatItrytocreateasharedvdiandaskalltheclientsubuntusystemtoloadthesameNASdisk.Itdoesnotwork.Iwilltrysharedfolder.
>sudoapt-getinstallvirtualbox-guest-additions-iso
>sudoapt-getinstallvirtualbox-guest-utils
>sudomount-tvboxsfnas/mnt/nas
Itworks.ButwhenIstartthedocker,dockerthrowexceptioninlogging
>sudoless/var/log/upstart/docker.log
ESC[31mERROESC[0m[0000][graphdriver]priorstoragedriver"aufs"failed:invalidargument
ESC[31mFATAESC[0m[0000]Errorstartingdaemon:errorinitializinggraphdriver:invalidargument
>VBoxManagemodifymedium--typeshareablenas.vdi
Itworks.
References:
https://help.ubuntu.com/community/InstallingANewHardDrive
http://tutorialforlinux.com/2014/08/01/ubuntu-how-to-automatically-mount-a-ext2-ext3-ext4-linux-partition-on-startup-easy-guide/
https://forums.docker.com/t/how-do-i-change-the-docker-image-installation-directory/1169
http://www.oracledistilled.com/virtualbox/creating-shared-drives-in-oracle-vm-virtualbox/
http://www.giannistsakiris.com/2008/04/09/virtualbox-access-windows-host-shared-folders-from-ubuntu-guest/
http://superuser.com/questions/745868/mount-failed-unknown-file-system-in-virtualbox-in-ubuntu-14-04-and-windows-7-a
http://stackoverflow.com/questions/30969435/where-is-the-docker-daemon-log