這篇文章將為大家詳細(xì)講解有關(guān)ubuntu docker怎樣搭建Hadoop集群環(huán)境,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
spark要配合Hadoop的hdfs使用,然而Hadoop的特點(diǎn)就是分布式,在一臺(tái)主機(jī)上搭建集群有點(diǎn)困難,百度后發(fā)現(xiàn)可以使用docker構(gòu)建搭建,于是開(kāi)搞:
github項(xiàng)目:https://github.com/kiwenlau/hadoop-cluster-docker
docker安裝
文章中安裝的是docker.io
但是我推薦安裝docker-ce,docker.io版本太老了,步驟如下:
1、國(guó)際慣例更新下APT軟件包的源
sudo apt-get update
2、安裝軟件包以允許apt通過(guò)HTTPS使用存儲(chǔ)庫(kù)
sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common
3、因?yàn)楸粔κ褂媒逃W(wǎng)鏡像:
復(fù)制代碼 代碼如下:
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add
4、同樣
sudo add-apt-repository \ "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \ $(lsb_release -cs) \ stable"
5、更新下我們的軟件源
sudo apt-get update
6、安裝docker
sudo apt-get install docker-ce
7、啟動(dòng)docker服務(wù)
sudo service docker start
or
sudo systemctl start docker
8、覺(jué)得有必要可以設(shè)置開(kāi)機(jī)自帶啟動(dòng)
sudo systemctl enable docker
9、關(guān)閉自啟動(dòng)
sudo systemctl disable docker
10、國(guó)內(nèi)訪問(wèn)docker會(huì)受限制,可以使用加速服務(wù),阿里云、網(wǎng)易云、DaoCloud
11、運(yùn)行 docker run hello-world
測(cè)試是否安裝成功
12、想要安裝其他image 可以到docker hub上找
https://hub.docker.com/
或是直接在github上搜索相應(yīng)docker
搭建Hadoop集群
搭建過(guò)程很簡(jiǎn)單
https://github.com/kiwenlau/hadoop-cluster-docker
上步驟說(shuō)明很詳細(xì):
1、pull鏡像,速度慢的換國(guó)內(nèi)鏡像源
sudo docker pull kiwenlau/hadoop:1.0
200多m不算大,我下過(guò)jupyter官方pyspark的docker 5g…
2、克隆項(xiàng)目到本地
git clone https://github.com/kiwenlau/hadoop-cluster-docker
其實(shí)只用到里面的 start-container.sh 文件也可以單獨(dú)下,復(fù)制粘貼啥的
3、start-container.sh 需要修改一下 cd 到文件目錄
sudo gedit start-container.sh
修改如下
開(kāi)放9000端口還有創(chuàng)建共享文件夾方便以后使用
4、保存之后,創(chuàng)建docker-Hadoop網(wǎng)絡(luò)
sudo docker network create --driver=bridge hadoop
5、開(kāi)啟容器
sudo ./start-container.sh
6、開(kāi)啟Hadoop集群
./start-hadoop.sh
7、測(cè)試一下Hadoop,在hdfs上創(chuàng)建 test/input 目錄
hadoop fs -mkdir -p /test/input hadoop fs -ls /test
8、運(yùn)行word-count程序
./run-wordcount.sh
結(jié)果如下
關(guān)于“ubuntu docker怎樣搭建Hadoop集群環(huán)境”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。
當(dāng)前文章:ubuntudocker怎樣搭建Hadoop集群環(huán)境-創(chuàng)新互聯(lián)
標(biāo)題鏈接:http://aaarwkj.com/article42/gioec.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)公司、外貿(mào)建站、網(wǎng)站排名、網(wǎng)站改版、動(dòng)態(tài)網(wǎng)站、App設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容