Apache Mesos1.0.1 編譯安裝部署教程(ubuntu)


參考資料

官方文檔:http://mesos.apache.org/documentation 
中文翻譯:http://mesos.mydoc.io/ 
GitHub:https://github.com/apache/mesos/tree/master 
董的博客:http://dongxicheng.org/category/apache-mesos/

mesos下載源碼

    官網上下載源碼

    http://mesos.apache.org/downloads/

安裝依賴包

  根據官網教程(http://mesos.apache.org/gettingstarted/)先安裝依賴包

  

# Update the packages.
$ sudo apt-get update

# Install a few utility tools.
$ sudo apt-get install -y tar wget git

# Install the latest OpenJDK.
$ sudo apt-get install -y openjdk-7-jdk

# Install autotools (Only necessary if building from git repository).
$ sudo apt-get install -y autoconf libtool

# Install other Mesos dependencies.
$ sudo apt-get -y install build-essential python-dev libcurl4-nss-dev libsasl2-dev libsasl2-modules maven libapr1-dev libsvn-dev

 

配置並編譯

# Change working directory.
$ cd mesos

# Bootstrap (Only required if building from git repository).
$ ./bootstrap

# Configure and build.
$ mkdir build
$ cd build
$ ../configure --prefix=/home/hl/mesos_install
#prefix參數就是安裝的路徑,最好自己新建一個文件 夾,不要使用默認,默認的目錄為/usr/local,如果默認安裝的話會出現很多權限問題  
$ make

 

測試編譯結果

   編譯好之后打開build/bin,使用下述命令啟動mesos-master,以及附屬的一個slave來檢查是否編譯成功 

$ ./bin/mesos-master.sh --ip=127.0.0.1 --work_dir=/home/hl/mesos_install/log/master  
   
# Start mesos slave.  
$ ./bin/mesos-slave.sh --master=127.0.0.1:5050 

 

   在本機上訪問如下地址$ http://127.0.0.1:5050,如果用瀏覽器訪問上述網頁成功,而且面中現實激活的節點為1個則說明編譯成功了

安裝

安裝的過程就是把mesos集群啟動過程中需要的執行文件,庫文件等集中放置到系統路勁下,一般系統路徑是/usr/sbin、/usr/bin等。但是這個路勁是可以改變的,在之間./configuire操作的時候--prefix操作就是設置安裝的目錄。

雖然教程中安裝只有一句命令“make install”,但是make install有時候會出現問題,比如:

Command Python setup.py egg_info failed with error code 1 in     /tmp/pip_build_ndn/protobuf

出現這個問題的原因是安裝過程中會下載一些軟件,這些數據被牆了,解決的方法是使用國內的源先把需要軟件安裝了,針對上述問題,是pip被牆了,使用清華的源: https://wiki.tuna.tsinghua.edu.cn/MirrorUsage/pypi修改源的步驟在上訴鏈接中給出了,我使用第一中方法,“臨時使用源”。根據錯誤提示,被牆的包為google-apputils和protobuf,那么我使用pip命令安裝這兩個軟件如下:

sudo pip install -i https://pypi.tuna.tsinghua.edu.cn/simple google-apputils  
#沒有安裝pip請安裝sudo apt-get install python-pip  
sudo pip install -i https://pypi.tuna.tsinghua.edu.cn/simple protobuf  
#上述步驟進行之后就可以不出錯地安裝了  
make install  

 

測試

mesos 安裝好后,提供了c++ /java / python的測試例子,如果在web界面中看到有任務finshed,說明編譯成功。

# Change into build directory.
$ cd build

# Start mesos master (Ensure work directory exists and has proper permissions).
$ ./bin/mesos-master.sh --ip=127.0.0.1 --work_dir=/var/lib/mesos

# Start mesos agent (Ensure work directory exists and has proper permissions).
$ ./bin/mesos-agent.sh --master=127.0.0.1:5050 --work_dir=/var/lib/mesos

# Visit the mesos web page.
$ http://127.0.0.1:5050

# Run C++ framework (Exits after successfully running some tasks.).
$ ./src/test-framework --master=127.0.0.1:5050

# Run Java framework (Exits after successfully running some tasks.).
$ ./src/examples/java/test-framework 127.0.0.1:5050

# Run Python framework (Exits after successfully running some tasks.).
$ ./src/examples/python/test-framework 127.0.0.1:5050

 

接下里基於mesos提供的Java接口,寫個簡單的分布式框架(運行在mesos上的程序)demo。

配置mesos集群

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM