## 快速入門
### 一.下載 Mesos
獲取Mesos有兩個渠道:
* 從 Apache下載最新的穩定版本 (推薦)
```
$ wget http://www.apache.org/dist/mesos/0.28.2/mesos-0.28.2.tar.gz
$ tar -zxf mesos-0.28.2.tar.gz
```
* 從 Mesos git 倉庫下載源碼 (適合高手)
```
$ git clone https://git-wip-us.apache.org/repos/asf/mesos.git
```
> NOTE: If you have problems running the above commands, you may need to first run through the System Requirements section below to install the wget, tar, and git utilities for your system.
### 二.系統前提條件
Mesos需要運行在 Linux (64 Bit) 或者 Mac OS X (64 Bit)系統上. 如果從源代碼構建mesos,需要 GCC 4.8.1+ or Clang 3.5+.
為了完整的支持進程隔離,需要linux內核的最小版本為3.10。
為了完整的支持Docker主機的網絡能力,確保你的hostname可以通過DNS或者/etc/hosts被解析,并且進行mesos測試.當你有疑問的時候,請檢查你的/etc/hosts文件是否含有你的hostname.
#### 2.1 Ubuntu 14.04
下面是關于Ubuntu 14.04的說明.如果你使用別的操作系統,請安裝相應的的包.
```
# 包更新
$ sudo apt-get update
# 安裝一些工具.
$ sudo apt-get install -y tar wget git
# 安裝最新版本的 OpenJDK.
$ sudo apt-get install -y openjdk-7-jdk
# 安裝自動化工具 (只有在你從git 倉庫構建的時候才需要這步).
$ sudo apt-get install -y autoconf libtool
# 安裝 Mesos 的依賴
$ sudo apt-get -y install build-essential python-dev libcurl4-nss-dev libsasl2-dev libsasl2-modules maven libapr1-dev libsvn-dev
```
#### 2.2 Mac OS X Yosemite & El Capitan
下面是關于Mac OS X Yosemite and El Capitan的說明.如果你使用別的操作系統,請安裝相應的的包.
```
# 安裝命令行工具
$ xcode-select --install
# 安裝 Homebrew.
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# 安裝java
$ brew install Caskroom/cask/java
# 安裝依賴包 .
$ brew install wget git autoconf automake libtool subversion maven
```
> NOTE: When upgrading from Yosemite to El Capitan, make sure to rerun xcode-select --install after the upgrade.
#### 2.3 CentOS 6.6
下面是關于CentOS 6.6的說明.如果你使用別的操作系統,請安裝相應的的包.
```
# 為了支持進程隔離,請安裝最新的內核
$ sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
$ sudo rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
$ sudo yum --enablerepo=elrepo-kernel install -y kernel-lt
# 使剛剛安裝的內核作為默認啟動的內核,重啟
$ sudo sed -i 's/default=1/default=0/g' /boot/grub/grub.conf
$ sudo reboot
# 安裝一些工具,強制更新nss
# which is necessary for the Java bindings to build properly.
$ sudo yum install -y tar wget git which nss
# 'Mesos > 0.21.0' 需要 a C++ 編譯器完全支持 C++11 (比如. GCC > 4.8)
# (比如. GCC > 4.8) 在 'devtoolset-2'提供.
# 獲取 Scientific Linux CERN devtoolset repo 文件.
$ sudo wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo
# 導入 CERN GPG key.
$ sudo rpm --import http://linuxsoft.cern.ch/cern/centos/7/os/x86_64/RPM-GPG-KEY-cern
# 獲取 Apache Maven repo 文件.
$ sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
# 'Mesos > 0.21.0' 需要 'subversion > 1.8' devel 包,這個在默認的倉庫中找不到
# 所以需要新建一個 WANdisco SVN repo 文件 ,才能安裝正確的版本:
$ sudo cat > /etc/yum.repos.d/wandisco-svn.repo <<EOF
[WANdiscoSVN]
name=WANdisco SVN Repo 1.8
enabled=1
baseurl=http://opensource.wandisco.com/centos/6/svn-1.8/RPMS/$basearch/
gpgcheck=1
gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
EOF
# 安裝必要的開發工具
$ sudo yum groupinstall -y "Development Tools"
# 安裝 'devtoolset-2-toolchain' 包含 GCC 4.8.2 和相關包.
$ sudo yum install -y devtoolset-2-toolchain
# 安裝其他的 Mesos 依賴.
$ sudo yum install -y apache-maven python-devel java-1.7.0-openjdk-devel zlib-devel libcurl-devel openssl-devel cyrus-sasl-devel cyrus-sasl-md5 apr-devel subversion-devel apr-util-devel
# 進入 shell 使 'devtoolset-2' 可用.
$ scl enable devtoolset-2 bash
$ g++ --version # Make sure you've got GCC > 4.8!
# 進程隔離采用的是cgroups,被'cgconfig'所管理
# 在CentOS 6.6 'cgconfig' 服務默認是不啟動的.
# Also the default configuration does not attach the 'perf_event' subsystem.
# To do this, add 'perf_event = /cgroup/perf_event;' to the entries in '/etc/cgconfig.conf'.
$ sudo yum install -y libcgroup
$ sudo service cgconfig start
```
#### 2.4 CentOS 7.1
下面是關于CentOS 7.1的說明.如果你使用別的操作系統,請安裝相應的的包.
```
# 安裝一些工具
$ sudo yum install -y tar wget git
# 獲取 Apache Maven repo 文件.
$ sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
# 安裝 EPEL repo ,這樣可以在安裝subversion的時候拉取'libserf-1'
$ sudo yum install -y epel-release
# 'Mesos > 0.21.0' 需要 'subversion > 1.8' devel 包,這個在默認的倉庫中找不到
# 所以需要新建一個 WANdisco SVN repo 文件 ,才能安裝正確的版本:
$ sudo cat > /etc/yum.repos.d/wandisco-svn.repo <<EOF
[WANdiscoSVN]
name=WANdisco SVN Repo 1.9
enabled=1
baseurl=http://opensource.wandisco.com/centos/7/svn-1.9/RPMS/$basearch/
gpgcheck=1
gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
EOF
# Parts of Mesos require systemd in order to operate. However, Mesos
# only supports versions of systemd that contain the 'Delegate' flag.
# This flag was first introduced in 'systemd version 218', which is
# lower than the default version installed by centos. Luckily, centos
# 7.1 has a patched 'systemd < 218' that contains the 'Delegate' flag.
# Explicity update systemd to this patched version.
$ sudo yum update systemd
# 安裝必要的開發工具
$ sudo yum groupinstall -y "Development Tools"
# 安裝 Mesos 依賴.
$ sudo yum install -y apache-maven python-devel java-1.8.0-openjdk-devel zlib-devel libcurl-devel openssl-devel cyrus-sasl-devel cyrus-sasl-md5 apr-devel subversion-devel apr-util-devel
```
## 三.構建 Mesos
```
# 切換工作目錄
$ cd mesos
# 引導 (只有從 git repository構建的情況需要這步).
$ ./bootstrap
# 配置與構建
$ mkdir build
$ cd build
$ ../configure
$ make
```
為了加速構建過程,降低日志的詳細程度,make命令可以使用 -j <cpu 核心數量> V=0
```
# 運行測試套件
$ make check
# 安裝 (可選,這步是把mesos安裝到/bin等系統路徑下).
$ make install
```
## 四. 使用的例子
集成了一些用C++,java,Python寫的示例應用框架.應用框架的二進制文件在運行了make check之后才能得到.如上一章節所示.
```
# 切換到 build 目錄.
$ 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.
$ ./bin/mesos-agent.sh --master=127.0.0.1:5050
# 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
```
Note: These examples assume you are running Mesos on your local machine. Following them will not allow you to access the Mesos web page in a production environment (e.g. on AWS). For that you will need to specify the actual IP of your host when launching the Mesos master and ensure your firewall settings allow access to port 5050 from the outside world.
- 版權
- 博客主題
- 如何不去做運行3.5G-docker鏡像的工程師
- 預備主題
- FastDFS快速入門
- mysql定時創建月表
- SpringMVC-Restful
- Docker生態系統
- The Docker Ecosystem: An Introduction to Common Components
- docker監控指標
- 基于etcd服務發現的overlay跨多宿主機容器網絡
- etcd:從應用場景到實現原理的全方位解讀
- docker存儲驅動詳解
- 使用docker/engine-api操作docker
- 提升Docker安全性
- docker安全之用戶資源隔離
- marathon
- 開始
- 安裝mararhon
- 高可用模式
- 使用marathon
- 應用的部署
- 架構組件
- Dubbo與Zookeeper、SpringMVC整合和使用(負載均衡、容錯)
- Openstack架構解析
- haproxy
- Ubuntu系統安裝截圖
- mesos官方文檔
- 關于譯者
- mesos基礎
- Mesos架構
- 視頻與ppt
- 讓mesos跑起來
- 快速入門
- 配置
- Containerizer
- Docker Containerizer
- 監控
- 博客文章集
- 煮餃子與mesos之間妙不可言的關系
- linux運維
- 基礎篇
- 進階篇
- mysql
- Ubuntu14.04安裝mysql5.6
- MySQL 5.6 replicate原理與實踐
- mysql性能
- redis
- redis安裝及基礎知識
- redis數據結構
- redis命令
- redis數據持久化
- Redis主從復制
- redis集群
- 其他