💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## 快速入门 ### 一.下载 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.