Mesos安装
2018-12-27 本文已影响2人
王勇1024
系统版本:CentOS Linux release 7.2.1511 (Core)
Mesos版本:1.7.0
获取Mesos
从Apache官网下载最新稳定版本
$ wget http://www.apache.org/dist/mesos/1.7.0/mesos-1.7.0.tar.gz
$ tar -zxf mesos-1.7.0.tar.gz
从Git仓库clone
$ git clone [https://gitbox.apache.org/repos/asf/mesos.git](https://gitbox.apache.org/repos/asf/mesos.git)
系统要求
Mesos运行在Linux (64 Bit) 和 Mac OS X (64 Bit). 如果要从源码编译Mesos,需要安装GCC 4.8.1+ 或者 Clang 3.5+。
Linux内核版本需要>= 2.6.28,为了完全支持Linux下的进程隔离,内核版本需要>= 3.10。
确保你的主机名可以通过 DNS 或 /etc/hosts 解析,从而可以完全支持 Docker 的 hostnetworking 功能。这在一些 Mesos 测试中会被用到。如有疑问,请确认 /etc/hosts 中包含 你的主机名。
安装前准备
# 安装Git
$ sudo yum install -y tar wget git
# Fetch the Apache Maven repo file.
$ sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
# Install the EPEL repo so that we can pull in 'libserf-1' as part of our
# subversion install below.
$ sudo yum install -y epel-release
# 'Mesos > 0.21.0' requires 'subversion > 1.8' devel package,
# which is not available in the default repositories.
# Create a WANdisco SVN repo file to install the correct version:
$ sudo bash -c '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
# Install essential development tools.
$ sudo yum groupinstall -y "Development Tools"
# Install other Mesos dependencies.
$ sudo yum install -y apache-maven python-devel python-six python-virtualenv 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
# Change working directory.
$ cd mesos
# Bootstrap (Only required if building from git repository).
$ ./bootstrap
# Configure and build.
$ mkdir build
$ cd build
$ ../configure
$ make
为了加快构建以及减少冗长的 log ,你可以在 make 命令后添加 -j \ V=0
# Run test suite.
$ make check
# Install (Optional).
$ make install
示例
Mesos 包含了用 Java , C++ , Python 写的 frameworks 示例。frameworks 示例的二进制文件 只有在运行了 make check 之后才可用。
# 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